[nycphp-talk] php scalability
Hans Zaunere
hans at nyphp.org
Mon Aug 18 11:57:05 EDT 2003
Hi Lee,
Lee Semel wrote:
> It's not always the case that load balancing is independent of the
> scripting language. Here's a specific example of something that's
> automatic in Java, but needs to be programmed into the application in PHP:
>
> In a load balanced setting, a user can be switched from one server to
> another as they use the site. So the session needs to be available to
> all servers, and stored in the database. Java application servers such
> as JBoss or Weblogic can take care of this automatically, making the
> session available to all servers without you having to do anything
> special. But in PHP, we have to know in advance that this is a problem,
> so we can set up the session to work this way.
Yes and no, and I'd be hesitant to count on one of the mentioned app servers to take care of things automatically, or "automagically." Regardless, PHP's session handler is module, so a change isn't catastrophic. If well architected this should be a none issue.
> Another issue is deploying or upgrading the application on multiple
> servers, especially if several versions need to be kept around. I can
> zip a Java application into a WAR file and send it to all the servers at
> once, and the configuration and security settings live nicely in a
> separate web.xml file. The WAR file can even contain all the automated
> tasks that would be done by cron jobs. But in PHP, you need to keep
> track of all the individual little files in the app, track changes to
> php.ini files and httpd.conf files, include files, include paths,
> .htaccess files, PEAR libraries, and cron jobs, all of which can get out
> of sync and mixed up very easily.
As others have mentioned, rsync, or even CVS can be a solution here - or, regular tar files with a couple scripts (either shell or php itself). While PHP doesn't have the pre-packaged feel and convienence of a J-based system, this is often good. For one, I've found pre-packaged things never really do exactly what you need, and convienance is often an illusion which comes back to bite you later on.
> Neither of these is a big deal in itself, but I'm wondering what other
> red flags there would be to make PHP work in a load balanced setting, so
> I can get an idea of the relative cost and effort versus Java. If there
> are a lot of tricky little things like this, they can add up to a big
> job. I'd like to do it in PHP if at all possible.
It comes back to architecture; either system will fallpart in an environment that isn't well layed out and designed. Granted, with the money poured into Java and the like, some of the work is done, and it can be helpful. But it can also be illusive and inflexible, whereas PHP (and AMP in general) lends itself to a better designed and customized environment; and certainly a less expensive one.
Lastly, just to touch on Yahoo!'s use of PHP. True, they do have a great team of talent, money and resources, and they'll be tweaking PHP (as they have FreeBSD, Apache, MySQL and even Oracle) for their environment to meet their needs. While these "tweaks" are on a much bigger scale than tweaks needed by your typical site, they also have more traffic than your typical site :)
H
More information about the talk
mailing list