I have a web server running inside a docker container in AWS EC2 Ubuntu instance. When I send requests to the web server, I get the response very slowly (20+ seconds most of the times, although the response time varies). It does not time-out though. The web server is a very lightweight. It is only to test, so almost does not do anything.
docker version 17.03.0-ce
docker-compose version 1.12.0-rc1
How I debugged so far
When sending requests to the web server running in the docker container from within the EC2 instance (url = ' http:// localhost:xxxx/api ') it is still very slow. So should not be related to sending requests from outside.
I run another web server inside the EC2 directly (not in a docker container), and it is not slow. It responses very fastly.
I run another web server inside another docker container in EC2, and it is also very slow!
When I send the request from inside the docker container to the web server that is running in it (at its localhost), it is also very slow!
I run the containers with the same command on my mac computer and the get response is not slow!
Here is one of the containers stats:
CPU %: 0.28%
MEM USAGE / LIMIT: 27.49 MiB / 992.5 MiB
MEM %: 2.77%
NET I/O: 53.7 kB / 30.5 kB
BLOCK I/O: 2.24 MB / 0 B
I understand it might be very hard to know the issue. My question is the steps to debug the cause and finally find the solution. I appreciate if you could explain your approach in detail.