Question

I'm building a website using the FuelPHP framework, which by default prints the execution time and memory usage at the bottom of the page. Now I just noticed that on my local machine, I have a pretty small memory footprint:

Page rendered in 0.0304s using 0.721mb of memory.

I deployed exactly this site (including a snapshot of the database) to my remote test server and suddenly memory usage increases by a factor of 10:

Page rendered in 0.0963s using 7.099mb of memory.

I cannot explain such a big difference from the details of execution alone, so I think the deviation must be in the environment. Unfortunately I'm mainly a programmer, not really a server admin, so I don't really know where to start looking. So I'm going to ask a bit of a general question, which will hopefully give me some useful pointers: where should I start looking? The code is exactly the same and as far as I am aware both machines (local laptop and remote server) are fairly standard Apache installations with PHP5. Any answers suggesting specific Apache or PHP settings that might cause this, or specific lines to search for in the logs, are welcome.

I realise this is a pretty general question that might get me some downvotes, any constructive critisism is welcomed instead. Basically, I'm at a loss where to even start looking, at the moment.

Update: I decided to first exclude the framework as the culprit, so I ran the following one-line script on both machines:

Locally I get a value of about 115, while the remote server reports about 600.

Update 2: Just noticed I'm running PHP5.5 locally but server is only at 5.3. Maybe some bug that got fixed later - will upgrade that first.

Était-ce utile?

La solution

Thanks for the suggestions guys, I fixed the problem. As noted in the update to the original post, I realised I was running PHP5.5 locally but server was only at 5.3. After some ppa-magic with apt and some help from other questions on SO I managed to install Apache 2.4 with PHP 5.5.x. Now I actually see

Page rendered in 0.0261s using 0.582mb of memory.

locally and remotely

Page rendered in 2.3184s using 1.238mb of memory.

Assuming that a factor 2 is caused by the server being 64-bit and not my development machine, I can live with the remaining difference.

Autres conseils

Use Xdebug to find out what functions are using all your memory.

Most likely it's a bug or design flaw in the framework.

It can be difficult or even impossible to get Xdebug working depending on your server. But sometimes it's pre-installed and simple.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top