How can I study the server load/impact impact of my PHP scripts in a shared hosting environment?
-
How can I study the server load/impact of my PHP scripts in a shared hosting environment? The hosting company isn't very helpful. I want to be proactive and not wait for a call that my scripts are causing trouble. Also want a website that isn't slow and unresponsive. The server is Apache2 w/PHP5 I'd like to learn in general terms about it but the specific case I have is as follows: I'm building a website that does a lot of thumbnailing using phpthumb(). I send an AJAX request to the server to generate thumbnails and return a list of SRC tags. This puts a certain load to the server. phpthumb() caches the thumbnail so the load happens only once I want to also have PHP look up and return the dimensions of the original image using getImageSize. This is additional load and caching wouldn't happen. If I do the lookup 100 times/second would it overwhelm the server? Is it something I should be concerned about? I have no idea about how my scripts might affect the server. The site gets about 15k hits per day and is growing. Thanks
-
Answer:
Your best bet is to emulate your server environment as closely as you can, on a spare PC if possible, virtual machine if necessary- but that will skew your results. Then run a load testing tool like http://jakarta.apache.org/jmeter/ or http://en.wikipedia.org/wiki/ApacheBench against your scripts. JMeter is pretty elaborate, but much more complex to set up. While running, you'll be interested in monitoring CPU Utilization and RAM utilization. You will be unable to certify that your system will meet any particular performance level (there's too much variability between whatever your hardware is and what they are running in production, not to mention whatever random scripts are running on that box), but you can identify things that take too long and verify that your caching, etc is working as desired.
jorlando at Ask.Metafilter.Com Visit the source
Other answers
If you're caching as much as possible (if the image info is coming from a database, could you cache the dimensions in there too so they're retrieved along with the info?), then really it's just a matter of waiting until your site is popular enough for the hosting firm to grumble. I'm not sure having measurements is particularly helpful in predicting this, so you might be better off spending the time assessing next-step-up hosting packages to be ready to move when necessary.
malevolent
2nd benchmarking it somewhere else. Primarily because when you're with a shared host there are too many other variables to take into account. What if someone else is load testing at the same time? Or someone is running a giant chron, or someone else has a runaway script? If you load test fine today, but three other sites on the same server become popular before yours does, yours might be the straw that broke the camel's back. It's pretty trivial any more to set up a L/WAMP server locally and see how it performs. Of course from that benchmarking you won't be able to tell at what load limit your hosting provider will get ticked off. If it's like all of the hosts I've used, they'll probably only notice when someone else on the box complains. Plan to move when things pick up, and be able to do it in a hurry. Make sure your code and data is easily portable.
Ookseer
Related Q & A:
- How can I study in Ireland?Best solution by Yahoo! Answers
- How can I study journalism abroad?Best solution by Yahoo! Answers
- How can I study law in America?Best solution by Yahoo! Answers
- How can i study for the ACT?Best solution by ChaCha
- How can I study at a university in Japan?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.