From: Bill Kelly Date: 2006-02-09T06:47:03+09:00 Subject: Re: Sandboxing eval'd code From: "konsu" > > "Bill Kelly" wrote >> >> time ruby -e '100000.times { Thread.new { }.join }' >> >> real 0m1.130s >> user 0m1.124s >> sys 0m0.008s > > could you elaborate a bit? are these numbers good or bad? what about memory > consumption? may be i am missing something important about ruby threads, but > my impression was that spawning a thread on every request is bad. Hi, well, being able to create, execute, and join 100,000 threads in about one second seemed to me to indicate that Ruby has pretty low overhead for creating threads. (2.8GHz Pentium Xeon) How many requests per second does your server need to handle? I don't know if there's an absolute answer to whether creating a thread per request is good or bad. It just looks like it doesn't take very much time. (I don't think it takes much memory either.) Unless your server is handling thousands of requests per second, it looks like the overhead for creating a thread is fairly insignificant. (Remember, Ruby currently has "green" threads, so these are not actual Operating System threads being created.) Regards, Bill