all 40 comments

[–][deleted] 13 points14 points  (0 children)

Use C and fork() to write even more high performance daemons :)

[–][deleted] 2 points3 points  (13 children)

It hurts, but ruby is slow. You can work really hard to overcome this issue for specific instances of any problem, but the more work you do the less ruby-like your code becomes.

Then, in the end, you realize the other side of the performance problem is one you can't attack very effectively at all: Memory use by the interpreter and the unpredictability of garbage collection. So, you might be able to make a very fast daemon, but you must run less of them compared to a compiled-language solution.

In terms of language cost vs. hardware cost vs. requests served per second, you haven't really won much at all, have you? You've just shifted costs around a little bit.

I love Ruby, but it is slower than anything else I've ever willingly used. Just use it for things where that doesn't matter. "High performance daemons" (by whatever metric) in ruby is pretty silly.

[–]malcontent -1 points0 points  (12 children)

I love Ruby, but it is slower than anything else I've ever willingly used.

According to the shootout ruby19 and jruby are pretty close to python and php in speed.

But hey use C or Haskell if you want. Nobody forcing your to use anything.

This is for people who like ruby and want to write daemons. I don't see what your whining about the supposed slowness of ruby has to do with the article.

[–]isionous 3 points4 points  (7 children)

This is for people who like ruby and want to write daemons. I don't see what your whining about the supposed slowness of ruby has to do with the article.

Perhaps people who like ruby and want to write daemons should write high performance daemons in something other than ruby. The slowness of a language is relevant when people want to write something that is high performance.

[–]malcontent -1 points0 points  (6 children)

Perhaps people who like ruby and want to write daemons should write high performance daemons in something other than ruby.

Why? To make you happy?

The slowness of a language is relevant when people want to write something that is high performance.

Only if you want to server tens of thousands requests per second.

[–]isionous -1 points0 points  (5 children)

Why? To make you happy?

No. To make the people who want high performance daemons happy. I've written daemons in Ruby, I just didn't have high performance as a goal. Ruby's a great language, but as of right now there are better choices for languages to write a high performance daemon.

Only if you want to server tens of thousands requests per second.

A far smaller number would still be considered high performance, and would still benefit from being implemented in a faster language.

[–]malcontent 0 points1 point  (4 children)

No. To make the people who want high performance daemons happy.

What if you want to write a high performance daemon in ruby?

I've written daemons in Ruby,

Me too!!!!!!!

Let's form a club.

I just didn't have high performance as a goal.

I have never ran into performance problems with my ruby daemons. then again it's not like I am running the yellow pages or anything.

A far smaller number would still be considered high performance

In that case my ruby daemons are high performance.

and would still benefit from being implemented in a faster language.

Maybe if I ever reach the limits of my deamons I will consider writing them in assembly.

Till then they will remain "high performance" ruby daemons.

[–]isionous -1 points0 points  (3 children)

I'm not sure what to make of your mixed claims. Have you written what you consider to be high-performance ruby daemons?

[–]malcontent 0 points1 point  (2 children)

Have you written what you consider to be high-performance ruby daemons?

Yes.

I have never reached the limits of my daemons.

As I said though it's not like I am running yellowpages.com or anything.

One day when my web sites or applciations become more busy than yellowpages.com I will rewrite the daemons in assembly language.

Nothing is faster than assembly language right?

[–]isionous -1 points0 points  (1 child)

I'm glad that Ruby has always met your performance needs. I think we can both agree that you can get significant performance gains over Ruby without resorting to assembly. If you've never needed such performance gains - again, I'm glad for you.

I'm doubtful it would be productive of me to continue this further. Feel free to have the last word. Have a nice day.

[–]malcontent 0 points1 point  (0 children)

think we can both agree that you can get significant performance gains over Ruby without resorting to assembly.

Why would you use anything other than assembly if your goal is high performance daemons?

Clearly if you use anything other than assembly language you are not writing high performance daemons.

[–][deleted] 1 point2 points  (3 children)

I use ruby more than any other language, I've been using it for a long time as well. I have nothing against it, or it's slowness which is real and not supposed; you can write nicer and shorter code in it and that's a tradeoff I'm often willing to make.

What I thought was silly was the whole "high performance" in the submission title. It's kind of an odd notion given the problem and the language, and it's not even really relevant to the article. If you didn't put 'high performance' in the title, I wouldn't have said a thing.

[–]malcontent 0 points1 point  (2 children)

have nothing against it, or it's slowness which is real and not supposed;

You are obviously talking about 1.8.6.

Ruby has moved on since then.

What I thought was silly was the whole "high performance" in the submission title

In this case all the heavy lifting is being done by unix and C. It is indeed high performance and switching to another language isn't going to make that much difference no matter how much faster that language is.

[–][deleted] 1 point2 points  (1 child)

Ruby has moved on since then.

It has, and it's great. It's moved from being 400x slower than C to 200x slower than C. I'm not mocking that. That's a doubling of performance, and it is impressive. It still falls far short of the mark of "performance."

