views:

87

answers:

2

We having been using multiple webservers for our cakephp application,

server architecture

now the problem is there are two cache directories , server 2 is clearing his cache before doing any insertion in his database. BUT server 1 doesn't know the about the database has been changed , so server 1 cached is not cleared

When new web request comes to server 2 , he creates new cache files and return good results. BUT when it comes to server 1 , he show same old results :( .

I wonder is there any way we can share the cache directory among various physical servers, without compromising with performance.

We may increase the web servers, so please recommend good long term solution for this

Thanks for reading

+2  A: 

I would look into using Memcache as for your caching mechanism. You can set up the Memcache daemon (memcached) on one server and then connect both servers to the one cache. See the core.php for set up details. Of course you will also have to install the memcache php ext and the daemon, but it will be worth it.

bucho
+1, becoz memcached served my purpose and it come pre-integrated with cakephp framework.
Ish Kumar
+1  A: 

Easiest way would be setting up the cache directory to be served from an nfs (file) server. You wouldn't have to change anything else.

For performance i'd also stick to Memcache as bucho said, but it will likely require you to change your application code.

Karsten
+1 , for alternate solution
Ish Kumar