derek-zhou
Slowness in dev only, seems to be related to Phoenix CodeReloader and Elixir 1.19
Today I upgraded to Elixir 1.19.5 (latest stable) and one thing lead to another, I eventually upgraded most of the dependencies of my app. I got everything working in a couple of hours, but then I noticed a slowness in handling HTTP requests. My controller finishes in a few ms but the browser waits for a couple hundred ms before getting the first byte, and this is on LAN. Further troubleshooting isolate this slowness to:
plug Phoenix.CodeReloader
Does anyone know anything that may have caused this slowness in Phoenix CodeReloader? I noticed that compiling in general for Elixir 1.19 is slower than say, 1,15. Are they related? As a developer, I am willing to spend couple more minutes to compile my app (the type checking and extra warnings are useful) but I am hesitate to spend 200ms for every request served in the dev environment though.
Marked As Solved
derek-zhou
I filed an issue on elixir’s github page with all my findings:
https://github.com/elixir-lang/elixir/issues/15228
Let’s continue the discussion there.
Also Liked
derek-zhou
Turns out all previous hypothesis are wrong. It is related to the locking. If I set
MIX_OS_CONCURRENCY_LOCK=0
then everything went back to fast.
PS: It is the fsync. If I just comment out :file.sync call from Mix.Sync.Lock then everything is fast.
BTW, My dev machine is a Linux container in a Linux desktop PC with a rotary disk.
josevalim
You can try running the server with MIX_DEBUG=1 to get an estimate of where the slowdown is or try one of the Elixir v1.20 release candidates to see if it has been addressed. Compilation has generally gotten faster since v1.15, so it may be something in particular at hand.
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










