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...
Clustering PHP : How to do it?
Moderator: General Moderators
- 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?
You can use memcache for sessions and load balance users across multiple servers.
(#10850)
Re: Clustering PHP : How to do it?
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!
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!
- 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?
Memcache is a distributed system, each node runs a daemon. So the second example is how it works.
(#10850)