RabbitMQ, Erlang: How to “make sure the erlang cookies are the same”

For what it’s worth, in 2018, the docs are WRONG. In windows 10, the default location of the cookie file appears to be: C:\Windows\System32\config\systemprofile and NOT C:\Windows as the docs say. The best thing to do is to look at the log file, which is typically located in your user %AppData%\Roaming\RabbitMQ\log directory. The log file … Read more

How to write a simple webserver in Erlang?

Taking “produce” literally, here is a pretty small one. It doesn’t even read the request (but does fork on every request, so it’s not as minimal possible). -module(hello). -export([start/1]). start(Port) -> spawn(fun () -> {ok, Sock} = gen_tcp:listen(Port, [{active, false}]), loop(Sock) end). loop(Sock) -> {ok, Conn} = gen_tcp:accept(Sock), Handler = spawn(fun () -> handle(Conn) end), … Read more

How to perform actions periodically with Erlang’s gen_server?

You have two easy alternatives, use timer:send_interval/2 or erlang:send_after/3. send_interval is easier to setup, while send_after (when used in the Erlang module) is more reliable since it is a built-in function, see the Efficiency Guide. Using send_after also ensures that the gen_server process is not overloaded. If you were using the send_interval function you would … Read more

When does Erlang’s parallelism overcome its weaknesses in numeric computing?

It’s a mistake to think of parallelism as only about raw number crunching power. Erlang is closer to the way a cluster computer works than, say, a GPU or classic supercomputer. In modern GPUs and old-style supercomputers, performance is all about vectorized arithmetic, special-purpose calculation hardware, and low-latency communication between processing units. Because communication latency … Read more

How did WhatsApp achieve 2 million connections per server?

If you have enough RAM it’s not too hard to handle 1M or more connections on linux. These guys handled 10 million connections with a java application on a single box using regular CentOS kernel with a few sysctl tweaks: sysctl -w fs.file-max=12000500 sysctl -w fs.nr_open=20000500 ulimit -n 20000000 sysctl -w net.ipv4.tcp_mem=’10000000 10000000 10000000′ sysctl … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)