Rıfat Erdem Sahin
Rıfat Erdem Sahin

Reputation: 1778

How to sync Redis with local memory cache?

My app (NopCommerce) uses cache service 50-150 times on each page request. When I implement the service with Redis it slows down the page loads.

I intended to cache results in memory and sync them with Redis. Is there any nuget packages or a project like this?

Upvotes: 4

Views: 1505

Answers (1)

Salakar
Salakar

Reputation: 6304

Can you give examples of how you're querying redis for cache purposes?

Redis isn't slow by nature, if something appears slow then you need to look at how you are running your transactions, so i'd say make sure you are using MULTI rather than doing 50-150 single redis transactions - you can move that all into one MULTI transaction request. Also check your redis client that you're using supports pipelining.

You'll run into issues running your own local caches in memory in your app, such as:

  • Multiple app instances all have different caches.
  • A lot of cache misses where one app server has something cached but another hasn't as the cache is localised to each instance only.
  • Effectively expiring caches without too much overhead on your app.

To name a few.

See http://skipperkongen.dk/2013/08/27/how-many-requests-per-second-can-i-get-out-of-redis/ for redis benchmarks, it really isn't slow, see the section about pipelining also.

Upvotes: 1

Related Questions