Target response time of ECS task running through load balancer is twice as slow compared to standalone EC2 instance

Viewed 704

we have transitioned our old standalone EC2 instance to ECS service routing each ECS task running under Elastic LB.

Seems like EC2 instance was faster to receive incoming network requests and had higher throughput, because we were able to receive and store 170k results every hour. Now after switching to ECS service under ELB we only receive 140k and that is running 2 ECS tasks, which have more CPU power and RAM than old EC2 instance. That doesn't improve even if we spin up 4 ECS tasks.

Furthermore, average network request response time for ECS instance used to be 1 second, but on ECS service it takes 2.2 seconds on average to respond. So seems like ECS service running under ELB has slower response time(twice!) and lesser network throughput.

Our original EC2 instance was running PHP 7.2 under Amazon AMI 1 and new ECS task is using ubuntu docker image with php-fpm.

Here is php-fpm configuration we are using on new ECS tasks:

[www]
pm = dynamic
pm.max_children = 512
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 35
pm.max_requests = 500

And here is mpm prefork settings we used on our old EC2 instance:

StartServers 3
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 600
MaxConnectionsPerChild 0
ServerLimit 600
MaxClients 600
0 Answers
Related