merlin
Performance - Best practices?
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
Most Liked
outlog
-c12000 isn’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
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
also since it’s go vs elixir(otp/erlang) this one is great at understanding latency and GC handling etc.
video:
Popular in Questions
Other popular topics
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
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










