How Redis is used and how it feels

Source: Internet
Author: User
Tags pconnect

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

    1. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.