basho/riak_kv — pull request #498 by evanmcc (2013-03-04 19:18:59+00:00)
Title: Document the environment in the logs; advise on bad settings.

Warning users in the shell is distracting and potentially inaccurate. This commit captures a variety of system and erlang variables and puts them into the logs, along with warnings when they're too low or not right.

This is meant to address riak issue 278: https://github.com/basho/riak/issues/278

An example of the output on an untuned linux VM:

```
2013-03-04 11:10:55.342 [info] <0.290.0>@riak_kv_app:doc_env:285 Environment and OS variables:
2013-03-04 11:10:55.350 [info] <0.272.0>@riak_core:wait_for_application:444 Wait complete for application riak_pipe (0 seconds)
2013-03-04 11:10:55.440 [info] <0.290.0> Open file limit: 4096
2013-03-04 11:10:55.442 [info] <0.290.0> Core limit: 4096
2013-03-04 11:10:55.446 [info] <0.290.0> Open file limit: 32768
2013-03-04 11:10:55.446 [info] <0.290.0> Erlang ports limit: 4096
2013-03-04 11:10:55.447 [info] <0.290.0> ETS table count limit: 8192
2013-03-04 11:10:55.448 [info] <0.290.0> Thread pool size: 64
2013-03-04 11:10:55.448 [info] <0.290.0> Generations before full sweep: 0
2013-03-04 11:10:55.451 [info] <0.290.0> Schedulers: 1 for 1 cores
2013-03-04 11:10:55.451 [warning] <0.290.0> sysctl vm.swappiness is 60, should be no more than 0)
2013-03-04 11:10:55.452 [warning] <0.290.0> sysctl net.core.wmem_default is 229376, should be at least 8388608)
2013-03-04 11:10:55.452 [warning] <0.290.0> sysctl net.core.rmem_default is 229376, should be at least 8388608)
2013-03-04 11:10:55.455 [warning] <0.290.0> sysctl net.core.wmem_max is 131071, should be at least 8388608)
2013-03-04 11:10:55.455 [warning] <0.290.0> sysctl net.core.rmem_max is 131071, should be at least 8388608)
2013-03-04 11:10:55.456 [warning] <0.290.0> sysctl net.core.netdev_max_backlog is 1000, should be at least 10000)
2013-03-04 11:10:55.459 [warning] <0.290.0> sysctl net.core.somaxconn is 128, should be at least 4000)
2013-03-04 11:10:55.459 [warning] <0.290.0> sysctl net.ipv4.tcp_max_syn_backlog is 512, should be at least 40000)
2013-03-04 11:10:55.460 [warning] <0.290.0> sysctl net.ipv4.tcp_fin_timeout is 60, should be no more than 15)
2013-03-04 11:10:55.463 [warning] <0.290.0> sysctl net.ipv4.tcp_tw_reuse is 0, should be 1)
```