3 ms·
WEBrick was ruby’s standard library httpd back in the day... I remember it being mostly unusable in production for different reasons. But every now and then a n
by emmanueloga_ 8y ago
WEBrick was ruby’s standard library httpd back in the day... I remember it being mostly unusable in production for different reasons. But every now and then a new httpd would appear: mongrel, unicorn, passenger, puma, etc…
Sometimes the new implementation was not only “faster” under certain benchmarks, but deemed superior for “philosophical” reasons… I think it was the case for unicorn that load balanced over a pool of unix processes.
Eventually I left the ruby/rails world behind. Not the main reason, but I remember performance problems being very frustrating.
To quote [an old, 2011 blog post from] antirez: “it is not ok that by default [ruby] is so damn slow”. [1]
I was expecting to find ruby state of affairs to be the same these days, but looking at TechEmpower’s recent benchmarks [2] (benchmark reading caveats apply), seems like ruby implementations are reasonably speedy nowadays: benchmarks reflect results within the same order of magnitude to the fastest ones, except for the plaintext benchamark. I extracted some interesting metrics below.
Still, Ruby consistently comes after the 100th entry for all benchmarks.
A lot of people will say that the reasons to use ruby are the gains in productivity and the expresibility, DSL capabilities, etc. If that’s the evaluation metric, maybe Clojure could be a good alternative. Also, it performs very well! (thanks to the JVM, no doutbts). I believe immutable by default is a better way to build apps, and in Clojure, the whole language is built around this concept. Ruby is the other way around: even parts of the language that shouldn't are open for modification!
I wonder if jRuby would be a good contender for performance.... but...
* I’m not sure why there are no jRuby implementations on the techempower benchmarks.. evidently, not a very popular technology?
* I’m guessing that startup time for tools like IRB must the one of the turnoffs for ruby people.
1: http://oldblog.antirez.com/post/scalability-and-speed-of-web-apps.html http://oldblog.antirez.com/post/scalability-and-speed-of-web...
2: https://www.techempower.com/benchmarks/ https://www.techempower.com/benchmarks/
--
Numbers: max requests per second for an specific implementation in TechEmpower's benchmarks
JSON serialization.
1st Java: 1,197,864
20th Rust: 1,135,647 (1.05X slower)
21st Clojure, 1,126,256 (1.06X slower)
141st Ruby 173,905 (6.9X slower)
Single query:
1st Java: 656,262
20th Go: 309,728 (2.12X slower)
54th Clojure: 209,466 (3.13X slower)
120th Ruby: 96,174 (6.82X slower)
Multiple Queries
1st Java: 43,245
20th Kotlin: 22,643 (1.91X slower)
21st Clojure: 22,536 (1.92X slower)
100th: Ruby: 11,216 (3.86X slower)
Fortunes
1st C: 424,712
20th Go: 193,079 (2.2X slower)
78th Clojure: 98,056 (4.33X slower)
131st Ruby: 51,043 (8.32X slower)
Data Updates
1st Java: 18,152
20th Dart: 6,785 (2.68X slower)
65th Clojure: 3,707 (4.9X slower)
95th Ruby: 2,839 (6.39X slower)
Plaintext
1st: Rust: 7,040,642
18th Clojure: 4,178,241(1.69X slower)
20th Java: 3,858,510 (1.82X slower)
134th Ruby: 239,652 (29.38X slower)
- ioquatix 8y agoThe tech empower benchmarks for Ruby are a bit foobar, I tried to fix it but ran out of time. I wouldn't trust it completely. I'm not saying it's wrong, I just don't think it's the complete picture.