|
Posted by Gordon Burditt on 10/08/05 04:33
>Just wondering, is there anything fundamentally that keeps php from
>being "distributed?"
>
>By that I just mean, run on many computers... Usually the only
>communication between threads is through the database anyway right (not
>through shared objects)?
Session data is by default kept in a filesystem, not a database.
You can change that, though.
>I'm thinking you could run it on multiple
>computers, using the same filesystem, and there shouldn't be
>problems...
A lot of large sites use dns round-robins (or level 4 switches) to
route HTTP requests to one of a whole bunch of nearly-identical web
servers, sometimes physically distributed around the country. They
either use a shared filesystem or copies of filesystems that are
supposed to be identical (tools like rsync may be useful here).
For that matter, the web site content might consist of a CD-ROM with
copies mailed to various sites with the servers.
One gotcha is the session data. A session on one system needs to
be accessible and valid on another system, since successive requests
might be to different servers. This is sometimes done with a session
handler that puts the session in a database used by all of the
servers. Another possibility is a shared filesystem for the session
files but generally a database works better and provides more locking
facilities. Stuff explicitly put in a database also needs to be
shared between the web servers.
You also need to write your PHP to use a database, not local files.
It does require a little thought, but it's not rocket science.
Gordon L. Burditt
[Back to original message]
|