Article Directory
- Command
- [Recommended] O (N) N is the number of commands attention
- [Recommended] Disable command
- [Recommended] the rational use of select
- [Recommended] use batch operations to improve efficiency
- [Proposed] Redis transaction function is weak, is not recommended to use too much, you can substitute with lua
- Clients use
- [Recommended] to avoid multiple applications using a Redis instance
- With the database connection pool, it can effectively control the connection while improving efficiency
- other suggestion
Command
[Recommended] O (N) N is the number of commands attention
For example hgetall, lrange, smembers, zrange, sinter and other use is not impossible, but the value of N need to be clear. There needs to traverse can use hscan, sscan, zscan instead.
[Recommended] Disable command
Prohibiting the use of the line keys, flushall, flushdb like ban rename mechanism redis command, or using the scan
mode progressive process.
[Recommended] the rational use of select
redis multi-database is weak, the use of numbers to distinguish between, a lot of client support is poor, while the single-threaded or multi-service real multi-database processing, there will be interference.
[Recommended] use batch operations to improve efficiency
Native Command: eg mget, mset.
Non-native command: You can use the pipeline to improve efficiency
Note that the number of control but a batch operation elements (e.g. less than 500, and also the actual number of bytes of the relevant elements).
pipeline vs Native Command
- Native command is atomic, pipeline operations are non-atomic.
- pipeline can be packaged in different orders, native can not do
- pipeline requires the client and server support both
[Proposed] Redis transaction function is weak, is not recommended to use too much, you can substitute with lua
Clients use
[Recommended] to avoid multiple applications using a Redis instance
Positive examples: irrelevant split the business, doing public service of data.