Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many Ruby threads is too many?

I'm coding a Merb application which uses a combination of SimpleDB and Tokyo Tyrant for storage. For both of these data stores I'm implementing IN (list) type-functionality by spinning up a thread for each value in list and then merging the result sets. Bearing in mind that this is a web application, is there a limit to the number of threads I should be creating? Ruby 1.8.7, so they're not kernel threads.

like image 278
Mark Rendle Avatar asked Mar 29 '26 18:03

Mark Rendle


1 Answers

Threads seems like a bad approach for what you're trying to do here, and if you can't use JRuby, I'd just drop the threads altogether. However, you could create a ruby file loading the database and use the benchmark library to do some benchmarking on which number is the fastest. You probably want to look at the memory used too.

like image 183
sarahhodne Avatar answered Apr 02 '26 07:04

sarahhodne