I have been using erlang
and chicagoboss
since 5-6 months. I have observed that when I don't run ./rebar compile
for long time then server takes too much load. requires at least 20 -25 seconds
to reload any of the web page on localhost
.
My questions are:
./rebar compile
?memcache
and Cowboy
. Does it anything to do with
memcache?I assume, you are using ./init-dev.sh
. This scripts provides automatic reloading, which is really great during development, but can be slow. It checks all the .beam
files and if corresponding .erl
file was modified later, it means, that it has to be recompiled. Recompilation takes place on every request. It doesn't actually create new .beam
files in the place of the previous ones. It compiles them "on the fly" and loads, so even, if you did not change anything after first modification, the file still has to be recompiled.
If you did some modifications to bigger number of files, this operation might have big impact on your system. It probably doesn't have anything to do with memcache or Cowboy. Just compile the files regularly.
A few tricks:
./rebar compile
can be slow, because it goes through all the dependencies, try ./rebar compile skip_deps=true
. This is much faster!./rebar compile apps=your_app_name,boss
. You have to compile all the apps, that use that dependency, so if you modified boss_db
, you have to invoke: ./rebar compile apps=your_app_name,boss,boss_db
../init.sh reload
, but it doesn't work with memcache! The memcache driver is not proper OTP application and after hot code reload, it does not get updated. After second hot code reload processes using old code are purged and the connection to memcache is lost. So if you are using memcache, don't use hot code reload.