Elastic Beanstalk + Docker Deployment slowdown problem

0

Hello everyone,

we are currently using Elastic Beanstalk + Docker (docker-compose) to deploy a Webapp in Angular 8 with nginx. The webapp consumes an API also deployed via Elastic Beanstalk and Docker. In addition, we are using a bitbucket pipeline to deploy updates.

We didn't change the default nginx config, only added a proxy pass to our API. Additionally, an EC2 load balancer is sitting in between the API and the frontend. The deployment itself works without any problem and all the requests to the backend work initially.

After some time though the requests to the backend are getting slower over time until the frontend throws a Gateway timeout or sometimes even a 404. If we access the API via Postman everything works so the API itself isn't the problem. If we redeploy (via bitbucket or AWS), everything works for a day or two and then the cycle repeats.

We tried using a different nginx version which unfortunately didn't help. We also used the ECS service, where the problem is delayed, but still happens after some period of time. Adding nginx logging yielded that the request time and upstream response time is really high (30 seconds, where the timeouts occurs). We don't really understand what causes this slowdown and why redeploying temporarily fixes the problem.

Thank you for any hints!

1 Answer
0

Hello,

The slowdowns in your Elastic Beanstalk + Docker deployment could be due to caching or resource limitations. Check this troubleshooting guide for Elastic Beanstalk deployments: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/troubleshooting.html

Optimize Nginx Configuration:

  • Increase timeout settings in Nginx (send_timeout, proxy_read_timeout, proxy_connect_timeout, proxy_send_timeout).

Ensure API Health:

  • Add health checks in your Docker Compose file to restart unhealthy containers.
version: '3'
services:
  api:
    ...
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost/ || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3

Configure Load Balancer:

  • Verify ELB settings, health checks, and ensure it has enough capacity.

Enable Auto-Scaling:

  • Configure auto-scaling in Elastic Beanstalk for better load handling.
profile picture
EXPERT
answered a month ago
  • Thank you for your answer! Sadly, the problem still persists. The targets are healthy all the time and also enough Resources are available as there isn't any load. The "AWSSupport-TroubleshootElasticBeanstalk" automation runbook says everything is okay.