Memory leak/constant high CPU usage when running Phoenix in IIS on Windows

前端 未结 1 960
日久生厌
日久生厌 2021-01-23 06:09

I am trying to prototype a small web application to see if I can use Phoenix and Elixir to build some intranet web applications for use by my co-workers at my company. We\'ve be

相关标签:
1条回答
  • 2021-01-23 06:54

    I figured out the solution to this. This is where my newbie status to Elixir and Erlang came into play. When you run an Elixir/Erlang application, the Erlang user server gets started to handle standard I/O for the application. On the second image in my question update, you can see that port <10014.664> controls "0/1". My understanding now is that basically means 0 == standard input and 1 == standard output.

    The issue when running with HttpPlatformHandler is that the Phoenix application is running without a shell and there would never be anything coming in via standard input. So when you run using the default settings, standard input basically floods the user server with a bunch of empty data messages.

    The solution is to tell the Erlang VM and the user server to ignore standard input. In my run.bat script, I was running mix phoenix.server, but based off the gist that I used to name the node so that I could attach Observer to it, I changed my run.bat script to this:

    elixir --name phoenix@127.0.0.1 --cookie PUT_COOKIE_HERE --erl "-noinput" -S mix phoenix.server
    

    The -noinput flag appears to tell the Erlang VM to never read from standard input. With -noinput passed to the command line, the memory issue went away and CPU usage is typically below 0.2% while idle. CPU and memory appear to be the same as if the Phoenix application were running from a console outside of IIS.

    0 讨论(0)
提交回复
热议问题