5

Our web app uses in-memory caching (Application Data Caching) to improve throughput such that frequently queried data does not have to be loaded from the database (SQL Server) for every request. Potentially, it will be deployed in a web-farm so we have to solve the classical problem of having to synchronize the caches of all nodes. So what we need is a distributed cache.

Readily available solutions are NCache and REDIS (and probably more). However, since we are already using SignalR Backplane to communicate changes to our dataset to a Windows Service (and browser clients), I'm wondering if it could be used to implement a distributed cache.

Doing so, we would (more or less) re-use our existing dataset-has-changed messages but subscribe to them in the web app itself to invalidate its cache. The upside being that we don't have to introduce a new library/technology.

I guess my biggest questions are: Does that make sense? And, is SignalR Backplane reliable enough to make sure no events get lost resulting in out-dated caches? Or is this architectural misuse?

Dejan
  • 9,150
  • 8
  • 69
  • 117
  • I have asked a related and more specific question here: http://stackoverflow.com/questions/36239434/how-reliable-is-signalr-backplane – Dejan Apr 28 '16 at 13:51

1 Answers1

2

Signalr is for realtime solution not for static.

In your solution, you will select data on one service, and you will send it to another service by backplane. Then what ? Probably you will save this to memory. What happens if one of the service has restarted ? Data will gone. You will never face this problem with redis. Additionally, you will consume your local memory for this data.

Also how you will manage expiration ? Plus you will make effort to implement this cache system with signalr.

I don't suggest you to use signalr backplane for this. Stick with Redis or smilar technologies.

Erkan Demirel
  • 4,302
  • 1
  • 25
  • 43
  • 1
    I'm not sending data from one service to another. I just want to leverage a system that *already* sends data-has-changed events. There would be only one more subscriber: the web app itself so it knows when to flush its cache. I'm not sure why you are saying it needs another technology to distribute messages? SignalR is doing that. – Dejan Mar 25 '16 at 12:10
  • Are you talking about signalr as a backplane or signalr Backplane ?. Signalr sending messages to clients or clients sending to servers. So in one server you send message to clients but if you want to get other servers clients this message signalr needs backplane. I wanted to say this. But if you are talking about signalr as a backplane this is not related with your question. – Erkan Demirel Mar 25 '16 at 13:29
  • I'm talking about SignalR Backplane as explained here: http://www.asp.net/signalr/overview/performance/scaleout-with-sql-server . In my understanding it helps me to spread messages across separate (IIS or Windows Service) processes. – Dejan Mar 25 '16 at 14:22
  • Yes it seperates messages between servers (signalr server). Anyway I will remove extra information if it makes the answer unclear. – Erkan Demirel Mar 25 '16 at 14:26