mcollina / reaching-ludicrous-speed

My Node.js Interactive 2015 presentation
http://mcollina.github.io/reaching-ludicrous-speed/
MIT License
11 stars 0 forks source link

How can I reproduce the benchmark locally ? #1

Open Raynos opened 8 years ago

Raynos commented 8 years ago

I saw your demo; looked really cool.

I'm curious if I can reproduce it locally; I've been working on an RPC library and can only push 100k QPS;

I wanted to learn from your MQTT implementation to see how you got it to push 200k QPS and would love to run it locally and learn all the tricks.

mcollina commented 8 years ago

So, here is the client (https://github.com/mqttjs/MQTT.js/blob/v2-dev/benchmarks/bombing.js) and here is the server (https://github.com/mcollina/aedes/blob/master/benchmarks/server.js). You can even run the "subscriber" one as well (https://github.com/mqttjs/MQTT.js/blob/v2-dev/benchmarks/throughputCounter.js). To get the top results you might need to use node v5.7.1+. It includes my fix.

Most of the magic is done in https://github.com/mqttjs/MQTT.js/blob/v2-dev/benchmarks/bombing.js both on the generate (see how cork/uncork is used, plus all the memoizing) and parse side, plus all the broker code (https://github.com/mcollina/aedes/blob/master/lib/client.js#L39-L64).

I still have found difficult to reproduce the same level of performance in a general purpose protocol transport. I've tried with tentacoli, but I didn't get far (10k ops/s).