tfischbach

tfischbach

Ecto/Poolboy queueing

I am using Tsung to load test a Phoenix channel that performs quite a bit of db queries when handling messages. When I increase the number of concurrent clients to about 5000 each sending a message every few seconds, I start to see that db queries take longer. Ecto logs “queue”, “query” and “decode” time individually. The delay is exclusively caused by the “queue” component. While the CPU load on the web host is high, the db host does not see significant load. Queue times increase to up to a few seconds.

Using the observer I can see that the MsgQ of the Repo.Pool process is filling up. Does anyone know

a) whether this is a sign that no more db connections are available in the pool? Increasing the pool size did not have a significant effect, though.
b) whether this could be caused by the high CPU load? Could it be that the scheduler does not assign enough CPU time to the Ecto.Pool process to handle its message?
c) what else might help to improve this situation?

Generally, I have the impression that handling messages via Phoenix channels is quite CPU intensive. Even with simple end points that only do trivial in memory computations, 10000 concurrent users quickly take up to 80% percent of the CPU resources on a server with eight cores.

I have found that disabling Ecto and Phoenix channel logging improved things. Even when the log level was set to warn, both still send debug messages to the Logger process even if they are silenced. The MsgQ of the Logger process was filling up.

Any other performance improvements others might have come across?

Thanks!

Most Liked

michalmuskala

michalmuskala

What was the size of the VM run queue during the tests? This can indicate if the server was overloaded in general or is the problem local to the repo pool.

You could also try working with the sojurn pool - it should handle working during overload better.

Where Next?

Popular in Questions Top

New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement