This post has migrated to:
https://superjamie.github.io/2014/09/21/the-8-byte-two-step-redux
........................................ | |
......... .......... | |
....... ........ | |
..... ...... | |
.... ..... | |
... ....... .... | |
.. ....... .. ... | |
. .......... .. .. | |
. ....... .... .. . | |
. ..... ..... . |
This post has migrated to:
https://superjamie.github.io/2014/09/21/the-8-byte-two-step-redux
Purpose: To prevent scheduler collapse by disabling scheduler sleep periods. | |
This patch is relative to R16B01 pre-release but may be applied (with "fuzz") | |
on R15B01 and R15B03-1 without difficulty. | |
The new flag, "+zdss", must be used with "+scl false" flag to be successful. | |
See the erl.xml document for a description. Example use: | |
erl +scl false +zdss 500:500 | |
Note that this flag used to be called "+zdnfgtse" |
-module(bench). | |
-export([run_suite/3, run/1]). | |
run_suite(Name, Passes, Messages) -> | |
Results = run_suite1(Passes, Messages, []), | |
Avg = lists:sum(Results) / Passes, | |
StdDev = math:sqrt(lists:sum([math:pow(X - Avg, 2) || X <- Results]) / Passes), | |
Summary = [{avg, Avg}, {stddev, StdDev}, {min, lists:min(Results)}, | |
{max, lists:max(Results)}], |
When you build Erlang/OTP on OS X, it unfortunately defaults to handling a maximum of 1024 file descriptors. You can get around this limitation with the right combination of configuration options and manual changes to a generated config file.
First, go into your unpacked Erlang/OTP source directory and run the following command, replacing the value 10000 with whatever value you want for max file descriptors:
perl -i -pe 's/(define\s+FD_SETSIZE\s+)\d+/\1 10000/' erts/config.h.in
Next, when you run configure
in your Erlang/OTP source directory, be sure to include the right CFLAGS
setting, as shown below:
CFLAGS='-DREDEFINE_FD_SETSIZE -DFD_SETSIZE=15000 -D_DARWIN_UNLIMITED_SELECT' ./configure --enable-kernel-poll <other options>
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n |
projdel node | |
projadd -c "node settings" -U admin -G staff -K "process.max-file-descriptor=(basic,65535,deny)" node | |
svccfg -s node-nodestack-service setprop 'method_context/project=node' | |
svcadm disable node-nodestack-service | |
svcadm enable node-nodestack-service | |
pgrep node |
%%% Run with 'escript app_deps.erl' | |
%%% Change the path in filelib:wildcard/1 as required to capture all | |
%%% your dependencies. | |
%%% | |
%%% Rectangular nodes will represent library apps (no processes involved) | |
%%% and the circular nodes will represent regular apps. An arrow going from | |
%%% 'A -> B' means 'A depends on B'. | |
%%% | |
%%% This script depends on graphviz being present on the system. | |
-module(app_deps). |
I've been playing more with this Erlang factoring technique. As an exercise, I've been trying to force myself to adopt the method, by writing functions that are 3 or less lines long (function clauses actually, so multiple pattern-matched claues are OK).
One place I noticed was causing myself