Performance - kjellhex/diode GitHub Wiki
Throughput test
How many transactions a second can a Diode serve handle? Well let's see. Using the server from the 07-Static example we can make a request to fetch currency details from the database at http://127.0.0.1:3999/curr?cid=1
In one terminal, start the server:
$ ruby static-server.rb
In a separate terminal, start the load test using wrk:
$ wrk --connections 10 --threads 10 --duration 30s --latency --timeout 5s http://127.0.0.1:3999/curr?cid=1
The performance appears to be high and constant thanks to Async and Fibers on which the server is built. The memory usage was also constant at around 240MB although the diode server was using up to 70% CPU on my laptop.
Running 30s test @ http://127.0.0.1:3999/curr?cid=1
10 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 7.16ms 0.94ms 33.35ms 95.26%
Req/Sec 138.06 7.77 260.00 88.65%
Latency Distribution
50% 7.02ms
75% 7.34ms
90% 7.66ms
99% 11.47ms
41407 requests in 30.08s, 9.20MB read
Socket errors: connect 0, read 41397, write 0, timeout 0
Requests/sec: 1376.54
Transfer/sec: 313.22KB
Of course, this test was running locally so we can expect faster response times without network latency, but more than a thousand transactions a second is adequate performance for a little ruby gem.