开发者

Should I use ruby threads or just not use ruby altogether for threading?

I have a choice to develop an app which will rely heavily on threading (up to to 200). I know I can use other Ruby interpreters for threading such as JRuby. But there are 2 things:

1) Jruby doesn't support 1.9 yet, so that is a no. Is there any other non-green thr开发者_开发技巧ead interpreter that supports at least 1.9 as that is a prerequisite for me if I use Ruby.

2) Even using an interpreter such as Jruby, would I really get decent thread perfomance that I can get in Java? Perhaps I should just use Java for this application.

Note: this isn't an attempt at subjective discussion. It is for advice regarding thread performance only. Also, this isn't Java vs Ruby or anything of that nature. I am newer to Ruby and hoping to clear this up for my own benefit, thanks.


You should really benchmark it.

Are your threads going to be doing a lot of simultaneous computation? Then you'd probably need native threads. But if you are going to be waiting for IO all the time, then maybe Ruby's green threads are fine.

Even with this advice, you should cook up a small test program and see if the straightforward way (just using Ruby 1.9) will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