473,480 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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)? I'm thinking you could run it on multiple
computers, using the same filesystem, and there shouldn't be
problems...

any one tried it?

Oct 8 '05 #1
3 1563
>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
Oct 8 '05 #2
"www.douglassdavis.com" <do**@douglassdavis.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
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)? I'm thinking you could run it on multiple
computers, using the same filesystem, and there shouldn't be
problems...


The main issue with load-sharing the front end of any Web site is preserving
session information - that is, ensuring that when a client turns up
brandishing a particular PHP-allocated session ID in its HTTP request
header, the server is familiar with that ID and can retrieve the appropriate
session information from its repository.

There are three ways to go:

1. Don't use session-based stuff - if you want to preserve state in your Web
site, pass variables around in GET requests.
2. Store the session-based stuff in a centralised database/filestore that
every server shares.
3. Use a load balancer that is clever enough to load-share but send the same
visitor back to the same server each time.

Option 1 is a pain in the butt to implement, and makes the URL messy, but
perhaps surprisingly many big sites use it because what you lose in ease of
implementation, you gain in reliability (if a server goes down, it doesn't
matter, and the load balancer's task is made simpler than with option 3).
Option 2 is probably the least attractive, because the central
database/filestore becomes both a single point of failure and a potential
bottleneck. Option 3 is pretty good too, though if a server goes down the
clients connected to it will lose their sessions and have to start again.

D.
Oct 8 '05 #3
David Cartwright wrote:
"www.douglassdavis.com" <do**@douglassdavis.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
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)? I'm thinking you could run it on multiple
computers, using the same filesystem, and there shouldn't be
problems...


Yup, it scales really easily.

There are three ways to go:

1. Don't use session-based stuff - if you want to preserve state in your
Web site, pass variables around in GET requests.
2. Store the session-based stuff in a centralised database/filestore that
every server shares.
Actually, there are some options for storing shared information without
centralization. Cluster file systems are one way to go. Another which works
well for very large systems is to use sessionid addressing of the session
management systems (e.g. with N database servers, take the last few digits
of the sessionId - say 2345 - then the session information is stored on
server (2345 % N)). Since PHP allows you to write your own session handler
you can easily build your own solutions incorporating fault tolerance and
the storage substrate of your choice.
3. Use a load balancer that is clever enough to load-share but send the
same visitor back to the same server each time.


Doesn't work very well in practice. In addition to the loss of server
problem its not as easy as you might think to identify a client (ip address
can change mid session).

C.

Oct 8 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2257
by: Constandinos Mavromoustakis | last post by:
CFP: CLADE 2004-Challenges of Large Applications in Distributed Environments ------------------------------------------------- PhD student - Dept.Informatics at Aristotle University of...
1
6688
by: channa_s | last post by:
Hi, I would be very grateful if anyone could help me with the following. I want to create a SIMPLE distributed database. It is as follows: There is a institution which has branches all...
7
2361
by: Richard Maher | last post by:
Hi, I am seeking the help of volunteers to test some software that I've developed which facilitates distributed two-phase commit transactions, encompassing any resource manager (e.g. SQL/Server...
0
2423
by: DotNetJunkies User | last post by:
I am writing a distributed transaction code. My current scenario include a client database(Suppose client- having 4 main database) which can be installed anywhere which would connect to a public...
3
1827
by: Joris Dobbelsteen | last post by:
Dear, I have some considerations I need to take designing a distributed application (it's for a school project). Basically I'm looking for some reference or guidiance material/literature and...
1
2989
by: Rhino | last post by:
Is there any way to install the IBM Distributed Debugger V9.2 on Windows XP without first uninstalling DB2? I installed the IBM Distributed Debugger V9.2 on my Windows XP box in the hopes of...
2
3879
by: John Lee | last post by:
Hi, I have few questions related to .NET 2.0 TransactionScope class behavior: 1. Check Transaction.Current.TransactionInformation.DistributedIdentifier to identify if distributed transaction...
4
2800
by: tsui | last post by:
Dear all Someone say that past is Client/Server application, and now is distributed application, but i don't understand these terms Is it Client/Server application is mean two tiers, and only one...
5
1620
by: Martin Drautzburg | last post by:
Hello all, I've seen various attempts to add distributed computing capabilities on top of an existing language. For a true distributed system I would expect it to be possible to instantiate...
1
1793
by: nicky123 | last post by:
A distributed database is a specialization of distributed computing. A distributed database allows certain data specific operations to be distributed to one or more different machines. This means...
0
7051
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7054
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3003
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.