to StackOverflow
to StackOverflow

Reputation: 124696

AWS Lambda vs Kestrel .NET Core performance

I want to develop a Web API using .NET Core that needs to be able to handle a large number of concurrent requests. Furthermore, the WebAPI needs to connect to a database. The Web API will be internal and won't be exposed on Internet.

I'm considering two possibilities:

I'm trying to understand what considerations I need to be aware of that will impact the performance and cost of each of these solutions.

I understand this questions more in terms “if AWS Lambda calls: response = Function(request) are thread-safe”.

The answer is yes.

It is because of one very simple reason. AWS Lambda does not allow for another thread to invoke the same lambda instance before the previous thread exits. And since multiple lambda instances of the same function do not share resources, this is not an issue also.

I understood and interpreted this as meaning:

Is this understanding correct?

Upvotes: 1

Views: 727

Answers (1)

Vlad
Vlad

Reputation: 9481

Yes, each lambda instance is completely isolated, and are running as a single thread. So in your case there will be a lot of database connections.

One problem with your architecture is that you are trying to mix scalable resource in this case lambda with non scalable resource in this case relational database. I've seen such setups explode in very spectacular ways.

So in your case I'd either go with a number of static servers running Kestrel or another high performance web server or would replace the relational database with something that could smoothly scale, like DynamoDB or maybe AWS Aurora

Upvotes: 2

Related Questions