Analysis and Practice of Redis Defragmentation Principle

[Abstract] One afternoon, a business suddenly came to me and said that after his cluster deleted a prefix, the time-consuming increased by 3 times. 60 million...

1. Weird time-consuming problem

The Redis platform provides various self-service work orders for deleting data (dozens of work orders per day)

  • delete all

  • delete by prefix

  • Delete by expiration time

  • delete by free time

  • delete by type

  • combinations of the above.

One afternoon, a business suddenly came to me and said that after his cluster deleted a prefix, it took 3 times more time. The work order is as follows: After deleting a prefix, the data volume changed from 290 million to 60 million .

To be honest, the momentary thought in my mind at the time was:

  • The business should refer to the time-consuming increase during deletion?

  • Will the time-consuming on the Redis side not increase after deletion? AOF and RDB are not opened either, and I feel that there is a problem with the description of the business.

  • Is there an exception in the business service? Judging criteria, I took a glance at the main calling service at that time. There were 20 services, and only 3 of them had decreased availability.

After quickly passing through the relevant indicators with doubts, the following conclusions were drawn:

  • It is true that after deleting the data, the time-consuming has increased by 3 times (avg: 1ms->3ms), and the overall process is fine during the deletion period.

Guess you like

Origin blog.csdn.net/weixin_70923796/article/details/130613713