Runing phoenixframework in docker TTFB is very slow

I tried to run phoenix in docker container, and found that TTFB time became very slow, in a average by 350ms.

the docker image I used: https://hub.docker.com/r/marcelocg/phoenix/

Have you measured it outside of docker? If so, what are your response times?

1 Like

And is it running in prod or dev?

And what is the host system (running docker on windows incurs a network overhead)?

And if on linux then what is the linking system between the docker network interfaces and the host?

1 Like

I’m actually experiencing the same issue on my machine, i run docker for mac, i tend to believe that it’s a docker issue.

Here are my result, upper directly on my machine, lower on docker.

On the other hand, this is not a issue on our production server, take a look yourself https://www.spaceflex.dk/api/v2?query={storages{id,title}} (Amazon linux image); hence the conclusion that it docker for mac that is the issue.

That’s a very good question. If it is in development, then it is probably the cost of doing system calls for code reloading. It is worth checking if enabling or disabling code reloading changes anything.

2 Likes

Thank you.

I found that I run it in dev so it was slow, and I just run it in prod, it amazing again. :sunglasses:

Have you measured it outside of docker? If so, what are your response times?

When outside of docker in dev model, the TTFB is 180ms in average.

When running in docker, I am noticing that TTFB is ~5X what my phoenix logs say (i.e. [info] Sent 200 in 63ms)

Outside docker, TTFB tracks my phoenix logs pretty closely. Is this what you noticed?