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

Posted on 2011-10-22
Last Modified: 2012-05-12
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.
Question by:davideo7
    LVL 20

    Assisted Solution

    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
    LVL 3

    Assisted Solution

    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.
    LVL 13

    Assisted Solution

    by:Hugh McCurdy
    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.
    LVL 19

    Accepted Solution

    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!
    LVL 107

    Assisted Solution

    by:Ray Paseur
    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.

    Featured Post

    Free book by J.Peter Bruzzese, Microsoft MVP

    Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

    Join & Write a Comment

    I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
    Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
    This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now