victorolinasc
Hi all! I am wondering about how you usually tune your production releases for real use load. I mean:
- Number of DB connections
- Any ratio between db connections and the async IO threads VM parameter?
- Any ratio of db connections and max concurrent jobs (for those that use something like ecto_job, rihanna, oban and etc)
- Any custom VM parameters that helped you achieve lower latency/higher throughput
- Any libs that you switched because of production workload issues
- Have you had to use/not had to use Erlang clusters?
- so on…
Here at work we are running a few services with Elixir/Phoenix/Ecto all without tuning anything at all and metrics seem great up to now. We are not handling a huge workload but we believe the tide is coming and I’d like to know the community experience on this part of the journey.
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
The obligatory hello world thread!
Who are you and where are you from? :stuck_out_tongue:
New
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.
My initial shotgu...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
Is there a word for the ~> symbol used in Version strings?
Do you also just call it a Squiggle Arrow™ ?!
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First 5 of 5 Posts
OvermindDL1
Honestly, I don’t touch any tuning until things start to demand it. At most I might tune postgresql a bit after seeing its workload for a few days of heavy use, but in general there’s no real need to tune past the defaults of anything until your workload becomes higher, of which tuning is fairly well documented, if not scattered…
You know it would be awesome if someone made a generic tuning guide for phoenix/postgresql/mesh’d setups somewhere, say via a wiki post on this forum.
jola
Stressgrid posted a couple of articles that might be relevant.
I agree with @OvermindDL1 that it would be really nice to have a generic tuning guide for Phoenix/Postgres. It’s probably hard to write, since many of the options will be very “fragile” and have different effects when comparing eg a $10 droplet on DigitalOcean, a Heroku dyno or the biggest AWS instance. They will also depend on whether you care more about p99 or average. Some work better in a shared environment and some are better when the app owns the whole machine.
In general, I’d say you’ll find most optimizations in Postgres itself, either by tweaking options or by analyzing and optimizing your queries, but if you’ve already done that and you’re still struggling, Erlang VM tweaking is going to be very relevant.
The Techempower Framework benchmark phoenix implementation has some flags set, but it’s pretty old and I don’t know how accurate it is. Also check the config, which sets some things.
I made some notes for myself on flags that seem relevant, I might try to collect it into a post with some notes. But I’m absolutely not an expert.
keathley
Here’s my general performance tuning tips for running elixir at high scale:
With that out of the way here’s the stuff we generally do for our services under heavy load.
One final note. We’ve tweaked some scheduler flags on certain services that have very high traffic. This was more important a few OTP versions ago and we’ve recently removed those flags and saw no noticeable degradation. You wanna be really careful about tweaking the schedulers, process priorities, and other such things. Its pretty easy to add unintentional performance degradations. Generally speaking the BEAM makes intelligent choices for you. As always, measure your performance under load to see how it behaves.
Phillipp
Could you give more details about the problems that can occur and what one could do to solve them?
keathley
The default pool that hackney uses should be tuned to your own use case. The timeouts tend to be pretty high and the maximum connections are typically way too low for our purposes. You probably want to break out different services you communicate with into their own pools as well to avoid contention.
Like I mentioned before you should set goals for your service and work to meet those. Based on what you need you may not see these issues. In order to hit our goals during traffic spikes we have to really measure and tweak these values. But ymmv.