Re: distributed php



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



Relevant Pages

  • Re: Image storage - db vs filesystem (again)
    ... the table, and not make the same change to the filesystem, or vice-versa? ... Remember that even if you store the image in the database, ... that's a massive single backup task. ... servers, you have backup of the actual file data via redundancy (and you can ...
    (microsoft.public.sqlserver.programming)
  • Re: Please! Doesnt anyone know a better way to do this?
    ... account, they need to automatically be directed to the page to enter data ... session variable on the Account page. ... I assume here that you're checking a database when the user attempts to ... When a new user attempts to login or clicks to register, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Retrieving state information from a middle tier
    ... Now this very first call can make session root entry into an xml file like ... We have a middle tier which is made up ... > The current implementation only allows for one database to be served up. ... > longer use the middle tier as the source of the connection properties. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Horizontal scaling - advice needed
    ... the session can be unambiguously proxied to the right backend server, ... To start with have a single database machine. ... Full database clustering is challenging, but if your site is making you lots ... For transient session state, ...
    (comp.lang.ruby)
  • Re: VirtualPathProvider and Application Restart
    ... the session state to the Database Server and move a lot of lightweight ... to unload it from the AppDomain. ... When you update an ASPX file, ...
    (microsoft.public.dotnet.framework.aspnet)