Docker swarm : Very slow communication between two container on same host


I’m quite new to docker, I have set up a docker swarm on a local VM in order to run multiple micro services which have to communicate between each other.

This seems to work very well but I have one major issue on json request between container.

Handling the request and send a response takes about 20ms on the microservice, but the call between the two containers is always over 500ms, sometimes even more than a second.

I’m using swarm service name to resolve the containers in order to take advantage of the loadbalancer (even if I only have one service running for each container as this is only a development platform. I don’t know if this could be related or not to my issue.

Does anyone have an idea on how to solve this ?

Thanks a lot.

We have a similar issue, in our case the slow communication happens only on the first request after a given service has been idle for a while.

Did you manage to figure this out?