I'm running an ExpressionEngine site using CartThrob for a shopping cart. Some of the pages are loading extremely slowly on the production server (7, 10, 15 seconds of Controller Execution Time as reported by CodeIgniter profiler), even when there is no traffic at all to the site. The same pages running on a dev server with the exact same codebase and exact same database are taking less than one second to load by the same measure. The problem seems worst on pages with lots of database queries, though that could be a red herring.
At first, I thought the issue was with the database or the connection to the database, but the CodeIgniter profiler indicates that the sum of all database queries on production for the slowest page (180 queries) is only about 0.6 seconds. Looking at the CodeIgniter database driver source, that number appears to be measured in PHP, so it seems like the problem is not in the database or the connection to the database.
In addition, looking at the Template Debugging log on production, there doesn't seem to be a single step that takes an inordinately long time. Rather each step seems to take just generally longer than on the dev server.
My local development machine is a Macbook running MAMP, and the Server is a 4GB Linode VPS running Ubuntu. I have separately benchmarked PHP/MySQL performance on both, and the Macbook was slightly faster at InnoDB selects, inserts, and updates, but not considerably so. I also benchmarked disk read/write on both machines, which came back almost identical. Just to check, I also migrated to another Linode server but the results are the same.
What else should I look into as to what might be causing this problem?
memory_limit
since it wouldn't necessarily be a high limit, even though you have 4GB of memory on your server.