Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I use Redis as a cache for SQL Server?

I have got some tabular data that due to unrelated issues is proving too slow to get out of SQL Server in realtime. As we get more users this will only get worse so I am thinking of using Redis as a front-end cache to store users' tabular pageable data.

This data could become stale after about 10 minutes after which time I would like to get the record set again and put in in Redis.

The app is an .NET MVC app. I was thinking that when the user logs into the app this data gets pulled out of the database (takes around 10 seconds) and put into Redis ready to be consumed by the MVC client. I would put an expiry on that data and then when it becomes stale it will get refetched from the SQL Server database.

Does this all sound reasonable? I'm a little bit scared that:

  1. The user could get to the page before the data is in Redis
  2. If Redis goes down or does not respond I need to ensure that the ViewModel can get filled direct from SQL SErver without Redis being there
like image 567
Victoria Avatar asked Jan 30 '12 20:01

Victoria


1 Answers

I will go for Service stack redis implementation, here are all the details required. Redis is particularly good when doing caching in compare to other nosql. But if you are having high read - write application, I will insist to check out nosql database as database combined with SQL server. That will help in case of scalability.

Please let me know if any further details required. You just need to fire nuget command and you are almost up and running.

like image 183
kunjee Avatar answered Sep 25 '22 18:09

kunjee