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 Responses

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

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New

Other popular topics Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
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
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

We're in Beta

About us Mission Statement