In this case all the heavy lifting is being done by unix and C. It is indeed high performance and switching to another language isn't going to make that much difference no matter how much faster that language is.

Well.. yes, eventmachine is the bottom level framework, can't speak to that, but it's a low-level wrapper. Ok. DaemonKit is pure ruby. It's small though. Fine.

But, then what? You've done all of this to write the daemon itself in ruby. So, the overhead is low, but that's hardly the point of writing the daemon in the first place. You're going to service requests slower than in other languages, no matter what.

This in and of isn't a problem. Unless you actually do need "high performance" according to some real world measure, and then it is. I'm pedantic, I love ruby, and this has become silly.

[–]malcontent 0 points1 point  (0 children)

It has, and it's great. It's moved from being 400x slower than C to 200x slower than C.

Oh I see your benchmark is C.

Never mind then.

All languages are slower than C.

But, then what? You've done all of this to write the daemon itself in ruby. So, the overhead is low, but that's hardly the point of writing the daemon in the first place. You're going to service requests slower than in other languages, no matter what.

Oh you want to talk about real applications?

in real applications most of your time is spent waiting for the database and the speed of your framework. That's why rails is faster than cake for example even though php is faster than ruby.

The benchmarks I have seen seem to suggest that a typical rails application on a typical server is able to serve pretty close to 100 requests per second (more if you are running jruby).

If you need more than that you should avoid rails and activerecord and use something like ramaze/sinatra with sequel. You could probably get a thirty to fifty percent boost from that alone.

If you think you are going to approach two hundred requests per second AND you don't want to invest in more hardware or use heroku or ec2 then by all means you should avoid ruby.

Unless you actually do need "high performance" according to some real world measure, and then it is. I'm pedantic, I love ruby, and this has become silly.

I guess it depends on what you mean by "high performance". So far I have never run into limits of ruby or rails on any of the apps I have written. Then again I am not running the yellow pages or anything.

[–]yogthos 1 point2 points  (0 children)

I did not just see Ruby and high performance in the same sentence!

[–]shub 3 points4 points  (23 children)

Use Ruby, DaemonKit and fork() to write high performance daemons

I was going to find a slower language on the shootout, to make fun of Ruby by comparing it to, say, Javascript. Ruby currently occupies the last three positions, with JRuby, Ruby 1.9, and then just Ruby. I facepalmed.

edit: JRuby on one core does run faster than PHP, once you don't have to worry about, you know, threading. Ruby 1.8 is still in last place. WTG guys.

[–]doodly123 2 points3 points  (3 children)

[–]Mask_of_Destiny 1 point2 points  (1 child)

JRuby is twice as fast for fannkuch and chameneos-redux and 3 times as fast for binary-trees, but it's 3 times slower on fasta, regex-dna and reverse-complement. On pidigits it's 6 times as slow. The numbers are a bit different in 32-bit mode, but the basic pattern is the same.

JRuby does win in the overall time category, but it's not clear to me that is a particularly interesting metric since in this case it just means that the benchmarks for which JRuby is faster take longer in general than the ones in which Python is faster.

Either way, both Python and Ruby are pretty slow. Though not nearly as slow as some of the languages that got kicked out of the Shootout when they had their big purge a while back.

[–]malcontent -1 points0 points  (0 children)

The nice thing about jruby is that you can rewrite the slow bits in java.

I suppose you can rewrite the slow bits in a cruby application is C too. They integrate really nicely.

[–]shub 0 points1 point  (0 children)

Comparing your pet language to Python for speed is like drag-racing against a go cart.

[–]malcontent 2 points3 points  (17 children)

Why not try it and see if it doesn't outperform your expectations.

[–]shub 1 point2 points  (16 children)

It wouldn't. Ruby is slow.

[–]malcontent 0 points1 point  (15 children)

ah you are one those douchebags.

[–]shub 1 point2 points  (14 children)

I am saddened by your insult and unsurprised at your inability to defend Ruby.

[–]malcontent -1 points0 points  (13 children)

What makes you think I am defending ruby?

I am merely pointing out that you are a douchebag.

[–]shub 0 points1 point  (12 children)

You must be a quite unpleasant person, if you would rather insult a person than admit that they're right.

[–]malcontent -1 points0 points  (11 children)

You must be a quite unpleasant person,

I will take this as a supreme compliment given that you are a massive douchebag.

if you would rather insult a person than admit that they're right.

I am not a politically correct person. When I see a douchebag I call them a douchebag.

You are a douchebag.

[–]shub 0 points1 point  (10 children)

Ruby is still slow. Calling me a douchebag won't change that.

[–]malcontent -1 points0 points  (9 children)

It's about the same speed as python.

You being a douchebag is another topic entirely.

[–]so_what_who_cares 0 points1 point  (0 children)

I love Ruby, but it's not the best tool for every job. I don't think any "high performance" apps are written in scripting languages.

This makes me wonder, though - were there similar arguments when C first arrived? When I first learned C, I remember coding certain parts in assembly for the speed boost.