You do not want to use multiple databases in a single instance of redis. It is outdated and, as you noted, several instances allow you to take advantage of several cores. If you use database selection, you will have to reorganize it when upgrading. Monitoring and managing multiple instances is not complicated and painful.
In fact, you will get much better performance for each db by instance-based segregation. Each instance would have statistics that reflect this data segment, which can provide better tuning and more flexible and accurate monitoring. Use the latest version and separate your data by instance.
As Jonathon said, do not use the keys command. If you simply create a key index, you will get much better performance. When adding a key, add the key name to the set. The key command is not very useful as soon as you zoom in, since it takes a considerable amount of time to return.
Let the access template determine how to structure your data, and not store it the way you think it works, and then work on how to access it and continue it later. You will see much better performance and often find that code consuming data is much cleaner and simpler.
For single threads, consider redis designed for speed and atomicity. Confident actions that modify data in one db should not wait for another db, but what if this action is stored in a dump file or processes transactions on slaves? At this point, you begin to fall into the weeds of concurrency programming.
Using multiple instances, you turn multi-threaded complexity into a simpler messaging style system.
The Real Bill Apr 26 '13 at 19:26 2013-04-26 19:26
source share