Elixir, Phoenix and Windows: No faster responses than 1000 microseconds?

If you read around phoenix developers you often hear stuff like “Awesome, requests served in under xxx microseconds!”. Yet if I try the Phoenix framework, I only have this results:

With special emphasis on [info] Sent 200 in 1000┬Ás . Here we have two problems:

  1. It looks like the command line doesn’t know the μ sign and replaces it with ┬Á.
  2. Did it really take 1000 microseconds to serve the request? I’m not sure, but I NEVER have a request faster than that. Sometimes I have a slower request (163 milliseconds on startup for example) but never faster than 1000 microseconds.

Locating the error source

Lets find the culprit: I use the Powershell to start the Phoenix app. Can Powershell show the μ sign?

Powershell using the μ sign
It can!
Powershell showing off and uses the the μ sign as variable name
Variables with the μ sign are possible as well

As a matter of fact, you can use the μ sign as variable, if you want to.

So Powershell is good. What’s the problem then? Looking into the mix.ps1 we can see that it executes the mix.bat, which executes the elixir.bat which either executes erl.exe or werl.exe. So lets have a quick look if the cmd (*.bat files are executed by cmd) is capable of the microsecond sign.

Also the command line is can show the sign
Also the command line can show the sign

So the problem isn’t the command line either. I printed the final executed call to erl.exe and executed this command without the cmd as middle man. The problem remained. So I assume it is a problem with either the erl.exe (if I use the –werl command line switch, werl.exe gets executed, the phoenix app gets started but no info is shown in werl.exe), Elixir, Phoenix or some of the plumbing in between.

Lets test Elixir. I created a new Elixir app mix new micro_second_test  and wrote a single function in it:

When starting the application with iex.bat -S mix  and executing the function we get this result:

So we can rule out Phoenix as Elixir already has that problem. What about erl.exe?

Erlang can show the μ sign. So the culprit is either Elixir or the plumbing. I will open an GitHub Issue for this problem. For the second problem (never showing less than 1000μs) I am not sure how to check. I think it could be in the cowboy web server, or in the Plug.Conn. But I have no clue…

Phoenix and Windows: js not executed

I’m currently on my way to learn a little bit of Elixir. I like the idea of functional programming language made easy. For starters I’m doing all the tutorials I can find. My most recent tutorial was the Channels Tutorial of the Phoenix Framework.

As I did the tutorial, I encountered a problem: My socket.js file was concatenated in the app.js file via Brunch.io but the promised message “Joined successfully” did not show up in the console.

After some fiddling with JavaScript I gave up and searched for the error. I found a similar error description on Stack “js in html is not executing in Phoenix framework sample app“. As it turns out the tutorial/the getting started is not really covering the Windows side… To fix this problem edit your /brunch-config.js file.

At the bottom is a modules key. Change the value from

to

Voilà, brunch.io is now auto requiring the missing app.js even under Windows