• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

Can I make my PHP site faster by using more RAM?

I have a server with 8 GB of RAM, usually only around 1.8 GB of RAM gets used.  I'm wondering if it's possible to somehow put the rest of the RAM to use in order to make my site faster in some way.  My site is coded in PHP (mysql database is located on a different server).

I have a windows 2008 64-bit server with Plesk.
0
davideo7
Asked:
davideo7
5 Solutions
 
wolfcamelCommented:
you really need to work out where the bottle necks are.
you could create a ram disk and host the site on there, but i doubt it will make much difference.
a fast raid system can make more difference - particularly if you have a large database
0
 
gnitoCommented:
certainly it is not only the ram which affects speed, there is also the cpu, the hdd, and other things.
also if the slowdown is at the "PHP based" scripts then ok, but if the problem persists even on a static html page with some images, then the problem may also be the internet speed.
0
 
Hugh McCurdyCommented:
From Business Data Communications & Networking, 10th Ed, by FitzGerald & Dennis.  ISBN: 978-0470-05575-5

Page 217

"To improve performance, you must locate the bottleneck, the part of the network that is restricting the data flow.  Generally speaking, the bottleneck will lie in one of two places.  The first is the network server.  ...  The second location is the network circuit."

The book continues with methods for diagnosis.  You should look at server utilization when performance is poor.  If utilization is 60% or more, you have a problem with the server.  If it's under 40%, then the problem is the circuit.  If it's 40-60%, you might have two bottlenecks.
0
 
xtermCommented:
I'm going to give you the unpopular answer which I don't really see from the other experts who have chimed in.

No, you cannot force your PHP to use any more of the free memory that the server is not using.  When it comes to memory, the only thing you have to be sure of is:

1) Your system has enough to where it never overflows its physical memory and starts using its pagefile/swap space (obviously not a problem in your environment)
2) Your applications have enough memory allocated within to serve their purposes - in php.ini, you can find various memory limits that you can tweak, however yours are likely fine if you're not getting any resource errors.
3) None of your applications leak memory, which would lead you to perhaps encountering #1 and #2 above

So, no, though you can't leverage that free memory for additional performance, the other experts have provided some good thoughts as to where you can troubleshoot diminished performance.  I'd add to what they have listed that the most frequent drain on performance are external calls made by the site such as database connections (especially ones to remote databases).  Make sure your site has a snappy, low latency connection to it's DBs, and optimize the database regularly.  Good luck!
0
 
Ray PaseurCommented:
System performance is a function of three things: the system under test (code and hardware), the workload, and the response time.  It is like Ohm's law.  Fix any two variables and the third is determined.  So the short answer may come from asking the question, "What can you change?"  You might want to use memcacheD.  You might want to consider APC.  Both of these will help you get some good use out of that extra memory.
http://php.net/manual/en/book.apc.php
http://php.net/manual/en/book.memcached.php
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now