I know PHP fairly well. But one aspect of PHP which I am fairly green in is caching, loading balancing etc.

A lot of companies hiring PHP developers are looking for these high-use background, which I've never really developed an enterprise infrastructure with PHP.

This seems more like sys-admin type stuff, so I get a little flustered when companies are always asking for this experience. Anyway I guess I better learn.

Where's a good place to start learning all this stuff?

  • btw I heart APC. – qodeninja Oct 1 '09 at 6:31

I can recommend Building Scalable Web Sites, which is written by one of the guys at Flickr. The Art of Capacity Planning, also by Flickr bods, is also useful as additional reading. Both of those deal with the server side of things.

High Performance Web Sites and Even Faster Web Sites are taken from the Yahoo best practices for how to make your site work quicker from the users perspective. They deal more with how to get the page in front of the user quicker, rather than how to server the page faster. Things like putting javascript at the bottom of the page so the browser doesn't block. They also talk about making less requests to the servers, through things like being cache friendly and using a single image for all your icons and using css to display only a small part of that big image in the right place.

There's a little bit of overlap between them, but I've read the first three and I highly recommend them.

As for PHP, seems the only way to make it quick is to cache early and cache often. In particular, look at memcache and APC. Another thing to consider is that at some point the default session handler locked the session file on disk until the request completed, meaning all requests using a session would block. Implement your own session handler, but don't use a database for that.

You might find this interview interesting.

| improve this answer | |
  • I like the last link the best. I perosnally dislike PHP frameworks and now I have a reason to bash them haha. All that aside, they say you have to use something like compiled C++ to do heavy lifting. But that just leads me to more questions... like how do compile C++ programs to interact with PHP on a Linux server. I have no idea how to do that. I know how to write C++ though =] – qodeninja Oct 1 '09 at 6:25

I can't give you specific places to start, but I keep http://highscalability.com/ in my RSS feed as they always have very interesting articles, covering everything from theory through to real world cases with very large environments (e.g. Flickr, Squarespace, Youtube)

| improve this answer | |

If you need raw speed in core functions of your PHP you can make your own modules. Some places that you can read about that is:

I really wouldn't recommend it unless you need to, but it can give you some extra performance if you need that in some cases.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.