high performance
Assume such a scenario, you have an operation, a request came, all kinds of mess you Hangchikengchi action queries mysql, check out half a result, time-consuming 600ms. But the results may not become the next few hours, or can be changed without immediate feedback to the user. So this time I supposed to?
Cache ah, toss the result of 600ms check out, throw cache, a key corresponding to a value, the next time someone check the same data, do not go mysql toss a 600ms. Taken directly from the cache, through a check out a key value, 2ms get. 300 times performance increase.
This is called high performance.
High concurrency
mysql database so heavy, simply did not designed to allow you to play high concurrent, although you can also play, but natural support is not good. mysql single 2000qps started easily supported to the police.
So to combine the scene and maybe think about it, why do you use the cache?
problem analysis
The difference between (1) redis and the memcached
Cluster mode : memcached cluster no native mode, you need to rely on the client to write data to achieve the cluster carved pieces; but redis currently is native support for cluster mode.
Memcached is multi-threaded, non-blocking IO network model reuse; Redis use single-threaded multi-channel multiplexed IO model
(2) Why redis single-threaded model can efficiently so high?
1) Pure memory operation
2) The core is based on the non-blocking IO multiplexing mechanism
3) single-threaded instead to avoid the frequent context switching multithreading issues (Baidu)