Record of redis performance problems

Source: Internet
Author: User

Redis has been used online recently, and the query is not ideal. This query operation is a Lua script that includes the following operations:

The development machine redis has no other interference. The inserted zset has around 5000 member, and the redis client is spring-data, which is implemented by the underlying Jedis. In addition, it encapsulates a Layer

1. zrange Key 0 0 withscores

2. expire key

3. zadd key score Member

A. Results of the test 2800 Times found that the average time to get data each time requires 2.8 us (350 MS), that is, the QPS can only reach about

B. So the local test was conducted here, and the result was 300 US (0.3 MS) each call, about 10 times worse.

Use redis benchmark to test zadd on the local machine and the development machine. The test command is as follows:

A. Local Test

Redis-benchmark-Q-r 100000-N 100000 zadd sortedset 10 _ rand_int __
Zadd sortedset 10 _ rand_int __: 45475.22 requests per second

127.0.0.1: 6379> zcard sortedset
(Integer) 63381

About 22 us

B. Dev Machine Test

Redis-benchmark-H l-qproxy.tc.dev.cn6.qunar.com-P 6379-Q-r 100000-N 100000 zadd sortedset 10 _ rand_int __
Zadd sortedset 10 _ rand_int __: 25227.04 requests per second

Remote.dev.com: 6379> zcard sortedset
(Integer) 63118

About 40 us

At this point, we found that the gap between the two was not as big as we thought. Now we suspect that it is a problem with the Lua script. Replace the Lua script in the first test with the simple redis zrange Key 0 0 command and then test it.

A. Local Machine 137 us (0.1 MS)

B. Dev machine 2100 NS (2.1 MS)

It seems that the reason may be that the client write is poor. The connection is poor during remote connection, resulting in low efficiency.

 

Detailed Test Data

 

Unit: uslocal test 10 W zrangeno test1. elapsed: 7296558 count: 99999 AVG: 72mon elapsed: 7127632 count: 100000 AVG: 712. elapsed: 8026594 count: 99999 AVG: 80mon elapsed: 7843030 count: 100000 AVG: 783. elapsed: 8149801 count: 99995 AVG: 81mon elapsed: 8032342 count: 100000 AVG: 804. elapsed: 7961328 count: 99997 AVG: 79mon elapsed: 7820042 count: 100000 AVG: 78 test on borrow1.elapsed: 10842955 count: 99999 AVG: Average mon elapsed: 10710879 count: 100000 AVG: 1072. elapsed: 11232565 count: 99998 AVG: Average mon elapsed: 11130959 count: 100000 AVG: 1113. elapsed: 11353824 count: 99998 AVG: 113mon elapsed: 11224904 count: 100000 AVG: 1124. elapsed: 11005635 count: 99999 AVG: 110mon elapsed: 10868879 count: 100000 AVG: 108 Local test 10 W luano test1.elapsed: 25749403 count: 99998 AVG: 257mon elapsed: 25630396 count: 100000 AVG: 2562. elapsed: 25682824 count: 99997 AVG: 256mon elapsed: 25592035 count: 100000 AVG: 2553. elapsed: 26502975 count: 99997 AVG: 265mon elapsed: 26373153 count: 100000 AVG: 2634. elapsed: 50227904 count: 99997 AVG: 251mon elapsed: 50019605 count: 100000 AVG: 250 test on borrow1.elapsed: 30026344 count: 99998 AVG: 300mon elapsed: 29874080 count: 100000 AVG: 2982. elapsed: 56238052 count: 99998 AVG: 281mon elapsed: 56005620 count: 100000 AVG: 2803. elapsed: 84591577 count: 99998 AVG: 281mon elapsed: 84299240 count: 100000 AVG: 2804. elapsed: 112992770 count: 99993 AVG: 282mon elapsed: 112601651 count: 100000 AVG: 281dev redis 10 W zrangeno borrow test1.elapsed: 118723620 count: 99993 AVG: 1187mon elapsed: 118801299 count: 100000 AVG: 11882. elapsed: 248431698 count: 99993 AVG: 1242mon elapsed: 248271355 count: 100000 AVG: 12413. elapsed: 360073711 count: 99993 AVG: Average mon elapsed: 359465633 count: 100000 AVG: 11984. elapsed: 116067058 count: 99996 AVG: 1160mon elapsed: 115373200 count: 100000 AVG: 1153 test on borrow1.elapsed: 217290959 count: 94648 AVG: 2295mon elapsed: 291451989 count: 100000 AVG: 29142. elapsed: 214828993 count: 99996 AVG: 2148mon elapsed: 506368136 count: 200000 AVG: 25313. elapsed: 216495505 count: 100000 AVG: 2164mon elapsed: 722433027 count: 300000 AVG: 24084. elapsed: 216426804 count: 99996 AVG: 2164mon elapsed: 938483110 count: 400000 AVG: 2366dev redis 10 W luano borrow test1.elapsed: 139567804 count: 99928 AVG: 1396mon elapsed: 140374850 count: 100000 AVG: 14032. elapsed: 137681314 count: 99996 AVG: 1376mon elapsed: 278360257 count: 200000 AVG: 13913. elapsed: 138600259 count: 99995 AVG: 1386mon elapsed: 416537097 count: 300000 AVG: 13884. elapsed: 152433076 count: 99997 AVG: 1524mon elapsed: 568534621 count: 400000 AVG: 1421 test on borrow1.elapsed: 275491060 count: 86077 AVG: 3200mon elapsed: 458422068 count: 100000 AVG: 45842. elapsed: 245908497 count: 99989 AVG: 2459mon elapsed: 704242016 count: 200000 AVG: 35213. elapsed: 253036141 count: 99161 AVG: 2551mon elapsed: 967942699 count: 300000 AVG: 32264. elapsed: 251844305 count: 99965 AVG: 2519mon elapsed: 1219753868 count: 400000 AVG: 3049

 

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.