Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Elixir/phoenix] Implementing suggestions from @josevalim #9302

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

atavistock
Copy link
Contributor

Conversation in #9198 lead to some meaningful optimizations

Specifically

  • Obtain one db connection for all queries within a request.
  • Optimized flow of getting world ids

@atavistock atavistock changed the title Implementing suggestions from @josevalim [Elixir/phoenix] Implementing suggestions from @josevalim Sep 30, 2024
@josevalim
Copy link
Contributor

This is beautiful, thank you for working on it! ❤️

The only other feedback I have, which we should explore in a separate pull request anyway, is to increase the pool size. For multiple queries, we are not getting more performance from high concurrency numbers, and I assume this is either because our pool size is too small (we use 50, some of the Rust repos use 1024) or our polling is a bottleneck (it is a single process).

I am away from my computer with 10 cores, so when I am back home, I want to run some benchmarks on top of Ecto polling and try to get some numbers. In particular, I may want to add multiple pools inside Ecto, and then we can try running 8 pools with 32 connections each or similar. But we should probably wait for this PR to be merged and see a trial run, so we can see baseline numbers. :)

If you want, I can keep you posted on the Ecto efforts. Have a fantastic week!

@atavistock
Copy link
Contributor Author

@srcrip I just wanted to drop a note that this PR was in flight to do Repo.checkout where you were adding Repo.transaction. I tested with checkout, transaction, and checkout+transaction and in these specific performance tests it seems like just the just using Repo.checkout is the best performance presumably because theres very few writes.

@josevalim
Copy link
Contributor

Correct. transaction is checkout+begin+commit, but if you are only doing reads, you don't need begin+commit. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants