Last post Jan 10, 2011 11:58 PM by sirdneo
Jan 06, 2011 02:27 AM|MuBo|LINK
We have a website in which we have implemented caching with static objects. We are not using asp.net Cache object. As soon as the user logs in for the first time, we get the details of all the users also and keep it a static object So that subsequent requests
will not have to hit the DB for the current and subsequent users as well. This is only one aspect how we are using the static objets, and we have many such scenarios with static objects. It all works fine with single server environment.
Now we are planning to move the website to a web farm. The problem is that every server will have its own copy of these static objects which are not synchronized. So the results would be unprectible. Please suggest solution for this scenario.
I have got stuck with this, Please help soon
Thanks in advance
Static objects As Cache
Jan 06, 2011 05:49 AM|singhmanish_888|LINK
Check this thread..you'll get the perfect answer for your question.
Jan 06, 2011 07:09 AM|MuBo|LINK
Thanks for the reply.
I went throuh the link. It provides valuable infor but does not provide the infor to soleve my problem.
My problem is I having static objects in the application, It all works well with a single server environment. But when I go for web farm, Each web server will have its copy of the static objects which are not synchronized.
The solution that I am looking for is how to synchronize these static objects accross the web servers.
Otherwise are there any alternatives.
Jan 06, 2011 09:34 AM|sachingusain|LINK
I think you should be looking at sticky sessions in a web farming scenario. That will ensure that a request from a particular user will always go to the same server.
Jan 07, 2011 01:58 AM|MuBo|LINK
I thought of this option but it does not work. Because The static objects are shred accross the users.
With sticky connections we wan ensure that the user is always connected to the same machine through out his/her session but We can not synchronize the static objects accross the servers
Jan 07, 2011 04:33 AM|sirdneo|LINK
I think you can use Velocity to solve your problem. Hereare the details which I copied from some site:-
Velocity is a distributed in-memory application cache platform for developing scalable, available, and high-performance applications. Velocity fuses memory across multiple computers to give a single unified cache view to applications. Applications can store
any serializable CLR object without worrying about where the object gets stored. Scalability can be achieved by simply adding more computers on demand. “Velocity” also allows for copies of data to be stored across the cluster, thus protecting data against
failures. Velocity can be configured to run as a service accessed over the network or can be run embedded with the distributed application. Velocity includes an ASP.NET session provider object that enables ASP.NET session objects to be stored in the distributed
cache without having to write to databases.
Jan 07, 2011 05:49 AM|maingi4|LINK
Long story short, you cannot share static objects across servers; outproc sessions is your best option to achieve the functionality that you are looking for. If the users need to share this data (basically its not user specific) you can then load the static
objects in each server from the DB (this would not work if users change their data).
If users changes data then you can refresh the cache/static variables in each server periodically (like we sometimes see the message "your changes might take some time to propogate to all servers").
Jan 07, 2011 06:32 AM|MuBo|LINK
Thanks for the replies
Velocity is a good option. But it works only with .net 3.5 and windows 2008 edit.
My application is in asp.net 2.0 and runs on windows 2003 edition.
I came accross "MemCached" , and exploring it.
Can any one provide thoughts choosing "MemCached" for solving this problem.
Jan 07, 2011 06:52 AM|sirdneo|LINK
If you want to use MemCached, then you first go through this article, it will guide you what are advantages/disadvantages of MemCached:-
Jan 10, 2011 11:34 PM|MuBo|LINK
Thanks for thr replies.
I have decided to go with memcached. It solves the problem
Can anyone please let me know what is the latest veriosn of memcached available for
windows platform and what is the official link to get it.
Thanks in advance.
Jan 10, 2011 11:58 PM|sirdneo|LINK
You can download it from here:-