That should handle your read scaling needs very well.
I would almost suggest writing your own custom server, but since your
set sizes are vastly different (a friends list vs. all online users),
that may not be reasonable.
As an alternative to always doing set intersections:
1. When a user X logs on, you intersect their friends set with the
online users to get their initial online set, and you keep it with a
Y-minute TTL (any time they do anything on the site, you could update
the expire time to be Y more minutes into the future)
2. For every user in that 'online' set, you find their similar
'initial set', and you add X to the set
3. Any time a user Z logs out, you scan their friends set, and remove
Z from them all (whether they exist or not)
With that change, you only do the relatively expensive set
intersection once during login, and the other parts (update friends'
sets on login/logout) can be done in a lua script, and should be
significantly faster (overall) than having to re-intersect for the
friends lists. The semantics of this makes it possible to still use
the master/slave setup for the set intersections, with a different
single Redis server to keep the up-to-date 'who of my friends are
online' sets.
As a point of comparison, on my Core 2 duo 2.4ghz desktop, I'm able to
perform some 61k "SADD <key> <20 values>" operations/second across 5
clients. Basically, as long as you have fewer than 61k login/logout
actions happening every second, a fairly modest box could be kept
reasonably up to date without issue, with a master and supporting
slaves to handle the initial set intersections.
Regards,
- Josiah
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/redis-db/-/XEDiOfmqkIIJ.
>
> To post to this group, send email to
redi...@googlegroups.com.
> To unsubscribe from this group, send email to
>
redis-db+u...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/redis-db?hl=en.