Redis Supplements (Fri)

Source: Internet
Author: User

Blocking:

Redis is a typical single-threaded architecture that can be a nightmare for our applications if blocking occurs. The scenarios that cause blocking are broadly divided into intrinsic and extrinsic causes.

Intrinsic reason: Unreasonable use of API or data structure, CPU saturation, persistent blocking, etc.

External reasons: CPU competition, memory exchange, network problems, etc.;

The following two reasons are analyzed separately:

  • Intrinsic reasons
  1. Unreasonable use of API or data structure:
    1. For example, the execution speed of hgetall, such as the high data volume and the command algorithm complexity is O (n), is bound to be very slow, and the command to avoid using the algorithm complexity more than O (n) in the highly concurrent scenario wins.
    2. Redis Native provides a slow query statistics function, execute slowlog get {n} can get the most recent n slow query command, default more than 10ms will be recorded in the fixed-length queue, the online recommendation is set to 1ms.
    3. Modify the low-algorithm command, disable keys, sort, and so on, and resize the large object: Prevents too much data from being manipulated at one command. (Execution Redis-cli-h{ip}-p{port} Bigkeys can scan out large objects);
  2. CPU saturation:
  • External reasons

Redis Supplements (Fri)

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.