From: Austin Ziegler Date: 2005-03-31T13:34:31+09:00 Subject: Re: Poor efficency of Ruby... On Mar 30, 2005 9:24 PM, JZ wrote: > Dnia Thu, 31 Mar 2005 09:54:23 +0900, Joe Van Dyk napisal(a): >>> As I can see, Rails is *not* an application server, as someone >>> mentioned. It is a couple of Ruby scripts and modules working >>> together. Am I right? >> That's correct. > Now I understand! It may be a reason why any Python (or Java) > application server will be faster than Ruby ever be. Both use > precompiled code and do not need to parse source code for every > request. Even PHP with its Zend eaccelerator will be faster, > because it doesn't need to parse over and over again the same > source files. This is incorrect. Python scripts that aren't run as .pyc files will have to be recompiled every time. PHP/Zend has to be configured correctly. Using Ruby as a CGI does require that the files be compiled on every read, but this is the same of any .py or .pl or non-Zend .php file. Rails works best as if it were an application server using FastCGI as a backend. With mod_proxy, it is certainly possible to use the Webrick server as an application server via Apache. Ruby executes plenty fast, and the script compile step is fast, too. Consider -- the *whole* of the very high level framework *and application* represented by Rails compiles in under a second. This would be like compiling Struts and all sorts of other helper items from scratch on every call. The performance you were epxeriencing has nothing to do with Ruby and everything to do with the depth of the framework that Rails provides. > I think Ruby needs similar solution. If not bytecode (like Java > and Python use), so maybe accelerator like Zend for PHP? Ruby and > Rails works like PHP without accelerator. It has to parse all his > libraries over and over again for every request. So I can conclude > that for bigger code all might be slowing down... So I understand > why using pure CGI for Rails is useless. FCGI can help, mod_ruby > can help more (I guess), but nothing more. Wrong. Pure CGI for *Rails* is useless, but not for many other things. FastCGI is better than mod_ruby, as far as I can tell. Additionally, it is my understanding that lighttpd and FastCGI are even better than Apache, which is a bit of a resource hog. (I'm looking seriously to see if I need Apache in my servers.) >> However, Ruby comes with a web server called Webrick. >> script/server starts that web server. > Yes, but Apache is much more powerfull. Those all light embeded > httpd servers included in Ruby (or Python) can be usefull only for > testing, not heavy loaded production sites. Mmm. Not completely. It depends on *what* your production load is. Don't make performance assumptions unless you are quite familiar with your application's needs and your users' profiles. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca