merlin
Hi all,
I’ve run the Techempower fortune benchmark locally, Elixir/Phoenix and Golang/fasthttp.
Removed all unnecessary code in both Elixir and Go.
I’m trying to get the best performance out of the Elixir/Phoenix version.
Tuning for Elixir/Phoenix:
-
disabled all unnecessary plugs in router.ex:
pipeline :browser do
plug :accepts, [“html”]
end -
set DB adapter pool size to 40
-
used the same HTML template as Go
-
set logging to error
-
compiled protocols
-
start server: MIX_ENV=prod PORT=4000 elixir -S mix phx.server
No tuning for Go.
I use wrk to perform the load tests:
wrk -t6 -c12000 -d60s -T10s http://.../fortune
Client is physical and server is a domU/2vcpu/4GB. OS: FreeBSD. 10 runs for each load test.
For Elixir/Phoenix:
- Average latency 408ms, max 8s
- Req/s 2400
For Golang:
- Average latency 123ms, max 1s
- Req/s 8600
I did my first Go tests with net/http and peaked at 4000 req/s so I replaced it with fasthttp and got 8500+ req/s
Are there faster alternatives to Cowboy ?
How do you fine tune production environment ? What OS is best suited for the Erlang VM ? What FS ? specific OS tunables ?
Thanks
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Uh, you have something MAJOR wrong there. Can you upload this to github and give us commands to
git clone ...it then a single (set of?) commands to run our own tests? Even the golang average latency of 123ms seems crazy high!outlog
-c12000isn’t that 12k keepalive connections, seems a bit much..techempower is not real world - quite the opposite actually.. so do your own benchmark similar to what your requirements are..
wrk is not a great benchmark tool.. use something like https://gatling.io
also allow me to suggest this video
outlog
also since it’s go vs elixir(otp/erlang) this one is great at understanding latency and GC handling etc.
video:
idi527
There is elli TechEmpower Benchmarks Round 14
Might be replaced with a map, since
forcomprehension in elixir does a reduce where a map would suffice, IRRC. Though it’ll hardly change anything.I’m not sure if
.eextemplates compile to iolists. If not, then that’d also be a possible improvement in performance.OvermindDL1
They do.
merlin
Thanks for Elli, I’ll give it a try
To reproduce this test: just co the techempower code, elixir/phoenix and golang/fasthttp versions.
For the phoenix version you may also bootstrap an empty app and add a fortune MVC.
Then add some basic tuning as I’ve done. The average latency is high probably because of the number of incoming connections. That’s the point. Same conditions for the Go version. I’d like to optimize at least:
The techempower/fortune benchmark gives us a good basis to apply the most basic tuning. That’s what I’m interested in now, and that’s why I use wrk and not JMeter. Later, if we choose Elixir, I’ll perform more advanced load tests.
Except plugs, DB pool size, logging are there other config. parameters I could change to improve performance ?Beam parameters I could tune ? JVM-style ?
idi527
Then at what point and why do they get turned into binaries? https://github.com/idi-ot/eex_test
I would’ve expected something like this
Some tests
idi527
You might want to read this series of blog posts (this one is the last one, I think) http://dbeck.github.io/Wrapping-up-my-Elixir-TCP-experiments/. There is a part about beam parameters near the end and in the comment section. And docs (Emulator Flags section) erl — OTP 29.0.2 (erts 17.0.2)
merlin
Thanks
This looks really interesting esp. the FreeBSD part
Edit: apparently Mr Beck switched to Rust a year ago. Looking for a C++ alternative ?
It’s getting harder and harder to choose the right language: Java, Scala, PHP, Go, Erlang, Elixir, Rust, Ruby, Crystal, Pony, Nim … Oh did I forget JS ?
dom
max_keepalive might matter