antonputra / tutorials

DevOps Tutorials
https://youtube.com/antonputra
MIT License
3.19k stars 2.5k forks source link

220: Improve Rails perf 5-10x #335

Closed simpl1g closed 2 weeks ago

simpl1g commented 2 weeks ago

Yes,

Final results for create endpoint, it is not 10x, only 3x RPS and 8x better latency

before:
wrk -c 100 -t 2 -d 10 --latency -s ruby-app/wrk.lua http://localhost:8080/api/devices
Running 10s test @ http://localhost:8080/api/devices
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   163.18ms  205.32ms   1.09s    80.02%
    Req/Sec     0.90k   210.50     1.21k    77.00%
  Latency Distribution
     50%    7.90ms
     75%  314.85ms
     90%  474.04ms
     99%  809.52ms
  17954 requests in 10.01s, 11.95MB read
Requests/sec:   1793.34
Transfer/sec:      1.19MB

after:
wrk -c 100 -t 2 -d 10 --latency -s wrk.lua http://localhost:8080/api/devices
Running 10s test @ http://localhost:8080/api/devices
  2 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    20.20ms   11.63ms 137.45ms   91.93%
    Req/Sec     2.66k   647.28     3.45k    86.00%
  Latency Distribution
     50%   17.30ms
     75%   20.61ms
     90%   26.89ms
     99%   76.76ms
  52996 requests in 10.04s, 16.88MB read
Requests/sec:   5277.25
Transfer/sec:      1.68MB
antonputra commented 2 weeks ago

Thanks again, @simpl1g! I'll compare it with Django in a week or so; Node.js doesn't make sense.