I've purchased a 512MB VPS package. I have two questions dealing with PHP memory limits and php.ini.
Firstly, can I set my PHP memory in php.ini to 512MB?
Secondly, is it advised?
This is a discussion on PHP memory limits, how high can I go in the VPS & Dedicated forum
I've purchased a 512MB VPS package. I have two questions dealing with PHP memory limits and php.ini.
Firstly, can I set my PHP memory in ...
I've purchased a 512MB VPS package. I have two questions dealing with PHP memory limits and php.ini.
Firstly, can I set my PHP memory in php.ini to 512MB?
Secondly, is it advised?
Actually, my reason for asking was to make sure I am using the RAM that I paid for, in other words "why set it below, when I paid for more?"
With that being said, your thoughts?
I think you should set it for what your scripts need (including some safety percentage, perhaps) and not more. It doesn't get allocated by PHP unless your script calls for it.
If you want to be sure to get your money's worth, you should be looking at reducing load and utilization on your server in any possible way so that your server is zippy and responsive for everyone on it including your visitors --as should your neighbors-- instead of trying to grab as much as possible to "get your money's worth".
BTW I think you should be able to burst over your 512 up to 2GB, but you risk having the system kill your processes when your environment is using more than 512M.
I have lots of visitors to my site on my shared server, and my shared server hardly knows that my site is running on it. With or without my site live, the server utilization is nearly identical except for 4 times a day when I run an update that takes less than 1 minute to execute and even then it has been tuned to reduce stress on the server. My pages are served up in less than .2 seconds. Contrast that with other websites whose pages are so complex that the server must spend seconds of CPU time to deliver each page, and the visitor sits there waiting.
Which is better for you? To be the lightweight site that makes everyone on the server (and your visitors) happy or be the site that needs to load up 500MB of memory to deliver a page while everyone on the server (including your visitors) waits?
Superb points. My website is a Drupal fatty and I am almost 100% it is runny very inefficiently. MySQL and PHP tweaks would be nice but I'm too inexperienced and squared to do it. Ideally, I'd like a super snappy website, but since I don't have much experience tweaking, memory limit tweaks is what I can do now.
That PHP limit is what a single page can use and just to process the PHP instructions. You'll need memory for many other things too, such as the operating system, the apache server, and the database. You'll also like to be able to serve more than one page at a time.
That limit is a safety net to keep a bad PHP script from cripling your site. It is a hard limit that kills off any script that tries to go above, not a way to manage script performance. So no, it is not advised to mess with that memory limit and it can only hurt performance, not help it. If you have a specific script that needs more for a good reason (image processing comes to mind), you're advised to make the setting inside that specific script.
Regards,
Wim Heemskerk
---
Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
And Gwaihir.net - The Middle-earth CCG store
Thanks for the input, Gwaihir. I didn't look at it that way, in terms of the memory requirements for non-PHP scripts. So if my websites experiences traffic and starts choking, it would be a good idea to reduce PHP memory then?
Raising that PHP memory limit is worthless, your site won't go faster or anything, it's just sometimes specific scripts might need a little more than default etc. To give your ram better value the MySQL settings should be optimized instead to allow it more memory, that will actually give your site a boost rather than that php setting.
Himeko, that makes sense. Which MySQL paramaters should I adjust? Increase?
Here's a guide aimed at a server with 512 MB ram like yours
http://www.earnersblog.com/vps-optimization-guide/
That guide looks good, if you need help or you are in doubt about some parameter/value, please do not hesitate to open a ticket with support.
Veena K John
Jaguar Technologies, LLC.
Helpful Links
Knowledge Base | Network Status | Current Specials
Need a Manager?
(pm) | (email) David, Customer Service Manager
No, that won't help you either. It's just a safety net to keep a bad PHP script from cripling a site as a whole by taking way too much memory for the server's good. Lowering it doesn't make your scripts run successfully using less memory. Each script will either still use exactly as much as before, or hit the new limit and crash, not yielding the response your visitors are looking for. So, that might only help you if you want to track down pages that use a lot of ram and optimize them. But, there are better profiling tools for that than making them crash.
That optimization guide looks good. I think there's more on MySQL's site as well on optimizing for specific usages and memory amounts. Another thing to wonder: what are you optimizing towards? One relatively large site? Several smaller ones? What do they need most? (Like: some specific PHP scripts, specific DB queries, lots of flat files, etc.) The tricks for each of these can be quite different.
Regards,
Wim Heemskerk
---
Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
And Gwaihir.net - The Middle-earth CCG store
Copyright © 2011 JaguarPC.com
Bookmarks