Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single Cache Object for Multiple Projects [closed]

I used .net cache object for a windows application.I built this cache object - while loading the app. This helps us to gain performances. Everything was working OK.

Because of this success, we started implementing this caching mechanism in every other applications ; windows , service, web etc. They all are using same cache objects - but every application has a copy of its own.

In one server, we had 40 applications hosted. All of them are using Cache object. But they have their own copy of cache object. Size of one cache object is 100 MB. Serve's memory consumption is 40*100 MB. We had to upgrade ( increase memory) the server to support the applications hosted in that server.

I need help to review the approach I am following. All of my applications ( services, web , windows) are in need of same cached object. How can I design my applications to support that? Is there any tools out there to handle this type of situations?

like image 386
Pratap Das Avatar asked May 27 '26 09:05

Pratap Das


2 Answers

You need to look into a distributed cache, like redis (for which there are some nice .net client libraries, like StackExchange.Redis.)

NCache or Dache or others, personally I have only used Redis.

Note, that distributed caching comes with its own set of problems and issues to look out for. For example it is generally "slower" since you have to marshal and send the cache objects to the out-of-process cache process. And your data has to be "serializable" in the first place (strings are of course the easiest thing from that perspective).

Also consider advanced failure scenarios, for example what happens when the out-of-process cache is not reachable or even down? Something like that cannot happen when you simply cache in process.

like image 105
Christian.K Avatar answered May 30 '26 04:05

Christian.K


Use NCache (Open Source or Enterprise version) and check the topologies of how you can store cached objects and avoid failovers. It is meant for scalability therefore if your applications do increase in the future, you could add more servers at runtime.

Redis in my opinion comes with its own set of problems and here is a small piece for you

Full Disclosure: I work for NCache so ask away any question you have, i'll be happy to assist.

like image 27
Basit Anwer Avatar answered May 30 '26 05:05

Basit Anwer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!