Hello
Im building a browser based game (text and images)
I have a debugger/benchmark script that I run at every opage load which gives me various information. One thing it logs is script exectution times (including how long it took for all of the php to load and execute) as well as memory usage.
Im developing on a shared host so I guess things differ a bit when I go dedicated, but I have noticed a fully loaded profile page takes around 0.05 – 1 second to execute and consumes 1.1 – 1.3 MB of memory (using phps memory_get_usage() function)
Im wondering if that much memory is a bad thing or not… Imagine 100 users load a page, then imagine 10,000 users. Granted if the system had 4GB+ of memory it might be able to handle it but it seems high.
Its not a script more than its all scripts that run before the server sends the html to the browser.
But these scripts are working to build the HTML page loading profile info from a db query or sessions, performing calculations, accessing classes, functions etc..
And at the end stripping whitespace from the HTML (using ob_start with a strip function)
Weird thing is, I have very optimized queries, and I never use *
I free my results all the time and I never get big results anyway (we are talking 1000 bytes max in most cases, sometimes more)
I have a debugger class that handles all this info, Ill post an example of what it spits out:
Example 1 Initial page load where I run all queries and store info in session data:
[URL=”http://img651.imageshack.us/img651/3912/68408024.jpg”]http://img651.imageshack.us/img651/3912/68408024.jpg
Example 2 second page load (same one) where we skip most queries due to session info being present:
[URL=”http://img27.imageshack.us/img27/779/31897689.jpg”]http://img27.imageshack.us/img27/779/31897689.jpg
I dont expect you guys to understand it all, but bascialyl I load all the modules I need first then run my scripts for that particular page.
MU is memory usage, and I also put memory usage and peak usage on top and bottom of the output. For memory usage the first value is the memory size and the second value is the real usage (real allocation)
It seems most of the data comes from loading the modules, but the modules themselves are just full of functions or classes, and they dont go over 100KB in size total.
So Im not sure why the memory usage is so high.
Any ideas?
edit: as you can see, my queries and subsequent result usage etc only really use up to 100KB MAX of memory. So it couldnt be my queries. Even the first image shows that a lot of queries and calculations does little to add to the memory usage.