derek-zhou

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

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

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

josevalim

Creator of Elixir

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.

Where Next?

Popular in Questions Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New

We're in Beta

About us Mission Statement