SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Enthusiast mas22's Avatar
    Join Date
    Sep 2004
    Location
    SoCal
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ruby and Webservers

    Ok, think MySpace...
    What would "Tom" use if he had to run MySpace on Rails?

    We know that Webrick is small potatoes. Too small in fact, toss it back in the ocean.
    We know that non-fastcgi is too slow - Apache or otherwise.
    Obviously Apache is good but reports show that v2 is unstable with fastcgi - So what? Back to 1.3? Hmmm.
    Lighttpd is fast, but does it scale? And how about support? (no Windows direct either, only Cygwin).

    I'm no expert, but it doesn't take one to see the answer is not clear. Strange to me, since the answer is so important.

    Again, can RubyonRails handle the real world (ie, Ebay, Amazon, Yahoo, MySpace) or will it be merely the small site's fun language??

    (And while we're at it, has anyone hired a Rails host that has been fast and reliable, meaning unbroken uptime? ie. noticed plug for railsplayground.com on stoavio's "ruby resources" post above...)
    - Mark -
    SitePoint Noob
    "Anyone get the number of that jar file?"

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mas22
    (And while we're at it, has anyone hired a Rails host that has been fast and reliable, meaning unbroken uptime? ie. noticed plug for railsplayground.com on stoavio's "ruby resources" post above...)
    No personal experience, but I know site5.com has been advertising their support. Currently using FastCGI and possibly offering SCGI Rails as well soon.

  3. #3
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not an area I am focusing on (I develop mainly low traffic intranet sites, pretty much any web server can handle my traffic), so I can't really comment.

    There are a few folks in the Fast RoR Sites and real Ruby usage threads, who seem to have more experience with production sites.
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by mas22
    Ok, think MySpace...
    What would "Tom" use if he had to run MySpace on Rails?
    He'd probably use the worst software possible judging by his site's total lack of stability.
    Quote Originally Posted by mas22
    We know that Webrick is small potatoes. Too small in fact, toss it back in the ocean.
    We know that non-fastcgi is too slow - Apache or otherwise.
    Obviously Apache is good but reports show that v2 is unstable with fastcgi - So what? Back to 1.3? Hmmm.
    Lighttpd is fast, but does it scale? And how about support? (no Windows direct either, only Cygwin).
    Lighttpd is probably the best bet here. I don't know anyone who would get Windows hosting for Rails so I don't think it's much of an issue.
    Quote Originally Posted by mas22
    I'm no expert, but it doesn't take one to see the answer is not clear. Strange to me, since the answer is so important.

    Again, can RubyonRails handle the real world (ie, Ebay, Amazon, Yahoo, MySpace) or will it be merely the small site's fun language??
    Myspace is the real world

    Remember that Rails hasn't even hit 1.0 yet, and Ruby is going to version 2.0. The Ruby 2.0 interpreter is supposed to be orders of magnitude faster than the current Ruby interpreter (this is where the real bottleneck is), so odds are you'll see performance comparable to PHP/Perl in the not-too-distant future.
    Quote Originally Posted by mas22
    (And while we're at it, has anyone hired a Rails host that has been fast and reliable, meaning unbroken uptime? ie. noticed plug for railsplayground.com on stoavio's "ruby resources" post above...)
    I've been with Dreamhost since this weekend. They have Rails support but I haven't put it to the test yet.

  5. #5
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.planetargon.com/ has great rails support. It is run by Robby Russel who is writing a rails book for O'Reilly so he knows his stuff. I have found his hosting to rock solid. You might want to also consider a VPS. Here's a good provider for VPS: http://rimuhosting.com/order/startorder.jsp#miro . You can get on for around $20-30 that will work great for multiple rails apps.

    Also at this point lighttpd proxied behind Apache is the only way to go for shared hosting. If a shared host only uses Apache then it is going to need to restart apache every time some one updates their rails project for it to reflect their updates. If they use and Apache front end and give every rails user their own lighttpd on a higher port proxied behind the apache front end, then rails users can restart their lighttpd servers without a global restart.

    I am using lighttpd/fcgi for many rails apps that I coded and it is very stable and much faster and more scalable than apache. The largest rails site I have made and deployed on lighttpd/fcgi is http://yakimaherald.com. It gets around 60,000 page views a day and only uses a small amount of caching as most pages are very dynamic and pull data from multiple places to build a page. I started the app on apache1.3/fcgi but soon switched to lighttpd.fcgi and it is much more stable/faster and much less resource intensive than apache.

    I have great config files for lighttpd.fcgi and for setting up the proxy to lighttpd behind apache if you need them. Just post here and let me know and I'll post the config files for you to use.

    Cheers-
    Ezra

  6. #6
    SitePoint Enthusiast mas22's Avatar
    Join Date
    Sep 2004
    Location
    SoCal
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very good, Ezra. This is exactly what I was looking for...
    Thanks for the great info!

    Four small questions:

    1) I'm not sure what the acronym VPS stands for... and 2) why would you want VPS versus using 'planetargon,' as you referred?

    And your work is VERY impressive on http://yakimaherald.com. You should be very proud of a job well done! 3) Are they hosting their own webserver?

    To respond to your offer, I would love to get a copy of your configuration files regarding "setting up the proxy to lighttpd behind apache." 4) I am assuming that you are running this stack on linux?

    Again, thanks tons, Ezra.
    Mark
    - Mark -
    SitePoint Noob
    "Anyone get the number of that jar file?"

  7. #7
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mas22
    Very good, Ezra. This is exactly what I was looking for...
    Thanks for the great info!

    Four small questions:

    1) I'm not sure what the acronym VPS stands for... and 2) why would you want VPS versus using 'planetargon,' as you referred?

    And your work is VERY impressive on http://yakimaherald.com. You should be very proud of a job well done! 3) Are they hosting their own webserver?

    To respond to your offer, I would love to get a copy of your configuration files regarding "setting up the proxy to lighttpd behind apache." 4) I am assuming that you are running this stack on linux?

    Again, thanks tons, Ezra.
    Mark
    1. VPS stand for virtual private server. It is usually a linux distro that you get full root access to install and configure however you like. The way it works is the provider splits up a physical server into multiple virtual servers so instead of shared hosting where what other people do can affect your hosting, everyone is sandboxed from each other and to you the user it acts just like you have you own server box. Highly recommended for rails as you can get everything just right and you can host multiple domains with whatever services you want.

    2. See above.

    3. Yeah I am the webmaster for the Yakima Herald-Republic. We are running the site on its own dedicated Apple dual G5 Xserve in our data center. Even still the whole site is only using about 16% of _one_ processor at any given moment so we have tons of room for more rails apps and to expand as we get more and more traffick to our sites.

    4. The prefered OS for running rails apps are as follows: OSX, BSD or Linux. The configuration for these OS's are basically the same.

    Here is what an Apache virtual host that proxies to a lighttpd server on a higher port looks like( apache version is 1.3.x):

    Code:
    <VirtualHost yourIPadddressHere:80>
        ServerName example.com
        ServerAlias www.example.com
        ProxyPass / http://example.com:81/
        ProxyPassReverse / http://example.com:81/ 
    </VirtualHost>
    Here is a good config file for a dedicated rails app on an instance of lighttpd. This includes php/fastcgi as well so you can still knock out smaller .php script if you want and serve them up from the doc root of your rails app:


    Code:
    server.port                = 80
    server.bind                = "0.0.0.0"
    server.pid-file             = "/tmp/yourapp_lighttpd.pid"
    
    #server.event-handler = "freebsd-kqueue" # use this for freebsd or osx
    server.max-fds = 2048
    server.modules = ( "mod_rewrite", "mod_redirect", "mod_access", "mod_fastcgi", "mod_accesslog" )
    server.document-root        = "/Path/to/your/rails/install/public/"
    server.indexfiles           = ("index.php", "index.html", "index.htm", "dispatch.fcgi" )
    accesslog.filename          = "/Path/to/your/rails/install/log/lighttpd_access.log"
    server.errorlog             = "/Path/to/your/rails/install/log/lighttpd_error.log"
    server.error-handler-404 = "/dispatch.fcgi"
    url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
    #### fastcgi module
    
    ## read fastcgi.txt for more info
    
    fastcgi.server =  (
       ".fcgi" => (
         "yhr_app1" => (
           "socket" => "/tmp/rails_app1.socket",
           "bin-environment" => ( "RAILS_ENV" => "production" ),
           "bin-path" => "/Path/to/your/rails/install/public/dispatch.fcgi"
       ),
         "yhr_app2" => (
           "socket" => "/tmp/rails_app2.socket",
           "bin-environment" => ( "RAILS_ENV" => "production" ),
           "bin-path" => "/Path/to/your/rails/install/public/dispatch.fcgi"
       ),
         "yhr_app3" => (
           "socket" => "/tmp/rails_app3.socket",
           "bin-environment" => ( "RAILS_ENV" => "production" ),
           "bin-path" => "/Path/to/your/rails/install/public/dispatch.fcgi"
       )
      ),
       ".php" =>
           ( "localhost" =>
               (
                   "socket" => "/tmp/php-fcgi.socket",
                   "bin-path" => "/usr/bin/php ",
                   "bin-environment" => (
                   "PHP_FCGI_CHILDREN" => "2",
                   "PHP_FCGI_MAX_REQUESTS" => "2000"
                                        )
               )
           )
    )
    
    mimetype.assign             = (
       ".rpm"          =>      "application/x-rpm",
       ".pdf"          =>      "application/pdf",
       ".sig"          =>      "application/pgp-signature",   
       ".spl"          =>      "application/futuresplash",
       ".class"        =>      "application/octet-stream",
       ".ps"           =>      "application/postscript",
       ".torrent"      =>      "application/x-bittorrent",
       ".dvi"          =>      "application/x-dvi",   
       ".gz"           =>      "application/x-gzip",
       ".pac"          =>      "application/x-ns-proxy-autoconfig",   
       ".swf"          =>      "application/x-shockwave-flash",      
       ".tar.gz"       =>      "application/x-tgz",
       ".tgz"          =>      "application/x-tgz",
       ".tar"          =>      "application/x-tar",
       ".zip"          =>      "application/zip",
       ".mp3"          =>      "audio/mpeg",
       ".m3u"          =>      "audio/x-mpegurl",
       ".wma"          =>      "audio/x-ms-wma",
       ".wax"          =>      "audio/x-ms-wax",
       ".ogg"          =>      "audio/x-wav",
       ".wav"          =>      "audio/x-wav",
       ".gif"          =>      "image/gif",
       ".jpg"          =>      "image/jpeg",
       ".jpeg"         =>      "image/jpeg",
       ".png"          =>      "image/png",
       ".xbm"          =>      "image/x-xbitmap",
       ".xpm"          =>      "image/x-xpixmap",
       ".xwd"          =>      "image/x-xwindowdump",
       ".css"          =>      "text/css",
       ".html"         =>      "text/html",
       ".htm"          =>      "text/html",
       ".js"           =>      "text/javascript",
       ".asc"          =>      "text/plain",
       ".c"            =>      "text/plain",
       ".conf"         =>      "text/plain",
       ".text"         =>      "text/plain",
       ".txt"          =>      "text/plain",
       ".dtd"          =>      "text/xml",
       ".xml"          =>      "text/xml",
       ".mpeg"         =>      "video/mpeg",
       ".mpg"          =>      "video/mpeg",
       ".mov"          =>      "video/quicktime",
       ".qt"           =>      "video/quicktime",
       ".avi"          =>      "video/x-msvideo",
       ".asf"          =>      "video/x-ms-asf",
       ".asx"          =>      "video/x-ms-asf",
       ".wmv"          =>      "video/x-ms-wmv",
       ".bz2"          =>      "application/x-bzip",
       ".tbz"          =>      "application/x-bzip-compressed-tar",
       ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
      )
    This is the same lighttpd.conf file that is running http://yakimaherald.com. The three fastcgi.server ".fcgi" = parts each create 4 fastcgi dispatchers for a total of 12 ruby fastcgi processes. This easily runs 60,000 dynamic page views a day and I expect that this same conf will scale to around 150,000 page views/day before I need to add any more fastcgi listeners. The php/fastcgi part spawns 24 php fastcgi listeners and is plenty for a ton of php processes. In order for php to work with fastcgi you must compile php with fastcgi flags. So compile php with whatever flags you normally would for apache but leave out any apsx flags and add these for fcgi:

    Code:
    ./configure \
    --enable-fastcgi \
    --enable-discard-path \
    --enable-force-cgi-redirect \
    That about sums it up. You can find a complete write up of the dev and deploy process for this rails app at: http://permalink.gmane.org/gmane.com...by.rails/20637

    Hope this helps you get going with rails! You wont regret it. Let me know if you need anything else.

    Cheers-
    Ezra

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by mas22
    1) I'm not sure what the acronym VPS stands for... and 2) why would you want VPS versus using 'planetargon,' as you referred?
    VPS = Virtual Private Server. It's like a hybrid between shared and dedicated hosting.

    more info: http://en.wikipedia.org/wiki/Vps

  9. #9
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mas22
    Lighttpd is fast, but does it scale?
    My understanding is lightppd excels at scaling, specifically in easily doing fcgi load balancing on remote machines.

    Nothing I've actually tried, that's pretty much a quote from the Agile book.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •