From: Jim Freeze Date: 2002-04-08T11:48:17+09:00 Subject: Re: Switching from PHP to Ruby - Comments Please On Sun, Apr 07, 2002 at 03:44:58AM +0900, Sean Chittenden wrote: > > Well, I'm about ready to make the switch to a Ruby based website. My > > plans are to use FreeBSD, Apache 1.3, MySQL and Ruby in either a > > mod_ruby/eruby or FastCGI/FCGI environment. > > Congrats, you won't look back. > > > Can someone comment on whether: > > 1) A Ruby based website is easier to implement than say PHP. > > That depends on your comfort levels with Ruby. After having switched > cold turkey from Perl to Ruby, I think it's far easier to develop > using mod_ruby/eRuby than it is with mod_perl/PHP. Let me put it this > way though, in Ruby, the language gets in your way (much?) less than > it does in PHP so I would argue that no matter what, Ruby will tend to > be faster to develop in. > Ok, help me out here. What are the possible configurations for running a ruby website. Here is the list according to my understanding: 1. CGI a. Run ruby just like you would perl or a shell. 2. FCGI or FastCGI a. FCGI keeps a ruby process open to reduce startup delay? Are there blocking issues? b. FastCGI (pure ruby FCGI) can support threads in Apache 2.0 3. mod_ruby/eruby a. eruby allows ruby code to be embeded into any text document. mod_ruby lets Apache call eruby to process a ruby encoded file. b. Can FCGI or FastCGI be used here to speed things up, or is it enough that each apache process has its own ruby process. c. What about the future with Apache 2.0. Will threads help here? > > 2) A Ruby based website does not have significant performance challenges. > > 1) If you've got a performance problem, you've got a good problem: > that means you've got traffic. Too many times I see people > complain about performance and they really don't need it. If you > need performance, however, you can easily get that with the C > extensions (which are markedly easier to learn than any other > extension for other languages). Anyway, for what it's worth, > mod_ruby has performed about 90% as fast as mod_perl, 95% as fast > as PHP and that's good enough for most of what I do: the rest of > the time I use native C modules. > > > 3) Session management can be done as implicitly with or without > > cookies as PHP4. > > Check out CGI.rb, it should have what you're looking for. -sc I did, but I am looking for a shorter answer. In PHP4, I can write code that uses sessions, where the session ID is obtained from a cookie or a GET/POST variable if cookies are turned off by the user. In addition, if a user has cookies turned off, PHP4 will rewrite the URL so the session ID is in the URL. Since I don't won't to require cookies, this it a very nice feature to have. Does session.rb/mod_ruby do this? That is, rewrite URLs when cookies are turned off and collect session id's from either cookies or GET/POST variables? Thanks -- Jim Freeze If only I had something clever to say for my comment... ~