priestjim / gen_rpc

A scalable RPC library for Erlang-VM based languages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to achieve the 150K/s benchmark?

zhaohansprt opened this issue · comments

Hi i read you " erlang factory SF 2016 improving RPC calls ..." pdf
but i run " :timer.tc(fn-> :rpcBK.recursive(10000) end) "
over one tcp connection i only get the 10K/s mark;
over one sslconnection i get the 5K/s mark;
should i making 15 connetctions to Parallel ?

In order to achieve such performance, a lot of tuning has to take place, such as:

  • You have to tune net.ipv4.tcp_rmem, net.ipv4.tcp_wmem and a variety of other Linux networking sysctl options to make sure you're achieving the best throughput on your network interface
  • You have to increase the open file limit through both limits.conf and sysctl in order to be able to sustain more open TCP connections
  • You have to decrease the net.ipv4.tcp_max_tw_buckets to a limit lower than your ephemeral port range (net.ipv4.ip_local_port_range) in order to avoid hitting ephemeral port limits and file descriptor limits
  • You have to use the "keyed" feature of gen_rpc to use multiple TCP sockets (ideally, the number of cores you have in your system) and hence increase throughput

But that's not all. The point of gen_rpc is not only extracting performance but also scalability and resolving availability issues with the Erlang VM.

thanks but before tunning for the prarallel , i want to confirm what's the best marks that the solo type (tcp ||ssl) connection can achieve

It really depends on your system and the tuning parameters I mentioned above. It also depends on your payload. If you make RPC calls with a simple atom, gen_rpc is not of great use and it will reach more than 100k calls/sec if your system can handle it. If you make RPC calls with big enough binaries (i.e 500kb), this is where gen_rpc shines.

@priestjim can you elaborate on what you mean by the "keyed feature"?

@weixiyen the feature is described here: https://github.com/priestjim/gen_rpc#per-key-sharding. What it essentially does is create a separate client/TCP channel/server pipeline per key, thereby allowing you to parallelize loads/mailboxes