RubyLsapi vs. PHPLsai performance

Discussion in 'Ruby/Rails' started by amalik, Sep 12, 2006.

  1. amalik

    amalik Member

    I have noticed that when I lightly load my rails virtual host with a simple 'ab -n 30 ', the railsrunner seems to take about 40-70% of the user cpu, while when I load my php vhost hitting the title page of my blog, it hovers around maybe 15-30% of user CPU.

    could it be that the rubylsapi library "spins" while ruby goes off to get stuff from the database. I can only see that it is using usleep(), so it shouldn't really be spinning.

    question is, is this the rubylsapi or is it because ruby is a cpu hog?

    how can I determine which part is being the cpu hog?
  2. mistwang

    mistwang LiteSpeed Staff

    Rails framework causes the high CPU usage.
    We believe rubylsapi is the fastest IPC implementation for ruby. just take a look at our comparison between LSAPI and FCGI on our blog.
    ruby itself is pretty fast, should be comparable to PHP, it will become pretty slow once Rails framework is used. You also can get some idea about the slow down if you compare the results of our benchmark of "hello world" implemented in pure LSAPI and LSAPI + Rails published on our blog.

    You can make Rails runs a little bit faster by turning off logging and session for part of the application don't need them.
  3. amalik

    amalik Member

    I suspected as much. I'm running it in production mode so logging is minimal. Truth be told the 3rd party app I'm using could use some query tuning because right now its a super-hog.

    I'll take a look at the benchmarks you mentioned.. I'm loving LSWS btw, I think I'm gonna go with enterprise when I get to deploy this little piggy :)


Share This Page