From: David Vallner Date: 2006-01-12T20:23:52+09:00 Subject: Re: ruby Thread in CGI application? That said, it might also be questionable just how useful it is to create request processor threads even in FastCGI / SCGI, because that's precisely the purpose of those. You're very likely better off tweaking the settings of those to get what you might want done. Now, a longer rant for the sake of completion: Using worker threads is more viable, but that is only useful in certain scenarios, for example: 1. In interactive long-running programs, where you want to maintain a responsive user interface while doing background work. This is _very_ rarely the case with a web application, because you usually need to process each request in finite (and rather short) time. 2. On a multiple CPU system, where algorithms used in processing the request might benefit from parallelism running multiple processors. Though then again, you probably wouldn't do CPU-intensive operations as these algorithms tend to be in Ruby anyway. As more realistic examples, asynchronous database / remote calls come to mind if you want to implement your own timeout policy to those to handle badly written third party libraries graciously to prevent your application from hanging up. Unless you have due cause to do so, do avoid multithreaded programming or keep it very simple, there's just way too many ways to shoot yourself in the foot. David Vallner On Thu, 12 Jan 2006 11:51:39 +0100, Zed Shaw wrote: > Hi konstantin, > > As the author of SCGI (http://www.zedshaw.com/projects/scgi_rails/) I > can tell you that this is possible, but you have to be careful not to > step on anyone's toes. As David Vallner mentioned previously it's > pretty pointless in a plain CGI. In FastCGI, SCGI, or mod_ruby it's > viable but tricky. > > > On Jan 11, 2006, at 11:03 PM, ako... wrote: > >> Hello, >> >> i heard that ruby's Thread is not a native system thread but is >> implemented in the interpreter itself. is that true? does this mean >> that is is lighter than native threads? does anyone know if >> Thread.start on every web request in my CGI application would severely >> reduce my web server's scalability? >> >> thanks >> konstantin >> >> >