how are scale and replication related? replication is more for robustness 
and some how HA.

Usual setup is number of front end servers (php in your case), number of 
memcached servers, db, etc. You can colocate of course but i am not sure 
that this is good idea (memcached keeps everything in memory and php is 
memory hungry, plus in this setup you will logout everybody if you need to 
update memcached or server).

to prevent logout there is approach named poor man high availability: just 
do set on both memcached (it is fast) and get on one (and repeats on second 
if cache miss). Memcached is fast and this double work usually invisible.

in you case you still can initialize pecl php memcached with both servers:
Memcached::addServers and when you set or get pecl extension will use some 
hashing algo to distribute data to one of the servers. As i said I would 
not recommend this but this depends on business goals.

And ... you can switch to Redis that supports replication but has own 
limitations and issues related to it.


On Tuesday, June 16, 2015 at 2:50:27 PM UTC-7, MaxP wrote:
>
> Hello.
>
>
>  will like to know how memcached manage cache for php sessions i mean. I 
> would like to design a php app that scale out and in each http-PHP server 
> include a memcached layer for (db,app cache and session caching), but if 
> memcached dont replicate de data when a user come to webserver1 don't see 
> the same session in webserver2.
>
>
>
> <https://lh3.googleusercontent.com/-qWFK_3AD6bg/VYCZ7nnK7FI/AAAAAAAANmI/WQzL0_Laqmw/s1600/php%2Bstack.png>
>
>
>
>
> memcached1 and memcached2 need to be replicated to handle php sessions 
> thanks in advance.
>
> regards.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to