Redis: Performance comparison with SQL!!!

552 views
Skip to first unread message

sreeram.r...@outlook.com

unread,
Nov 27, 2015, 9:02:09 AM11/27/15
to Redis DB
Hi All,

In our application, we're working to implement Redis as caching data-store and SQL for database.

1. Our application is domain-driven model.
2. Previously we were caching domain objects using app. server's In-memory (application servers was not distributed then).
3. Now we're implementing distributed architecture for our app. servers, so we're using Redis(1 master & 2 slaves) for centralized caching for all app. servers.

How we've implemented Redis,
1. I'm using StackExchange.Redis as our .Net client.
2. When a domain object has to be cached, I'm serializing(NetSerialization) entire domain object as RedisValue and caching the same.

Now when I do Load testing(50,000 iterations) for Redis comparing with SQL fetching the same domain object,

Avg. Time to retrieve from SQL   : 12.00949734 milliseconds
Avg. Time to retrieve from Redis : 9.418295734 milliseconds

Questions:
1. Difference of just 3 milliseconds between SQL & Redis, is it normal?! 
2. Is my requirement suitable Use case for Redis ?

Marc Gravell

unread,
Nov 27, 2015, 1:16:26 PM11/27/15
to redi...@googlegroups.com

There are a lot of variables here that make it very hard to generalise, for example:

- how big is the data (and keys)?
- is the time being dominated by serialization/deserialization? (if so, I can recommend a few other serializers :p)
- what does the test code look like? is it actually optimal?
- is the server load representative? (a single-threaded test loop over an otherwise silent database is good for repeatable numbers, but doesn't actually tell you much about real load)

Personally, assuming my servers are local to each-other, and the payloads aren't big: I'd expect lower numbers than that - based on my real world usage.

Do you have a test rig I can look at?

Marc

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Marc Gravell

unread,
Nov 27, 2015, 1:17:39 PM11/27/15
to redi...@googlegroups.com

Oh, and yes: that scenario is one of the things that is usually pretty expensive for SQL server and cheap for redis.

Finally, you haven't indicated your redis config - is it configured for persistence, for example? (Usually not required in a cache server)

Reply all
Reply to author
Forward
0 new messages