ServiceStack Redis - caching expensive queries

Mark

We have a number of really expensive queries, which involve multiple joins, which I would like to cache using Redis (using the ultimate ServiceStack.Redis framework).

How many rows/items should I be storing in Redis before memory becomes an issue? e..g can I store 10 000+ rows into Redis without worrying about memory issues (our server, which also hosts our web app has 8Gb Ram).

Secondly, what is the best way of storing them (as List or Hash?).

Liviu Costea

For the number of rows it depends on the row size. The best approach would be to start saving and see the memory usage on the Redis server. 10k doesn't sound like too much data.

On how to store them I would use a Hash only if I need to retrieve specific rows, for example if I would do the filtering and sorting in Redis, which theoretically is possible. But most likely filtering and sorting of the results is done in your app so you can keep all that data in one key only. What we did in our app is serialized all the results in json, archived them in code and then saved to a simple key Redis and this gave the smallest memory consumption.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related