Slashdot Mirror


Optimize PHP and Accelerate Apache

An anonymous reader writes "As the load on an application increases, the bottlenecks in the underlying infrastructure become more apparent in the form of slow response to user requests. This article discusses many of the server configuration items that can make or break an application's performance and focuses on steps you can take to optimize Apache and PHP."

3 of 191 comments (clear)

  1. Diet article by billcopc · · Score: 5, Informative

    Maybe I'm being a cynical bastard again, but that article is REEEALLY light on content. Compared to the other featured articles from IBM, which are usually very rich and informative, this one is more like an "idiots guide to apache", the kind that belongs on Digg's mountain of filth. This is little more than a rehash of the Readme files for Apache and PHP combined. It's about as deep as telling a windows user how to make their PC faster by changing to the Windows NT theme. Of much greater value to web professionals is this article from a fellow OSDN site (!) Lighttpd can lighten Apache's load

    --
    -Billco, Fnarg.com
  2. Re:want performance from php? by doubledjd · · Score: 5, Informative
    My history is java but I've come to appreciate php recently. The track record on it when used properly is impressive. In case there are some people just starting with it, the several of the problems with php performance is caching. (this is pretty standard stuff so apoligies to people who know a lot more about it than I do)
    1. Use apc or eaccelerator. (yahoo uses apc so that is the one we went with). This alone will give considerable benefit. Apc can defaultly cache any of the php that runs or it can also be used as a local cache for objects you'd like to store programmatically.
    2. If you need distributed items, especially in a non-sticky load balanced environment, look at memcached.
    3. Use a query cache for your db
    4. If your db connections are expensive, look at sqlrelay
    5. Look at whether a caching proxy is a possibility for you (squid or apache has some mods).
    6. Benchmark your pages and functions. It is the only way to know if configuration tweaks are adding any value. I usually do this after a full profiling using apd (to help identify the bottlenecks and frequently called functions). I usually run apache's ab to get a look at page benchmarks.
    7. you can always write c extensions for items in php that are too slow. Of course, you'll have to know c, increased maintenance, development time, etc
    There are a million things to be done to increase performance. Obviously, don't use anything blindly. Still, I think the opcode cache (apc or eAccelerator) is probably the easiest and most substantial win.
  3. Re:want performance from php? by consumer · · Score: 5, Informative

    All that apache does when serving PHP requests with mod_php is run the early phases (auth, URL mapping) and pass the request to PHP. Do you really think that Lighttpd + FastCGI is going to be significantly faster than that? The bottleneck is your PHP code, not the web server.



    Lighttpd is probably faster at serving static content. Most sites don't have enough bandwidth to find out.