Clustering PHP : How to do it?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
bgundal88
Forum Newbie
Posts: 6
Joined: Thu Dec 22, 2011 10:42 am

Clustering PHP : How to do it?

Post by bgundal88 »

Dear developers,

I have a plan to host my PHP script in a server first, then adding more servers in the future when the users reach the limit. but there are lots of question popping in my mind such as :

1. if in the beginning the code was designed to be run in a single server, but later on this server is not 'strong' enough to handle the hits per day or number of users. Can I just buy the second server and put the code there?

by adding this new server into my DNS list, will it automatically handle the request? what if this code has 'session', such as 'login area'? how to make user 'stick' with the server one so that the 'session' not broken, while other user can be handled by server two?

2. I have read about Zend Server Cluster Manager, but the cost is too high, I think. Is there any affordable ways to do this clustering thing?

3. Also, I have information about Yii framework and how fast it is. but, I don't see Yii has some kind like Zend Server Cluster Manager. Is that mean if I have Yii code it will be difficult to be clustered?

thanks...
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Clustering PHP : How to do it?

Post by Christopher »

You can use memcache for sessions and load balance users across multiple servers.
(#10850)
bgundal88
Forum Newbie
Posts: 6
Joined: Thu Dec 22, 2011 10:42 am

Re: Clustering PHP : How to do it?

Post by bgundal88 »

Hi Chris,

Thanks for your reply, but I have more questions about memcache.

Let's say I have 3 servers and I have a plan to use this servers as following order :

Server 1 : database server only
Server 2 : web server only
Server 3 : memcache server only

In the future, if I have to buy another server, the fourth server will become web server and so on... In this scenario, database and memcache server are centralized.

Or alternatively :

Server 1 : database server only
Server 2 : web server + memcache server
Server 3 : web server + memcache server

In this second scenario I will use every new server as web and memcache server at the same time.

Which scenario do you think is better, chris? Thanks!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Clustering PHP : How to do it?

Post by Christopher »

Memcache is a distributed system, each node runs a daemon. So the second example is how it works.
(#10850)
Post Reply