mysql on mongrel vs apache

Does mysql performance with mongrel and Snow Leopard differ from its
performance with Apache and Ubuntu? I am experiencing the issue of
slow performance in Ubuntu production environment compared to my
Leopard development environment. For the exact same code, after
pushing to Ubuntu server, the same action/view takes much longer to
complete and many more DB queries on the Ubuntu server:

On my Leopard, I get: Completed in 643ms (DB: 322) | 302 Found
For Ubuntu, I get: Completed in 8803ms (DB: 517) | 302 Found

The number after DB: is the number of SQL queries for that action I assume.

Is there anything I should watch out for when pushing code from
Leopard to Ubuntu?

Thanks much.

Does mysql performance with mongrel and Snow Leopard differ from its
performance with Apache and Ubuntu? I am experiencing the issue of
slow performance in Ubuntu production environment compared to my
Leopard development environment. For the exact same code, after
pushing to Ubuntu server, the same action/view takes much longer to
complete and many more DB queries on the Ubuntu server:

On my Leopard, I get: Completed in 643ms (DB: 322) | 302 Found
For Ubuntu, I get: Completed in 8803ms (DB: 517) | 302 Found

The number after DB: is the number of SQL queries for that action I assume.

It's not - it's the amount of time spent querying the database. There
are a lot of things which could affect performance - ruby version,
mysql version, mysql configuration, physical resources available on
the server etc. Rails does behave slightly different when the
environment is set to production (as opposed to development), but that
should make things faster, not slower.

Fred

Does mysql performance with mongrel and Snow Leopard differ from its
performance with Apache and Ubuntu? I am experiencing the issue of
slow performance in Ubuntu production environment compared to my
Leopard development environment. For the exact same code, after
pushing to Ubuntu server, the same action/view takes much longer to
complete and many more DB queries on the Ubuntu server:

On my Leopard, I get: Completed in 643ms (DB: 322) | 302 Found
For Ubuntu, I get: Completed in 8803ms (DB: 517) | 302 Found

The number after DB: is the number of SQL queries for that action I assume.

Is there anything I should watch out for when pushing code from
Leopard to Ubuntu?

Thanks much.

Quoting Ease Bus <easebus@gmail.com>:

Does mysql performance with mongrel and Snow Leopard differ from its
performance with Apache and Ubuntu? I am experiencing the issue of
slow performance in Ubuntu production environment compared to my
Leopard development environment. For the exact same code, after
pushing to Ubuntu server, the same action/view takes much longer to
complete and many more DB queries on the Ubuntu server:

On my Leopard, I get: Completed in 643ms (DB: 322) | 302 Found
For Ubuntu, I get: Completed in 8803ms (DB: 517) | 302 Found

The number after DB: is the number of SQL queries for that action I assume.

Do you have the same amounts of data in the DB in production and development
environments? The number after 'DB:' is the number of milliseconds the DB
access required. The difference in DB access times are not nearly as big as
the the controller and rendering times (Completed time minus DB time). I'm
guessing production has more data in the DB and more data found and rendered,
hence increased run times. But the development laptop may be a lot faster
than the server (higher clock speeds, faster rotating disks, faster disk
busses, e.g., SATA and USB 2.0 can be much faster than PATA).

You might try disk and other benchmarks on both machines.

HTH,
  Jeffrey

Thanks all. The amount of data on the Ubuntu staging server is a little bit more than the data on my Leopard laptop. So the slight difference in DB access time seems reasonable. What worries me is the intolerably long time the Ubuntu machine takes to produce the views. I also notice that the ruby1.8 process on Ubuntu briefly shots up close 100% of the CPU during that time. Below are the specs of the computers

  1. Snow Leopard Laptop : MacBook Pro 2.53 GHz Intel Core 2 Duo, 4GB 1067 MHz DDR3, 250.06 GB SATA hard drive
  • ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]

  • Rails 2.3.5

  • mysql Ver 14.14 Distrib 5.1.43, for apple-darwin10.2.0 (i386) using readline 5.1

  • Mongrel

  • Ubuntu 9.10 Server (old former custom built Windows xp computer): Intel Pentium 4 3.00 Ghz, 1G RAM, 18 (eighteen) GB hard drive. (IDE), 855 MB is swap partition.

  • ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]

  • Rails 2.3.5

  • mysql Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (i486) using EditLine wrapper

  • apache2
    Could the difference in hardware configuration explain the slowness in the Ubuntu box?

Could the way I install ruby, or mysql on the Ubuntu box be of consequence? I just ran:

  • sudo
    apt-get install ruby-full build-essential

  • sudo apt-get install mysql-server mysql-client
    

I read that some people download the ruby and mysql source code and actually run make to compile them on Ubuntu instead of using apt-get. Would that have affected later performance?

Besides creating a virtual site in apache2, I did not configure ruby, rails, mysql, or apache2 on either box in any particular manner. I just stuck with the default configuration that came with the software. So the software configuration in these software is not different between the two boxes.

Thanks.

It looks like you are running out of memory (RAM) and disk-swapping is accounting for the difference in times.