Search code examples
dockeramazon-ec2asp.net-core-2.0amazon-ecselastic-load-balancer

slowness after migrating to netcoreapp 2.0 and docker AWS ECS


I have migrated our WebAPI .net 4.6.1 project to netcoreapp2.0 After load testing have below observations. Need feedback ?

Old stack : AWS App Load balancer (ALB) -> EC2 (c4.large) -> WebAPI .net 4.6.1 (IIS)

New Stack : AWS App Load Balancer (ALB) -> ECS docker (c4.large eq) -> WebAPI netcore 2.0 (Kestrel) on Linux

Response time comparisons : .net vs netcore2.0

Refer above response times comparison for .net 4.6 Vs netcore 2.0 Web API hosted on linux ECS docker

  1. Till 20 RPS netcore2.0 is faster.
  2. After 20 RPS netcore 2.0 slows down and spiky.
  3. Few more tests on netcore 2.0 failed after 40 RPS. Application simply does not respond.

Was looking out for tuning kestrel.Removed AWS ALB and started hitting directly on IP from docker. Tests with 50 RPS were completing.

Questions :

  1. Has anybody observed AWS ALB not performing well when tied to docker and kestrel hosted WebAPI. As when I remove ALB things are good even till 80 RPS

  2. Is putting Nginix in between ALB and Kestrel is good option and will help kestrel take more load and perform consistently on load.

  3. Any other kestrel configuration that can be tweaked.


Solution

  • The slowness was not due to migrating to .netcore, but while migrating we had badly coded one middleware. After fixing that. Response times were comparable even on high load.