Recently, due to the development of the company's business MySQL write has become a bottleneck, of course, there are also plans to continue to optimize, such as sub-database tables, memory tables and so on, but higher costs, such as memory consumption, aggregation operations ...
Redis is said to be strong in write performance, measured 14w/s (list linked list), and later support scale-out
Use of Redis
Multiple instances to give full play to Redis performance on a single server
<?PHP$REDIS80 = new Redis (), $redis->pconnect (' 127.0.0.1 ', 6380); $redis->auth (' Your Passwrod '); $redis Bayi = new Redis (); $redis->pconnect (' 127.0.0.1 ', 6381); $redis->auth (' Your Passwrod ');
2.redis pipeline, batch processing data boost efficiency
<?php//the data to be processed into the array $data=array (' A ' =>1, ' B ' =>2, ' C ' =>3);//pipeline$redis80->pipeline (); foreach ($ Data as $k = = $v) {$redis 80->set ($k, $v);} $redis 80->exec ();
3. Try to avoid the cut-off operation, the performance is very expensive, with the use of data types, such as I use a string to index the list to meet the needs of complex operations
How Redis is used and how it feels