WO2023241742A1 - Redis-based performance adjustment method and apparatus, electronic device and medium - Google Patents

Redis-based performance adjustment method and apparatus, electronic device and medium Download PDF

Info

Publication number
WO2023241742A1
WO2023241742A1 PCT/CN2023/112963 CN2023112963W WO2023241742A1 WO 2023241742 A1 WO2023241742 A1 WO 2023241742A1 CN 2023112963 W CN2023112963 W CN 2023112963W WO 2023241742 A1 WO2023241742 A1 WO 2023241742A1
Authority
WO
WIPO (PCT)
Prior art keywords
redis
query
queue
requirements
preset
Prior art date
Application number
PCT/CN2023/112963
Other languages
French (fr)
Chinese (zh)
Inventor
莫磊
宋晨川
刘政五
周圆
蔡璧鸿
宋立平
黄则鸣
Original Assignee
顺丰科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 顺丰科技有限公司 filed Critical 顺丰科技有限公司
Publication of WO2023241742A1 publication Critical patent/WO2023241742A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/24569Query processing with adaptation to specific hardware, e.g. adapted for using GPUs or SSDs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application relates to the field of logistics technology, and specifically to a redis-based performance adjustment method, device, electronic equipment and media (computer storage media).
  • redis has two available operations for querying the Redis database: non-pipeline and pipeline operations.
  • non-pipeline query of the Redis database has low query efficiency when dealing with high concurrency
  • pipeline query of the Redis database query efficiency is improved when dealing with high concurrency, but it requires waiting for all query operations in the entire pipeline to be completed, and then matching all results to the pipeline one by one before finally returning all results, which also takes a certain amount of time.
  • the performance of the redis service itself is very high and the delay of a single request to redis can be ignored, when the number of requests is large, such as tens of thousands or even hundreds of thousands of times per second, the tiny network delay will slow down the whole thing. , causing the overall performance of redis to decrease.
  • This application provides a performance adjustment method, device, equipment and computer storage medium based on redis, aiming to solve the existing technical problem that when there are many redis requests, a small delay will slow down the whole, resulting in a reduction in the overall performance of redis.
  • this application provides a redis-based performance adjustment method.
  • the redis-based performance adjustment method includes the following steps:
  • each query request in the query queue into a communication pipeline and submit it to the redis;
  • the method includes:
  • Control a preset time wheel to allocate a timeout to the query queue, and control the query queue to apply for an expiration notification channel from the time wheel;
  • receiving the query results fed back by the redis based on the communication channel, and determining whether the system performance of the redis meets the requirements based on the response time associated with the query results includes:
  • the timeout corresponding to the expiration notification and/or the queue information of the query queue is adjusted until the system performance of redis meets the requirements.
  • Requirements include:
  • the new average delay does not exceed the preset delay threshold, it is determined that the system performance of redis meets the requirements, including:
  • the timeout period corresponding to the expiration notification and the number of queues in the query queue will be adjusted in reverse Or the queue length of the query queue;
  • the allocation of redis query requests to preset query queues includes:
  • the query requests of the request number are allocated to each of the query queues.
  • the method before allocating the redis query request to a preset query queue, the method includes:
  • the average delay is set as the initial timeout time of the expiration notification, and the queue number and the queue length are set as the initial queue information of the query queue.
  • the redis-based performance adjustment device includes:
  • Distribution module used to distribute redis query requests to preset query queues
  • An assembly module configured to assemble each query request in the query queue into a communication pipeline and submit it to the redis if the query queue receives an expiration notification
  • a determination module configured to receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
  • An adjustment module configured to adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue if the system performance of the redis does not meet the requirements until the system performance of the redis meets the requirements.
  • this application also provides an electronic device, which includes:
  • processors one or more processors
  • One or more application programs wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the steps in the redis-based performance adjustment method.
  • this application also provides a computer storage medium on which a computer program is stored, and the computer program is loaded by the processor to execute the steps in the redis-based performance adjustment method.
  • the redis-based performance adjustment method includes: allocating redis query requests to preset query queues; if the query queue receives When receiving an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis; receive the query results fed back by the redis based on the communication pipeline, and provide a response associated with the query results.
  • Figure 1 is a schematic scenario diagram of the redis-based performance adjustment method provided by the embodiment of this application.
  • Figure 2 is a schematic flow chart of an embodiment of the redis-based performance adjustment method in the embodiment of the present application
  • Figure 3 is a schematic flow chart of an embodiment of redis query expiration notification in the redis-based performance adjustment method provided in the embodiment of this application;
  • Figure 4 is a schematic diagram of a specific scenario of the redis performance adjustment system in the redis-based performance adjustment method provided in the embodiment of this application;
  • Figure 5 is a schematic flow chart of one embodiment of parameter adjustment in the redis-based performance adjustment method provided in the embodiment of this application;
  • Figure 6 is a schematic flowchart of an embodiment of query request allocation in the redis-based performance adjustment method provided in the embodiment of this application;
  • Figure 7 is a schematic flowchart of an embodiment of initial parameter configuration in the redis-based performance adjustment method provided in the embodiment of this application;
  • Figure 8 is a schematic structural diagram of an embodiment of the redis-based performance adjustment device provided in the embodiment of this application.
  • FIG. 9 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
  • first and second are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features.
  • features defined as “first” and “second” may explicitly or implicitly include one or more of the described features.
  • “plurality” means two or more than two, unless otherwise explicitly and specifically limited.
  • the embodiments of this application provide a performance adjustment method, device, equipment and computer storage medium based on redis, which will be described in detail below.
  • the redis-based performance adjustment method in the embodiment of the present invention is applied to the redis-based performance adjustment device.
  • the redis-based performance adjustment device is provided in an electronic device.
  • the electronic device is provided with one or more processors, memories, and one or more An application program, wherein one or more application programs are stored in the memory and configured to be executed by the processor to implement the redis-based performance adjustment method;
  • the electronic device may be a terminal, for example, a mobile phone or a tablet computer, and the electronic device may also be It is a server or a service cluster composed of multiple servers.
  • Figure 1 is a schematic diagram of a scenario of a redis-based performance adjustment method in an embodiment of the present application.
  • the redis-based performance adjustment scenario includes an electronic device 100 (the electronic device 100 is integrated with redis-based performance Adjustment device), the computer storage medium corresponding to redis-based performance adjustment is run in the electronic device 100 to perform the steps of redis-based performance adjustment.
  • the electronic equipment in the redis-based performance adjustment scenario shown in Figure 1 or the devices included in the electronic equipment do not constitute a limitation to the embodiment of the present invention, that is, the redis-based performance adjustment scenario included in The number and type of equipment, or the number and type of devices included in each device do not affect the overall implementation of the technical solutions in the embodiments of the present invention, and can be counted as equivalent replacements or derivatives of the technical solutions claimed in the embodiments of the present invention.
  • the electronic device 100 is mainly used to: allocate redis query requests to a preset query queue; if the query queue receives an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis; receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results; if the redis system If the performance does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of the redis meets the requirements.
  • the electronic device 100 may be an independent electronic device, or may be an electronic device network or an electronic device cluster composed of electronic devices.
  • the electronic device 100 described in the embodiment of the present invention includes, but is not limited to A computer, a network host, a single network electronic device, a set of multiple network electronic devices, or a cloud electronic device composed of multiple electronic devices.
  • cloud electronic equipment consists of a large number of computers or network electronic equipment based on cloud computing (Cloud Computing).
  • the application environment shown in Figure 1 is only an application scenario with the solution of the present application and does not constitute a limitation on the application scenarios of the solution of the present application.
  • Other application environments may also include those shown in Figure 1 Show more or less electronic devices, or the network connection relationship of electronic devices.
  • only one electronic device is shown in Figure 1.
  • the redis-based performance adjustment scenario can also include one or more other electronic devices.
  • the specific device is not limited here; the electronic device 100 may also include a memory.
  • the electronic device 100 can be equipped with a display device, or the electronic device 100 is not provided with a display device to communicate with the external display device 200.
  • the display device 200 is used to output the redis-based information in the electronic device.
  • the electronic device 100 can access the backend database 300 (the backend database can be in the local storage of the electronic device, and the backend database can also be set in the cloud).
  • the backend database 300 stores information related to performance adjustment based on redis.
  • FIG. 2 is a schematic flow chart of an embodiment of the redis-based performance adjustment method in the embodiment of the present application.
  • the redis-based performance adjustment method includes steps 201-204:
  • the redis-based performance adjustment method in this embodiment is applied to electronic equipment.
  • the type of electronic equipment is not specifically limited.
  • the electronic equipment can be a terminal or a server.
  • a server is used as an example for explanation.
  • the server receives the query request, where the query request can be actively triggered by the user. For example, the user clicks the "Data Query" button on the display interface of the mobile phone terminal to actively trigger the query request.
  • the mobile terminal sends the query request to the server, and the server receives the user's trigger.
  • Query request can also be automatically triggered by the server.
  • the trigger condition of the query request is preset in the server: the query request is automatically triggered when the data is updated.
  • the server collects the data update information of the database in real time. The server detects When the database is updated, the server automatically triggers a query request.
  • the server parses each query request through the query service module and extracts the query request for redis in the query request. Among them, the query service module parses the command in the query request and extracts the key command for the redis query.
  • the query service module will The query for redis is decomposed into the first key command key1, the second key command key2, the third key command key3... and so on.
  • the query service module applies for the result notification pipelines ch1, ch2, ch3... for these key commands respectively, and then Query requests to redis are evenly distributed into the preset query queues; among them, the preset query queues, the number of queues, and the queue length of the preset query queues can be flexibly adjusted.
  • the way in which the query service module in the server allocates the redis query request to the preset query queue is not specifically limited.
  • implementation method 1 the query service module allocates the query request to the query queue in sequence, so that the query requests in each query queue are The number of query requests is relatively average, which improves the execution efficiency of query requests;
  • implementation method two the query service module obtains the queue data and queue length threshold of the query queue, as well as the number of query requests. For example, the number of queues in the query queue is 2, and the query The queue length threshold of the queue is 500. The query service module obtained that there were 600 query requests for redis. The query service module evenly distributed the 600 query requests to the two query queues.
  • the server evenly distributes redis query requests to the query queue, which can improve the efficiency of redis queries and accurately record the response time of the query requests.
  • the query queue applies for a result notification pipeline for each query queue.
  • the query result of the query request can be fed back through the result notification pipeline; if it is preset If the query result of the query request fed back by the result notification pipeline is not received at the time, the server generates an expiration notification and sends it to the message queue.
  • each query request in the query queue into a communication pipeline and submit it to the redis.
  • the server controls to assemble each query request in the query queue into a communication pipeline (pipeline, where pipeline refers to cutting a thing that needs to be done repeatedly into different stages, each stage consists of independent
  • the unit is responsible; all objects to be executed enter the job queue in turn. Except for a period of time at the beginning and end, each unit is served simultaneously at any time) and submitted to the redis; that is, the server processes each query request in the query queue.
  • Association for example, for three instructions: Query Request 1, Query Request 2 and Query Request 3, after combining the three query instructions to form a pipeline, submitting them to redis can improve query efficiency.
  • the server After the server detects that each query request in the pipeline feeds back the query results, it will write the final query results to the result notification pipeline corresponding to the query queue. At this time, the server will receive the query results and send a response message to the corresponding query request. .
  • the server receives the query results fed back by redis based on the communication pipeline, and obtains the response time associated with the query results.
  • the server determines whether the system performance of redis meets the requirements based on the response time carried by the query results.
  • the specific implementation method is not limited, for example,
  • Implementation method 1 The server determines whether the system performance of redis meets the requirements based on the average delay of redis, including:
  • the server receives the query results fed back by redis based on the communication pipeline, and the server obtains the response time associated with the query results; the server calculates the average delay of redis based on the response time associated with each query result; that is, the query service module in the server carries The time information, as well as the time information carried by the query result corresponding to the query request, is used to calculate the response time of the query result; the server accumulates the response time of each query request and averages it to obtain the average delay of redis; the server calculates the average delay of redis Compare the delay with the preset delay threshold, where the preset delay threshold is the delay time set by the user according to expectations.
  • the preset delay threshold is set to 0.5s; if the average delay does not exceed the preset time If the delay threshold is exceeded, it is judged that the system performance of redis meets the requirements and no performance optimization is required; if the average delay exceeds the preset delay threshold, it is judged that the system performance of redis does not meet the requirements.
  • Implementation method two the server determines whether the system performance of redis meets the requirements based on the query rate of redis per second, including:
  • the server receives the query result fed back by redis based on the communication channel, and the server obtains the response time associated with the query result; the query service module counts the response time associated with each query result, and calculates the query rate per second of redis; the query service module calculates the query rate per second of redis Compare the query rate with the preset query rate.
  • the preset query rate is the request number threshold set by redis based on the actual processing situation. For example, the preset query rate is set to 100,000 per second; if the query rate per second exceeds the preset query rate, it is determined that the system performance of the redis meets the requirements, and performance optimization is not required; if the query rate per second does not exceed the preset query rate, it is determined that the system performance of the redis does not meet the requirements.
  • the server determines whether the system performance of redis meets the requirements based on the query results fed back by redis based on the communication pipeline and the response time associated with the query results. In this way, the performance of redis can be accurately evaluated and the system performance of redis can be further evaluated.
  • the server will adjust the timeout time corresponding to the expiration notification and/or query the queue information of the queue.
  • the queue information includes the queue length and the number of queues.
  • the server can select the ultrasonic time, queue length and queue number to be at least One is adjusted until the system performance of redis meets the requirements.
  • the redis query request is allocated to a preset query queue; if the query queue receives an expiration notice, each query request in the query queue is assembled into a communication channel and submitted to the redis ; Receive the query results fed back by the redis based on the communication channel, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results; if the system performance of the redis does not meet the requirements, adjust The timeout time corresponding to the expiration notification and/or the queue information of the query queue is used until the system performance of redis meets the requirements; in the embodiment of the application, the server can obtain whether the redis system appears based on the response time associated with the query request.
  • redis system performance meets the requirements; if the redis system performance does not meet the requirements, dynamically adjust the corresponding timeout time of the redis system and/or the queue information of the query queue, so that the redis system meets the user expectations
  • the time feedback results make the system performance of redis meet the requirements. In this way, there is no need to increase the hardware structure of the redis system or manual intervention. Through simple parameter adjustment, the system performance of redis can be improved.
  • Figure 3 is a diagram of the redis query expiration notification in the redis-based performance adjustment method provided in the embodiment of this application.
  • step 202 if the query queue receives an expiration notification, the server assembles each query request in the query queue into a communication pipeline and submits it to the redis.
  • the server pre-constructs redis
  • the front-end performance adjustment system performs expiration notification through the performance adjustment system, specifically including steps 301-303:
  • FIG. 4 is a schematic diagram of a specific scenario of the redis performance adjustment system in the redis-based performance adjustment method provided in the embodiment of this application. As shown in Figure 4, the performance adjustment The system includes control service module, query service module, time wheel and chan pipe reuse pool, etc.; among them,
  • the control service module is used to: 1. Receive the expected delay set by the user; 2. Pull the average time consumption of the query request through the query service module; 3. Adjust according to the dependency time of the query request, where the adjusted parameters include the timeout time , queue length and queue number;
  • the query service module is used to: receive the query request, parse the query request, extract the query request for redis in the query request, and adjust the query request for redis into key commands and then assign them to the query queue;
  • the time wheel is used to: monitor the response time of query requests in each query queue. If the response time of the query request in the query queue exceeds the timeout, the time wheel will send a timeout notification to the query queue;
  • the chan pipeline reuse pool is used to notify the pipeline according to the results of the redis query request application to reduce system memory consumption.
  • the query queue is used to control the concurrency of redis requests and the number of query requests packaged for each request.
  • the structure of the performance adjustment system is not limited. Those skilled in the art can set more or fewer processing modules according to specific usage conditions. In this embodiment, for the convenience of understanding, the above performance adjustment system is taken as an example for explanation. .
  • the preset time wheel in the server allocates the timeout time T to the query queue, and at the same time controls the query queue to apply for the expiration notification channel to the time wheel, through The expiration notification pipeline notifies whether the execution of the query request in the query queue exceeds the timeout period T.
  • the number of query queues is not specifically limited. For example, there can be at least two query queues.
  • the time wheel monitors the response time of query requests in the query queue in real time. When the time wheel detects that at least two query queues exceed the timeout time, then Get the queue ID of the query queue that has exceeded the timeout period.
  • the time wheel sends an expiration notification to the query queue corresponding to the queue identifier through the expiration notification pipeline, so that the query queue receives the expiration notification, and the server assembles each query request in the query queue into a communication pipeline and submits it to the redis.
  • the query service module will decompose the redis query in multiple requests into key1, key2, key3..., and notify the pipelines ch1, ch2, ch3... of the application results for these keys respectively, and then They are evenly distributed into M query queues.
  • the maximum length of each queue is N.
  • Each queue will apply for an expiration notification pipeline from the time wheel. If multiple queues apply for the expiration notification pipeline, they will be reused.
  • the time wheel will assign a timeout time T to a query queue at a certain moment, and notify the queue through the pipeline when it expires.
  • a queue receives an expiration notification, it will assemble all the keys to be queried in the queue into a pipeline, submit a query request to redis, and apply for a new expiration notification pipeline to the time wheel to prepare for the next round.
  • a performance adjustment system is set up in front of redis, and expiration notification is provided through the performance adjustment system. This can achieve good monitoring of the query request time.
  • the query method of redis is determined based on the response time of the query request in the query queue, which can improve redis The query rate further ensures the system performance of redis.
  • Figure 5 is a parameter adjustment in the redis-based performance adjustment method provided in the embodiment of the present application. Flow diagram of the embodiment.
  • step 204 if the system performance of redis does not meet the requirements in step 204, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of redis meets the requirements.
  • steps 401-403 specifically including steps 401-403:
  • the server obtains the timeout corresponding to the expiration notification, the number of queues in the query queue, and the queue length of the query queue.
  • the server can control one quantity to remain unchanged and adjust the other two. For example, the server controls the expiration notification. If the corresponding timeout period remains unchanged, adjust the number of queues in the query queue and the queue length of the query queue; or the server controls the queue length of the query queue to remain unchanged and adjust the number of queues in the query queue and the timeout period corresponding to the expiration notification.
  • the server distributes the new redis query request to the adjusted query queue; if the query queue receives the expiration notification again, the server assembles each query request in the query queue into a communication pipeline and submits it to redis.
  • the server receives new query results fed back by redis based on the communication channel, and the server obtains the response time associated with the new query results.
  • the server accumulates the response times of each query request and averages them to obtain a new average delay; the server Compare the new average delay with the preset delay threshold.
  • the preset delay threshold is the delay time set by the user according to expectations. For example, the preset delay threshold is set to 0.5s; if the new average delay If it does not exceed the preset delay threshold, it is determined that the system performance of the redis meets the requirements, and performance optimization is not required; if the new average delay exceeds the preset delay threshold, it is determined that the system performance of the redis does not meet the requirements. Then continue to make adjustments.
  • the server further detects other performance parameters of redis to make the system performance of redis meet the requirements; specifically, it includes:
  • the server obtains the CPU occupancy rate and memory occupancy rate of redis; the server compares the CPU occupancy rate and memory occupancy rate of redis with the preset occupancy threshold value respectively.
  • the preset occupancy threshold refers to the critical value that affects redis performance, for example, the preset occupancy threshold is set to 80%.
  • the CPU occupancy rate of redis exceeds the preset occupancy threshold, or the memory occupancy rate of redis exceeds the preset occupancy threshold, then reversely adjust the timeout corresponding to the expiration notification, the number of queues in the query queue, or the query The queue length of the queue to reduce the CPU usage and memory usage of redis, thus avoiding redis failure. If the CPU occupancy rate and memory occupancy rate of redis do not exceed the preset occupancy threshold, it is determined that the system performance of redis meets the requirements. In this way, there is no need to increase the hardware structure of redis. By dynamically adjusting the parameters of redis, redis can be realized performance improvement.
  • the control service of the performance adjustment system in the server will obtain the expected delay L given by the user, and regularly pull the average delay information of the query service and the CPU and memory usage information of redis.
  • the average delay decreases, it will Adjust the value of this parameter in the same manner until the average delay no longer decreases. If the adjustment of a parameter causes the CPU or memory usage of redis to exceed the threshold, the optimization of the parameter will be rolled back and an attempt will be made to optimize the values of the other two parameters.
  • Figure 6 is a schematic flowchart of an embodiment of query request allocation in the redis-based performance adjustment method provided in the embodiment of this application.
  • step 201 allocates the redis query request to a preset query queue, specifically including steps 501-503:
  • the server parses the query request through the query service module and extracts the query request for redis. That is, in this embodiment, the query request is filtered through the performance adjustment system and the query request for redis is extracted to perform performance evaluation on redis based on the query request for redis. Adjustment.
  • the server obtains the number of requests for redis query requests, as well as the preset number of query queues, and the queue length of each query queue.
  • the queue length here includes the real-time length of the queue and the queue length threshold of the query queue, for example, The real-time length of the query queue is 300, and the queue length threshold is 500.
  • the server allocates the requested number of query requests to each of the query queues according to the number of queues and the queue length. That is, in this embodiment, the server distributes the requested number of query requests according to the number of queues and the queue length of the query queue. Distribution can make the queue length of each query queue more even and reduce the delay of requests in the queue.
  • Figure 7 is a schematic flow chart of an embodiment of initial parameter configuration in the redis-based performance adjustment method provided in the embodiment of this application.
  • the redis-based performance adjustment method before allocating the redis query request to the preset query queue in step 201 of the embodiment of the present application, the redis-based performance adjustment method also includes steps 601-603:
  • the server can set the initial timeout time of the expiration notification based on the user's average delay; configure the queue number and queue length of the redis corresponding query queue based on the expected delay and average delay; when the server distributes query requests, according to The initial queue information is requested for allocation to facilitate subsequent parameter adjustment.
  • Figure 8 is a schematic structural diagram of an embodiment of the redis-based performance adjustment device provided in the embodiment of the present application.
  • the assembly module 702 is used to assemble each query request in the query queue into a communication pipeline and submit it to the redis if the query queue receives an expiration notification;
  • the determination module 703 is used to receive the query results fed back by the redis based on the communication channel, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
  • the adjustment module 704 is used to adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue if the system performance of the redis does not meet the requirements until the system performance of the redis meets the requirements.
  • the redis-based performance adjustment device performs the step of assembling each query request in the query queue into a communication pipeline and sending the query request to the query queue if the query queue receives an expiration notification.
  • the redis include:
  • Control a preset time wheel to allocate a timeout to the query queue, and control the query queue to apply for an expiration notification channel from the time wheel;
  • the determination module 703 of the redis-based performance adjustment device executes the step of receiving the query results fed back by the redis based on the communication pipeline, and determines based on the response time associated with the query results. Whether the system performance of redis meets the requirements, including:
  • the adjustment module 704 in the redis-based performance adjustment device executes the step of adjusting the timeout period and/or the corresponding timeout period of the expiration notification if the system performance of the redis does not meet the requirements.
  • the adjustment module 704 executes until the new average delay does not exceed the preset delay threshold, then it is determined that the system performance of redis meets Requirements include:
  • the timeout period corresponding to the expiration notification and the number of queues in the query queue will be adjusted in reverse Or the queue length of the query queue;
  • the allocation module 701 in the redis-based performance adjustment device performs the allocation of redis query requests to preset query queues, including:
  • the query requests of the request number are allocated to each of the query queues.
  • the process before performing the process of allocating redis query requests to a preset query queue in the redis-based performance adjustment device, the process includes:
  • the average delay is set as the initial timeout time of the expiration notification, and the queue number and the queue length are set as the initial queue information of the query queue.
  • the redis-based performance adjustment device in this embodiment: allocates redis query requests to preset query queues; if the query queue receives an expiration notification, assembles each query request in the query queue into a communication pipeline and submit it to the redis; receive the query results fed back by the redis based on the communication channel, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results; if the system performance of the redis If the requirements are not met, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of the redis meets the requirements; in the embodiment of the present application, according to the response time associated with the query request, we can obtain Whether there is a response delay in the redis system, then determine whether the redis system performance meets the requirements; if the redis system performance does not meet the requirements, dynamically adjust the corresponding timeout time of the redis system and/or the queue information of the query queue, so that redis The system performance meets the requirements, so there is no need to
  • FIG. 9 is a schematic structural diagram of an embodiment of the electronic device provided in the embodiment of the present application.
  • the electronic device integrates any redis-based performance adjustment device provided by the embodiment of the present invention, and the electronic device includes:
  • processors one or more processors
  • One or more application programs wherein the one or more application programs are stored in the memory and configured to be executed by the processor as described in any of the above redis-based performance adjustment method embodiments. Steps in the redis-based performance tuning method.
  • the electronic device may include components such as a processor 801 of one or more processing cores, a memory 802 of one or more computer storage media, a power supply 803, and an input unit 804.
  • a processor 801 of one or more processing cores the electronic device may include components such as a processor 801 of one or more processing cores, a memory 802 of one or more computer storage media, a power supply 803, and an input unit 804.
  • FIG. 9 the structure of the electronic device shown in FIG. 9 does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange different components. in:
  • the processor 801 is the control center of the electronic device, using various interfaces and lines to connect various parts of the entire electronic device, by running or executing software programs and/or modules stored in the memory 802, and calling software programs stored in the memory 802. Data, perform various functions of the electronic device and process the data to conduct overall monitoring of the electronic device.
  • the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, where the application processor mainly processes the performance adjustment system, user interface and application programs. etc., the modem processor mainly handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 801.
  • the electronic device also includes a power supply 803 that supplies power to various components.
  • the power supply 803 can be logically connected to the processor 801 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system.
  • the power supply 803 may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
  • the electronic device may also include an input unit 804 that may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical, or trackball signal input related to user settings and function control.
  • an input unit 804 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical, or trackball signal input related to user settings and function control.
  • the electronic device may also include a display unit and the like, which will not be described again here.
  • the processor 801 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 802 according to the following instructions, and the processor 801 will run the executable files stored in The application program in the memory 802 implements various functions, as follows:
  • each query request in the query queue into a communication pipeline and submit it to the redis;
  • inventions of the present invention provide a computer storage medium.
  • the computer storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.
  • ROM Read Only Memory
  • RAM Random Access Memory
  • a computer program is stored thereon, and the computer program is loaded by the processor to execute the steps in any of the redis-based performance adjustment methods provided by the embodiments of the present invention. For example, when the computer program is loaded by the processor, the following steps may be performed:
  • each query request in the query queue into a communication pipeline and submit it to the redis;
  • each of the above units or structures can be implemented as an independent entity, or can be combined in any way and implemented as the same or several entities.
  • each of the above units or structures please refer to the previous method embodiments. Here No longer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present application provides a redis-based performance adjustment method and apparatus, a device and a computer storage medium. The method in the present application comprises: allocating a redis query request to a preset query queue; if the query queue receives an expiration notification, assembling each query request in the query queue into a communication pipeline, and submitting same to the redis; receiving a query result sent back by the redis on the basis of the communication pipeline, and according to a response time associated with the query result, determining whether the system performance of the redis meets the requirement; and if the system performance of the redis does not meet the requirement, adjusting a timeout time corresponding to the expiration notification and/or queue information of the query queue, until the system performance of the redis meets the requirement. In the embodiments of the invention, manual intervention is not needed, and the redis query performance is improved by adjusting the relevant parameters of the redis.

Description

基于redis的性能调整方法、装置、电子设备和介质Performance adjustment method, device, electronic equipment and media based on redis 技术领域Technical field
本申请涉及物流技术领域,具体涉及一种基于redis的性能调整方法、装置、电子设备和介质(计算机存储介质)。This application relates to the field of logistics technology, and specifically to a redis-based performance adjustment method, device, electronic equipment and media (computer storage media).
背景技术Background technique
随着互联网的普及,越来越多的用户开始在网上购物、寄快递、看新闻等,***访问的并发量成指数级上涨,这对缓存***的查询也提出了更高的要求;现有技术通常采用redis(Remote Dictionary Server,远程字典服务,是一个高性能的key-value数据库)作为缓存***。With the popularization of the Internet, more and more users begin to shop online, send express delivery, read news, etc., and the concurrent amount of system access increases exponentially, which also puts forward higher requirements for the query of the cache system; existing Technology usually uses redis (Remote Dictionary Server, remote dictionary service, a high-performance key-value database) as the cache system.
redis作为高性能缓存服务,查询Redis数据库可用操作方式有两种方式:非管道式、管道式操作;其中,非管道式查询Redis数据库,在处理高并发时查询效率较低;管道式查询Redis数据库,在处理高并发时查询效率提高,但是需要等待整个管道中的所有查询操作均完成,然后将全部结果中逐一匹配到管道,才最终返回全部结果,也需要耗费一定时间。也就是说,虽然redis服务本身性能很高,单次请求redis的延迟可以忽略,但当请求的次数很多如每秒有几万次甚至几十万次时,微小的网络延迟就会拖慢整体,导致redis整体性能降低。As a high-performance cache service, redis has two available operations for querying the Redis database: non-pipeline and pipeline operations. Among them, non-pipeline query of the Redis database has low query efficiency when dealing with high concurrency; pipeline query of the Redis database , query efficiency is improved when dealing with high concurrency, but it requires waiting for all query operations in the entire pipeline to be completed, and then matching all results to the pipeline one by one before finally returning all results, which also takes a certain amount of time. In other words, although the performance of the redis service itself is very high and the delay of a single request to redis can be ignored, when the number of requests is large, such as tens of thousands or even hundreds of thousands of times per second, the tiny network delay will slow down the whole thing. , causing the overall performance of redis to decrease.
发明内容Contents of the invention
本申请提供一种基于redis的性能调整方法、装置、设备和计算机存储介质,旨在解决现有的redis请求较多时微小延迟就会拖慢整体,导致redis整体性能降低的技术问题。This application provides a performance adjustment method, device, equipment and computer storage medium based on redis, aiming to solve the existing technical problem that when there are many redis requests, a small delay will slow down the whole, resulting in a reduction in the overall performance of redis.
一方面,本申请提供一种基于redis的性能调整方法,所述基于redis的性能调整方法包括以下步骤:On the one hand, this application provides a redis-based performance adjustment method. The redis-based performance adjustment method includes the following steps:
将redis查询请求分配至预设的查询队列;Distribute redis query requests to the preset query queue;
若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;If the query queue receives an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis;
接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;Receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。If the system performance of redis does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of redis meets the requirements.
在本申请一些实施方案中,所述若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交之前,所述方法包括:In some embodiments of the present application, if the query queue receives an expiration notification, before assembling each query request in the query queue into a communication pipeline and submitting it to redis, the method includes:
控制预设的时间轮向所述查询队列分配超时时间,并控制所述查询队列向所述时间轮申请过期通知管道;Control a preset time wheel to allocate a timeout to the query queue, and control the query queue to apply for an expiration notification channel from the time wheel;
若存在至少两个所述查询队列申请过期通知管道,则获取超过所述超时时间的所述查询队列的队列标识;If there are at least two query queue application expiration notification channels, obtain the queue identifier of the query queue that exceeds the timeout period;
通过所述过期通知管道发送过期通知至所述队列标识对应的查询队列。Send an expiration notification to the query queue corresponding to the queue identifier through the expiration notification pipeline.
在本申请一些实施方案中,所述接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求,包括:In some embodiments of the present application, receiving the query results fed back by the redis based on the communication channel, and determining whether the system performance of the redis meets the requirements based on the response time associated with the query results includes:
接收所述redis基于所述通讯管道反馈的查询结果,获取所述查询结果关联的响应时间;Receive the query result fed back by the redis based on the communication channel, and obtain the response time associated with the query result;
统计各所述查询结果关联的响应时间,计算所述redis的平均延时;Count the response times associated with each query result and calculate the average delay of redis;
若所述平均延时超过预设时延阈值,则判定所述redis的***性能不符合要求。If the average delay exceeds the preset delay threshold, it is determined that the system performance of redis does not meet the requirements.
在本申请一些实施方案中,所述若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求,包括: In some embodiments of the present application, if the system performance of redis does not meet the requirements, the timeout corresponding to the expiration notification and/or the queue information of the query queue is adjusted until the system performance of redis meets the requirements. Requirements include:
若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度;If the system performance of the redis does not meet the requirements, adjust the timeout corresponding to the expiration notification, the number of queues in the query queue, or the queue length of the query queue;
获取调整后的查询队列对应新的查询结果,根据所述新的查询结果关联的响应时间,确定新的平均延时;Obtain new query results corresponding to the adjusted query queue, and determine a new average delay based on the response time associated with the new query results;
直至所述新的平均延时不超过预设时延阈值,则确定所述redis的***性能符合要求。Until the new average delay does not exceed the preset delay threshold, it is determined that the system performance of redis meets the requirements.
在本申请一些实施方案中,所述直至所述新的平均延时不超过预设时延阈值,则确定所述redis的***性能符合要求,包括:In some embodiments of this application, if the new average delay does not exceed the preset delay threshold, it is determined that the system performance of redis meets the requirements, including:
若所述新的平均延时不超过预设时延阈值,则获取所述redis的CPU占用率和内存占用率;If the new average delay does not exceed the preset delay threshold, obtain the CPU usage and memory usage of redis;
若所述redis的CPU占用率超过预设占用率阈值,或所述redis的内存占用率超过预设占用率阈值,则反向调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度;If the CPU occupancy rate of redis exceeds the preset occupancy threshold, or the memory occupancy rate of redis exceeds the preset occupancy threshold, the timeout period corresponding to the expiration notification and the number of queues in the query queue will be adjusted in reverse Or the queue length of the query queue;
若所述redis的CPU占用率和内存占用率都未超过预设占用率阈值,则确定所述redis的***性能符合要求。If neither the CPU occupancy rate nor the memory occupancy rate of the redis exceeds the preset occupancy threshold, it is determined that the system performance of the redis meets the requirements.
在本申请一些实施方案中,所述将redis查询请求分配至预设的查询队列,包括:In some implementations of this application, the allocation of redis query requests to preset query queues includes:
通过查询服务模块解析查询请求,提取对redis的查询请求;Parse the query request through the query service module and extract the query request for redis;
获取对redis的所述查询请求的请求数量,以及预设的查询队列的队列数量,以及各所述查询队列的队列长度;Obtain the number of query requests to redis, the number of preset query queues, and the queue length of each query queue;
根据所述队列数量和所述队列长度,将所述请求数量的所述查询请求分配至各所述查询队列。According to the queue number and the queue length, the query requests of the request number are allocated to each of the query queues.
在本申请一些实施方案中,所述将redis查询请求分配至预设的查询队列之前,所述方法包括:In some embodiments of this application, before allocating the redis query request to a preset query queue, the method includes:
通过预设的查询服务模块拉取redis查询请求的平均延时;Pull the average delay of redis query requests through the preset query service module;
接收用户设置的预期延时,根据所述预期延时和所述平均延时,配置redis对应查询队列的队列数量和队列长度;Receive the expected delay set by the user, and configure the queue number and queue length of the redis corresponding query queue based on the expected delay and the average delay;
将所述平均延时设置为过期通知初始的超时时间,将所述队列数量和所述队列长度设置为所述查询队列初始的队列信息。The average delay is set as the initial timeout time of the expiration notification, and the queue number and the queue length are set as the initial queue information of the query queue.
另一方面,本申请提供一种基于redis的性能调整装置,所述基于redis的性能调整装置包括:On the other hand, this application provides a redis-based performance adjustment device. The redis-based performance adjustment device includes:
分配模块,用于将redis查询请求分配至预设的查询队列;Distribution module, used to distribute redis query requests to preset query queues;
组装模块,用于若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;An assembly module, configured to assemble each query request in the query queue into a communication pipeline and submit it to the redis if the query queue receives an expiration notification;
确定模块,用于接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;A determination module configured to receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
调整模块,用于若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。An adjustment module, configured to adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue if the system performance of the redis does not meet the requirements until the system performance of the redis meets the requirements.
另一方面,本申请还提供一种电子设备,所述电子设备包括:On the other hand, this application also provides an electronic device, which includes:
一个或多个处理器;one or more processors;
存储器;以及memory; and
一个或多个应用程序,其中所述一个或多个应用程序被存储于所述存储器中,并配置为由所述处理器执行以实现所述的基于redis的性能调整方法中的步骤。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the steps in the redis-based performance adjustment method.
另一方面,本申请还提供一种计算机存储介质,其上存储有计算机程序,所述计算机程序被处理器进行加载,以执行所述的基于redis的性能调整方法中的步骤。On the other hand, this application also provides a computer storage medium on which a computer program is stored, and the computer program is loaded by the processor to execute the steps in the redis-based performance adjustment method.
本申请的技术方案中基于redis的性能调整方法、装置、电子设备和介质;基于redis的性能调整方法包括:将redis查询请求分配至预设的查询队列;若所述查询队列接收到 过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求;本申请实施例中根据查询请求关联的响应时间,可以得到redis的***是否出现响应延迟,然后确定redis的***性能是否符合要求;若redis的***性能不符合要求,则对redis的***对应的超时时间和/或查询队列的队列信息进行动态调整,使得redis的***性能符合要求,这样不需要增加redis***的硬件结构,也不需要人工干预,通过简单的参数动态调整,就可以提高redis的***的查询性能。In the technical solution of this application, there are redis-based performance adjustment methods, devices, electronic equipment and media; the redis-based performance adjustment method includes: allocating redis query requests to preset query queues; if the query queue receives When receiving an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis; receive the query results fed back by the redis based on the communication pipeline, and provide a response associated with the query results. time to determine whether the system performance of the redis meets the requirements; if the system performance of the redis does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the redis The system performance meets the requirements; in the embodiment of this application, according to the response time associated with the query request, it can be obtained whether the redis system has a response delay, and then determines whether the redis system performance meets the requirements; if the redis system performance does not meet the requirements, then redis The corresponding timeout time of the system and/or the queue information of the query queue are dynamically adjusted to make the redis system performance meet the requirements. This does not require increasing the hardware structure of the redis system, nor does it require manual intervention. Through simple dynamic adjustment of parameters, It can improve the query performance of redis system.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.
图1是本申请实施例提供的基于redis的性能调整方法的场景示意图;Figure 1 is a schematic scenario diagram of the redis-based performance adjustment method provided by the embodiment of this application;
图2为本申请实施例中基于redis的性能调整方法的一个实施例流程示意图;Figure 2 is a schematic flow chart of an embodiment of the redis-based performance adjustment method in the embodiment of the present application;
图3是本申请实施例中提供的基于redis的性能调整方法中redis查询过期通知的一个实施例的流程示意图;Figure 3 is a schematic flow chart of an embodiment of redis query expiration notification in the redis-based performance adjustment method provided in the embodiment of this application;
图4是本申请实施例中提供的基于redis的性能调整方法中redis性能调整***的具体场景示意图;Figure 4 is a schematic diagram of a specific scenario of the redis performance adjustment system in the redis-based performance adjustment method provided in the embodiment of this application;
图5是本申请实施例中提供的基于redis的性能调整方法中参数调整一个实施例的流程示意图;Figure 5 is a schematic flow chart of one embodiment of parameter adjustment in the redis-based performance adjustment method provided in the embodiment of this application;
图6是本申请实施例中提供的基于redis的性能调整方法中查询请求分配的一个实施例流程示意图;Figure 6 is a schematic flowchart of an embodiment of query request allocation in the redis-based performance adjustment method provided in the embodiment of this application;
图7是本申请实施例中提供的基于redis的性能调整方法中初始参数配置一个实施例的流程示意图;Figure 7 is a schematic flowchart of an embodiment of initial parameter configuration in the redis-based performance adjustment method provided in the embodiment of this application;
图8是本申请实施例中提供的基于redis的性能调整装置的一个实施例结构示意图;Figure 8 is a schematic structural diagram of an embodiment of the redis-based performance adjustment device provided in the embodiment of this application;
图9是本申请实施例中提供的电子设备的一个实施例结构示意图。FIG. 9 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明包含的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts belong to the scope of the present invention.
在本发明的描述中,需要理解的是,术语“中心”、“纵向”、“横向”、“长度”、“宽度”、“厚度”、“上”、“下”、“前”、“后”、“左”、“右”、“竖直”、“水平”、“顶”、“底”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个所述特征。在本发明的描述中,“多个”的含义是两个或两个以上,除非另有明确具体的限定。In the description of the present invention, it should be understood that the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", " The directions or positional relationships indicated by "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. are based on the directions shown in the accompanying drawings or positional relationships are only for the convenience of describing the present invention and simplifying the description, but do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms “first” and “second” are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Thus, features defined as “first” and “second” may explicitly or implicitly include one or more of the described features. In the description of the present invention, "plurality" means two or more than two, unless otherwise explicitly and specifically limited.
在本申请中,“示例性”一词用来表示“用作例子、例证或说明”。本申请中被描述为“示例性”的任何实施例不一定被解释为比其它实施例更优选或更具优势。为了使本领域任何技术人员能够实现和使用本发明,给出了以下描述。在以下描述中,为了解释的目的而列出了细节。应当明白的是,本领域普通技术人员可以认识到,在不使用这些特定细 节的情况下也可以实现本发明。在其它实例中,不会对公知的结构和过程进行详细阐述,以避免不必要的细节使本发明的描述变得晦涩。因此,本发明并非旨在限于所示的实施例,而是与符合本申请所公开的原理和特征的最广范围相一致。In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the invention. In the following description, details are set forth for the purpose of explanation. It should be understood that those of ordinary skill in the art will recognize that without the use of these specific details The present invention can also be implemented in the case of section. In other instances, well-known structures and processes have not been described in detail to avoid obscuring the description of the invention with unnecessary detail. Thus, the present invention is not intended to be limited to the embodiments shown but is to be accorded the widest scope consistent with the principles and features disclosed herein.
本申请实施例中提供一种基于redis的性能调整方法、装置、设备及计算机存储介质,以下分别进行详细说明。The embodiments of this application provide a performance adjustment method, device, equipment and computer storage medium based on redis, which will be described in detail below.
本发明实施例中的基于redis的性能调整方法应用于基于redis的性能调整装置,基于redis的性能调整装置设置于电子设备,电子设备中设置有一个或多个处理器、存储器,以及一个或多个应用程序,其中一个或多个应用程序被存储于存储器中,并配置为由处理器执行以实现基于redis的性能调整方法;电子设备可以是终端,例如,手机或平板电脑,电子设备还可以是一台服务器,或者多台服务器组成的服务集群。The redis-based performance adjustment method in the embodiment of the present invention is applied to the redis-based performance adjustment device. The redis-based performance adjustment device is provided in an electronic device. The electronic device is provided with one or more processors, memories, and one or more An application program, wherein one or more application programs are stored in the memory and configured to be executed by the processor to implement the redis-based performance adjustment method; the electronic device may be a terminal, for example, a mobile phone or a tablet computer, and the electronic device may also be It is a server or a service cluster composed of multiple servers.
如图1所示,图1为本申请实施例基于redis的性能调整方法的场景示意图,本发明实施例中基于redis的性能调整场景中包括电子设备100(电子设备100中集成有基于redis的性能调整装置),电子设备100中运行基于redis的性能调整对应的计算机存储介质,以执行基于redis的性能调整的步骤。As shown in Figure 1, Figure 1 is a schematic diagram of a scenario of a redis-based performance adjustment method in an embodiment of the present application. In the embodiment of the present invention, the redis-based performance adjustment scenario includes an electronic device 100 (the electronic device 100 is integrated with redis-based performance Adjustment device), the computer storage medium corresponding to redis-based performance adjustment is run in the electronic device 100 to perform the steps of redis-based performance adjustment.
可以理解的是,图1所示基于redis的性能调整的场景中的电子设备,或者电子设备中包含的装置并不构成对本发明实施例的限制,即,基于redis的性能调整的场景中包含的设备数量、设备种类,或者各个设备中包含的装置数量、装置种类不影响本发明实施例中技术方案整体实现,均可以算作本发明实施例要求保护技术方案的等效替换或衍生。It can be understood that the electronic equipment in the redis-based performance adjustment scenario shown in Figure 1, or the devices included in the electronic equipment do not constitute a limitation to the embodiment of the present invention, that is, the redis-based performance adjustment scenario included in The number and type of equipment, or the number and type of devices included in each device do not affect the overall implementation of the technical solutions in the embodiments of the present invention, and can be counted as equivalent replacements or derivatives of the technical solutions claimed in the embodiments of the present invention.
本发明实施例中电子设备100主要用于:将redis查询请求分配至预设的查询队列;若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。In the embodiment of the present invention, the electronic device 100 is mainly used to: allocate redis query requests to a preset query queue; if the query queue receives an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis; receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results; if the redis system If the performance does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of the redis meets the requirements.
本发明实施例中该电子设备100可以是独立的电子设备,也可以是电子设备组成的电子设备网络或电子设备集群,例如,本发明实施例中所描述的电子设备100,其包括但不限于计算机、网络主机、单个网络电子设备、多个网络电子设备集或多个电子设备构成的云电子设备。其中,云电子设备由基于云计算(Cloud Computing)的大量计算机或网络电子设备构成。In the embodiment of the present invention, the electronic device 100 may be an independent electronic device, or may be an electronic device network or an electronic device cluster composed of electronic devices. For example, the electronic device 100 described in the embodiment of the present invention includes, but is not limited to A computer, a network host, a single network electronic device, a set of multiple network electronic devices, or a cloud electronic device composed of multiple electronic devices. Among them, cloud electronic equipment consists of a large number of computers or network electronic equipment based on cloud computing (Cloud Computing).
本领域技术人员可以理解,图1中示出的应用环境,仅仅是与本申请方案一种应用场景,并不构成对本申请方案应用场景的限定,其他的应用环境还可以包括比图1中所示更多或更少的电子设备,或者电子设备网络连接关系,例如图1中仅示出1个电子设备,可以理解的,该基于redis的性能调整的场景还可以包括一个或多个其他电子设备,具体此处不作限定;该电子设备100中还可以包括存储器。Those skilled in the art can understand that the application environment shown in Figure 1 is only an application scenario with the solution of the present application and does not constitute a limitation on the application scenarios of the solution of the present application. Other application environments may also include those shown in Figure 1 Show more or less electronic devices, or the network connection relationship of electronic devices. For example, only one electronic device is shown in Figure 1. It can be understood that the redis-based performance adjustment scenario can also include one or more other electronic devices. The specific device is not limited here; the electronic device 100 may also include a memory.
此外,本申请基于redis的性能调整的场景中电子设备100可以设置显示装置,或者电子设备100中不设置显示装置与外接的显示装置200通讯连接,显示装置200用于输出电子设备中基于redis的性能调整方法执行的结果。电子设备100可以访问后台数据库300(后台数据库可以是电子设备的本地存储器中,后台数据库还可以设置在云端),后台数据库300中保存有基于redis的性能调整相关的信息。In addition, in the scenario of redis-based performance adjustment in this application, the electronic device 100 can be equipped with a display device, or the electronic device 100 is not provided with a display device to communicate with the external display device 200. The display device 200 is used to output the redis-based information in the electronic device. The result of performance tuning method execution. The electronic device 100 can access the backend database 300 (the backend database can be in the local storage of the electronic device, and the backend database can also be set in the cloud). The backend database 300 stores information related to performance adjustment based on redis.
需要说明的是,图1所示的基于redis的性能调整方法的场景示意图仅仅是一个示例,本发明实施例描述的基于redis的性能调整的场景是为了更加清楚的说明本发明实施例的技术方案,并不构成对于本发明实施例提供的技术方案的限定。It should be noted that the scenario diagram of the redis-based performance adjustment method shown in Figure 1 is only an example. The redis-based performance adjustment scenario described in the embodiment of the present invention is to more clearly illustrate the technical solution of the embodiment of the present invention. , does not constitute a limitation on the technical solutions provided by the embodiments of the present invention.
基于上述基于redis的性能调整的场景,提出了基于redis的性能调整方法的实施例。Based on the above redis-based performance adjustment scenario, an embodiment of the redis-based performance adjustment method is proposed.
如图2所示,图2为本申请实施例中基于redis的性能调整方法的一个实施例流程示意图,该基于redis的性能调整方法包括步骤201-204: As shown in Figure 2, Figure 2 is a schematic flow chart of an embodiment of the redis-based performance adjustment method in the embodiment of the present application. The redis-based performance adjustment method includes steps 201-204:
201,将redis查询请求分配至预设的查询队列。201. Distribute the redis query request to the preset query queue.
本实施例中的基于redis的性能调整方法应用在电子设备,电子设备种类不作具体限定,例如,电子设备可以是终端或者服务器,本实施例中以服务器为例进行说明。The redis-based performance adjustment method in this embodiment is applied to electronic equipment. The type of electronic equipment is not specifically limited. For example, the electronic equipment can be a terminal or a server. In this embodiment, a server is used as an example for explanation.
服务器接收查询请求,其中,查询请求可以是用户主动触发的,例如,用户点击手机终端显示界面上的“数据查询”按键,主动触发查询请求,手机终端将查询请求发送至服务器,服务器接收用户触发的查询请求;此外,查询请求还可以是服务器自动触发的,例如,服务器中预先设置查询请求的触发条件为:数据更新时自动触发查询请求,服务器实时地采集数据库的数据更新信息,服务器检测到数据库更新时,服务器自动触发查询请求。The server receives the query request, where the query request can be actively triggered by the user. For example, the user clicks the "Data Query" button on the display interface of the mobile phone terminal to actively trigger the query request. The mobile terminal sends the query request to the server, and the server receives the user's trigger. Query request; In addition, the query request can also be automatically triggered by the server. For example, the trigger condition of the query request is preset in the server: the query request is automatically triggered when the data is updated. The server collects the data update information of the database in real time. The server detects When the database is updated, the server automatically triggers a query request.
服务器接收查询请求之后,服务器通过查询服务模块解析各个查询请求,提取查询请求中对redis的查询请求,其中,查询服务模块解析查询请求中的命令,提取对redis查询的键命令,查询服务模块将对redis的查询分解为第一键命令key1、第二键命令key2、第三键命令key3……依次类推,查询服务模块分别为这些键命令申请结果通知管道ch1、ch2、ch3……,然后将对redis的查询请求均匀地分散到预设的查询队列中;其中,预设的查询队列预先设置的查询队列,查询队列的队列数量和队列长度可以进行灵活调整。After the server receives the query request, the server parses each query request through the query service module and extracts the query request for redis in the query request. Among them, the query service module parses the command in the query request and extracts the key command for the redis query. The query service module will The query for redis is decomposed into the first key command key1, the second key command key2, the third key command key3... and so on. The query service module applies for the result notification pipelines ch1, ch2, ch3... for these key commands respectively, and then Query requests to redis are evenly distributed into the preset query queues; among them, the preset query queues, the number of queues, and the queue length of the preset query queues can be flexibly adjusted.
本实施例中服务器中查询服务模块将redis查询请求分配至预设的查询队列的方式不作具体限定,例如,实现方式一:查询服务模块将查询请求依次分配至查询队列,使得各个查询队列中的查询请求的数量较为平均,提高查询请求的执行效率;实现方式二:查询服务模块获取查询队列的队列数据和队列长度阈值,以及查询请求的请求数量,例如,查询队列的队列数量为2,查询队列的队列长度阈值为500,查询服务模块则获取到对redis的查询请求有请求数量600个,查询服务模块将600个查询请求平均的分配到两个查询队列中。In this embodiment, the way in which the query service module in the server allocates the redis query request to the preset query queue is not specifically limited. For example, implementation method 1: the query service module allocates the query request to the query queue in sequence, so that the query requests in each query queue are The number of query requests is relatively average, which improves the execution efficiency of query requests; implementation method two: the query service module obtains the queue data and queue length threshold of the query queue, as well as the number of query requests. For example, the number of queues in the query queue is 2, and the query The queue length threshold of the queue is 500. The query service module obtained that there were 600 query requests for redis. The query service module evenly distributed the 600 query requests to the two query queues.
本实施例中服务器将对redis的查询请求平均分配到查询队列中,可以提高redis查询的效率,同时准确地记录查询请求的响应时间。In this embodiment, the server evenly distributes redis query requests to the query queue, which can improve the efficiency of redis queries and accurately record the response time of the query requests.
服务器通过查询服务模块将查询请求分配至预设的查询队列之后,查询队列为各个查询队列申请结果通知管道,在执行查询请求之后,就可以通过结果通知管道反馈该查询请求的查询结果;如果预设时间没有接收到结果通知管道反馈的该查询请求的查询结果,服务器生成过期通知并发送至消息队列。After the server allocates the query request to the preset query queue through the query service module, the query queue applies for a result notification pipeline for each query queue. After the query request is executed, the query result of the query request can be fed back through the result notification pipeline; if it is preset If the query result of the query request fed back by the result notification pipeline is not received at the time, the server generates an expiration notification and sends it to the message queue.
202,若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交。202. If the query queue receives an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis.
若查询队列接收到过期通知,服务器控制将查询队列中的各查询请求组装成通讯管道(pipeline,其中,pipeline是指将一件需要重复做的事情切割成各个不同的阶段,每一个阶段由独立的单元负责;所有待执行的对象依次进入作业队列,除了开始和结尾的一段时间,任意时刻各个单元都被同时服务)并向所述redis提交;即,服务器将查询队列中的各个查询请求进行关联,例如,对于查询请求1、查询请求2和查询请求3三条指令,将三个查询指令组合形成pipeline之后,提交给redis可以提高查询效率。If the query queue receives an expiration notification, the server controls to assemble each query request in the query queue into a communication pipeline (pipeline, where pipeline refers to cutting a thing that needs to be done repeatedly into different stages, each stage consists of independent The unit is responsible; all objects to be executed enter the job queue in turn. Except for a period of time at the beginning and end, each unit is served simultaneously at any time) and submitted to the redis; that is, the server processes each query request in the query queue. Association, for example, for three instructions: Query Request 1, Query Request 2 and Query Request 3, after combining the three query instructions to form a pipeline, submitting them to redis can improve query efficiency.
服务器检测到pipeline中各个查询请求都反馈查询结果之后,将会向查询队列对应的结果通知管道写入最后的查询结果,此时服务器就会收到查询结果,并给对应的查询请求发出应答消息。After the server detects that each query request in the pipeline feeds back the query results, it will write the final query results to the result notification pipeline corresponding to the query queue. At this time, the server will receive the query results and send a response message to the corresponding query request. .
203,接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求。203. Receive the query result fed back by the redis based on the communication channel, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query result.
服务器接收redis基于通讯管道反馈的查询结果,并获取查询结果关联的响应时间,服务器根据查询结果携带的响应时间,确定redis的***性能是否符合要求,具体地的实现方式不作限定,例如,The server receives the query results fed back by redis based on the communication pipeline, and obtains the response time associated with the query results. The server determines whether the system performance of redis meets the requirements based on the response time carried by the query results. The specific implementation method is not limited, for example,
实现方式一,服务器根据redis的平均延时,确定redis的***性能是否符合要求,包括: Implementation method 1: The server determines whether the system performance of redis meets the requirements based on the average delay of redis, including:
1、接收所述redis基于所述通讯管道反馈的查询结果,获取所述查询结果关联的响应时间;1. Receive the query results fed back by the redis based on the communication channel, and obtain the response time associated with the query results;
2、统计各所述查询结果关联的响应时间,计算所述redis的平均延时;2. Count the response times associated with each query result and calculate the average delay of redis;
3、若所述平均延时超过预设时延阈值,则判定所述redis的***性能不符合要求。3. If the average delay exceeds the preset delay threshold, it is determined that the system performance of redis does not meet the requirements.
服务器接收redis基于通讯管道反馈的查询结果,服务器获取查询结果关联的响应时间;服务器根据各查询结果关联的响应时间,计算redis的平均延时;即,服务器中的查询服务模块根据查询请求上携带的时间信息,以及查询请求对应查询结果携带的时间信息,计算查询结果的响应时间;服务器将各个查询请求的响应时间进行累加后求取平均值,得到redis的平均延时;服务器将redis的平均延时和预设时延阈值进行比对,其中,预设延时阈值是用户根据预期设置的延时时间,例如,预设延时阈值设置为0.5s;若平均延时不超过预设时延阈值,则判定redis的***性能符合要求,不需要进行性能优化;若平均延时超过预设时延阈值,则判定redis的***性能不符合要求。The server receives the query results fed back by redis based on the communication pipeline, and the server obtains the response time associated with the query results; the server calculates the average delay of redis based on the response time associated with each query result; that is, the query service module in the server carries The time information, as well as the time information carried by the query result corresponding to the query request, is used to calculate the response time of the query result; the server accumulates the response time of each query request and averages it to obtain the average delay of redis; the server calculates the average delay of redis Compare the delay with the preset delay threshold, where the preset delay threshold is the delay time set by the user according to expectations. For example, the preset delay threshold is set to 0.5s; if the average delay does not exceed the preset time If the delay threshold is exceeded, it is judged that the system performance of redis meets the requirements and no performance optimization is required; if the average delay exceeds the preset delay threshold, it is judged that the system performance of redis does not meet the requirements.
实现方式二,服务器根据redis的每秒查询率,确定redis的***性能是否符合要求,包括:Implementation method two: the server determines whether the system performance of redis meets the requirements based on the query rate of redis per second, including:
1、接收所述redis基于所述通讯管道反馈的查询结果,获取所述查询结果关联的响应时间;1. Receive the query results fed back by the redis based on the communication channel, and obtain the response time associated with the query results;
2、根据各所述查询结果关联的响应时间,统计所述redis的请求数量,得到每秒查询率;2. According to the response time associated with each query result, count the number of redis requests and obtain the query rate per second;
3、若所述每秒查询率不超过预设查询率,则判定所述redis的***性能不符合要求。3. If the query rate per second does not exceed the preset query rate, it is determined that the system performance of redis does not meet the requirements.
服务器接收redis基于所述通讯管道反馈的查询结果,服务器获取查询结果关联的响应时间;查询服务模块统计各查询结果关联的响应时间,计算redis的每秒查询率;查询服务模块将redis的每秒查询率和预设查询率进行比对,其中,预设查询率是redis根据实际处理情况设置的请求数量阈值,例如,预设查询率设置为100000个每秒;若每秒查询率超过预设查询率,则判定所述redis的***性能符合要求,不需要进行性能优化;若每秒查询率不超过预设查询率,则判定所述redis的***性能不符合要求。The server receives the query result fed back by redis based on the communication channel, and the server obtains the response time associated with the query result; the query service module counts the response time associated with each query result, and calculates the query rate per second of redis; the query service module calculates the query rate per second of redis Compare the query rate with the preset query rate. The preset query rate is the request number threshold set by redis based on the actual processing situation. For example, the preset query rate is set to 100,000 per second; if the query rate per second exceeds the preset query rate, it is determined that the system performance of the redis meets the requirements, and performance optimization is not required; if the query rate per second does not exceed the preset query rate, it is determined that the system performance of the redis does not meet the requirements.
本实施例中服务器根据接收redis基于通讯管道反馈的查询结果,并根据查询结果关联的响应时间,确定redis的***性能是否符合要求,这样可以准确评估redis的性能,进一步地对redis的***性能进行优化,具体地:In this embodiment, the server determines whether the system performance of redis meets the requirements based on the query results fed back by redis based on the communication pipeline and the response time associated with the query results. In this way, the performance of redis can be accurately evaluated and the system performance of redis can be further evaluated. Optimize, specifically:
204,若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。204. If the system performance of redis does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of redis meets the requirements.
若redis的***性能不符合要求,服务器则调整过期通知对应的超时时间和/或查询队列的队列信息,其中,队列信息包括队列长度和队列数量,服务器可以选择超声时间、队列长度和队列数量至少一个进行调整,直至redis的***性能符合要求。If the system performance of redis does not meet the requirements, the server will adjust the timeout time corresponding to the expiration notification and/or query the queue information of the queue. The queue information includes the queue length and the number of queues. The server can select the ultrasonic time, queue length and queue number to be at least One is adjusted until the system performance of redis meets the requirements.
本申请实施例中将redis查询请求分配至预设的查询队列;若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求;本申请实施例中服务器根据查询请求关联的响应时间,可以得到redis的***是否出现响应延迟,然后确定redis的***性能是否符合要求;若redis的***性能不符合要求,则对redis的***对应的超时时间和/或查询队列的队列信息进行动态调整,这样redis***按照用户预期的时间反馈结果,使得redis的***性能符合要求,这样不需要增加redis***的硬件结构,也不需要人工干预,通过简单的参数调整,就可以提高redis的***性能。In the embodiment of this application, the redis query request is allocated to a preset query queue; if the query queue receives an expiration notice, each query request in the query queue is assembled into a communication channel and submitted to the redis ; Receive the query results fed back by the redis based on the communication channel, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results; if the system performance of the redis does not meet the requirements, adjust The timeout time corresponding to the expiration notification and/or the queue information of the query queue is used until the system performance of redis meets the requirements; in the embodiment of the application, the server can obtain whether the redis system appears based on the response time associated with the query request. response delay, and then determine whether the redis system performance meets the requirements; if the redis system performance does not meet the requirements, dynamically adjust the corresponding timeout time of the redis system and/or the queue information of the query queue, so that the redis system meets the user expectations The time feedback results make the system performance of redis meet the requirements. In this way, there is no need to increase the hardware structure of the redis system or manual intervention. Through simple parameter adjustment, the system performance of redis can be improved.
图3是本申请实施例中提供的基于redis的性能调整方法中redis查询过期通知的一 个实施例的流程示意图。Figure 3 is a diagram of the redis query expiration notification in the redis-based performance adjustment method provided in the embodiment of this application. A flow diagram of an embodiment.
在本申请一些实施例中,步骤202,若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交之前,服务器预先构建redis前置的性能调整***,通过性能调整***进行过期通知,具体地包括步骤301-303:In some embodiments of the present application, in step 202, if the query queue receives an expiration notification, the server assembles each query request in the query queue into a communication pipeline and submits it to the redis. The server pre-constructs redis The front-end performance adjustment system performs expiration notification through the performance adjustment system, specifically including steps 301-303:
301,控制预设的时间轮向所述查询队列分配超时时间,并控制所述查询队列向所述时间轮申请过期通知管道;301. Control the preset time wheel to allocate a timeout to the query queue, and control the query queue to apply for an expiration notification channel from the time wheel;
服务器中预先构建redis前置的性能调整***,参照图4,图4是本申请实施例中提供的基于redis的性能调整方法中redis性能调整***的具体场景示意图,图4所示,该性能调整***上包括控制服务模块、查询服务模块、时间轮和chan管道复用池等等;其中,A redis-front performance adjustment system is pre-built in the server. Refer to Figure 4. Figure 4 is a schematic diagram of a specific scenario of the redis performance adjustment system in the redis-based performance adjustment method provided in the embodiment of this application. As shown in Figure 4, the performance adjustment The system includes control service module, query service module, time wheel and chan pipe reuse pool, etc.; among them,
控制服务模块用于:1、接收用户设置的预期延时;2、通过查询服务模块拉取查询请求的平均耗时;3、根据查询请求的相依时间进行调整,其中,调整的参数包括超时时间、队列长度和队列数量;The control service module is used to: 1. Receive the expected delay set by the user; 2. Pull the average time consumption of the query request through the query service module; 3. Adjust according to the dependency time of the query request, where the adjusted parameters include the timeout time , queue length and queue number;
查询服务模块用于:接收查询请求对查询请求进行解析,提取查询请求中对redis的查询请求,并将对redis的查询请求调整为键命令后分配至查询队列;The query service module is used to: receive the query request, parse the query request, extract the query request for redis in the query request, and adjust the query request for redis into key commands and then assign them to the query queue;
时间轮用于:监控各个查询队列中查询请求的响应时间,若查询队列中查询请求的响应时间超过超时时间,时间轮则发送超时通知至查询队列;The time wheel is used to: monitor the response time of query requests in each query queue. If the response time of the query request in the query queue exceeds the timeout, the time wheel will send a timeout notification to the query queue;
chan管道复用池用于:根据redis查询请求申请的结果通知管道,降低***内存消耗,查询队列用于控制请求redis的并发度和每次请求打包的查询请求的请求数量。The chan pipeline reuse pool is used to notify the pipeline according to the results of the redis query request application to reduce system memory consumption. The query queue is used to control the concurrency of redis requests and the number of query requests packaged for each request.
可以理解的是,性能调整***的结构不作限定,本领域技术人员可以根据具体的使用情况设置更多或者更少的处理模块,本实施例中为了方便理解,以上述性能调整***为例进行说明。It can be understood that the structure of the performance adjustment system is not limited. Those skilled in the art can set more or fewer processing modules according to specific usage conditions. In this embodiment, for the convenience of understanding, the above performance adjustment system is taken as an example for explanation. .
本实施例中服务器通过查询服务模块将redis查询请求分配至预设的查询队列之后,服务器中预设的时间轮向查询队列分配超时时间T,同时控制查询队列向时间轮申请过期通知管道,通过过期通知管道通知查询队列中的查询请求是否执行超过超时时间T。In this embodiment, after the server allocates the redis query request to the preset query queue through the query service module, the preset time wheel in the server allocates the timeout time T to the query queue, and at the same time controls the query queue to apply for the expiration notification channel to the time wheel, through The expiration notification pipeline notifies whether the execution of the query request in the query queue exceeds the timeout period T.
302,若存在至少两个所述查询队列申请过期通知管道,则获取超过所述超时时间的所述查询队列的队列标识。302. If there are at least two query queue application expiration notification channels, obtain the queue identifier of the query queue that exceeds the timeout period.
本实施例中查询队列的数量不作具体限定,例如,查询队列可以是至少两个,时间轮实时监测查询队列中查询请求的响应时间,时间轮检测到至少两个查询队列超过超时时间时,则获取超过超时时间的查询队列的队列标识。In this embodiment, the number of query queues is not specifically limited. For example, there can be at least two query queues. The time wheel monitors the response time of query requests in the query queue in real time. When the time wheel detects that at least two query queues exceed the timeout time, then Get the queue ID of the query queue that has exceeded the timeout period.
303,通过所述过期通知管道发送过期通知至所述队列标识对应的查询队列。303. Send an expiration notification to the query queue corresponding to the queue identifier through the expiration notification pipeline.
时间轮通过过期通知管道发送过期通知至队列标识对应的查询队列,使得查询队列接收到过期通知,服务器则将所述查询队列中的各查询请求组装成通讯管道并向所述redis提交。The time wheel sends an expiration notification to the query queue corresponding to the queue identifier through the expiration notification pipeline, so that the query queue receives the expiration notification, and the server assembles each query request in the query queue into a communication pipeline and submits it to the redis.
为了方便理解,参照图4,查询服务模块会将多个请求中对redis的查询分解为key1、key2、key3……,并分别为这些key申请结果通知管道ch1、ch2、ch3……,然后将它们均匀地分散到M个查询队列中。每个队列的最大长度为N,每个队列会向时间轮申请过期通知管道,如果有多个队列申请了过期通知管道,则进行复用。时间轮会在某个时刻给某个查询队列分配超时时间T,并在过期时通过管道通知该队列。当某个队列收到过期通知时,会将队列中的所有待查询key组装成一个pipeline,并向redis提交查询请求,同时向时间轮申请新的过期通知管道,准备下一轮循。In order to facilitate understanding, referring to Figure 4, the query service module will decompose the redis query in multiple requests into key1, key2, key3..., and notify the pipelines ch1, ch2, ch3... of the application results for these keys respectively, and then They are evenly distributed into M query queues. The maximum length of each queue is N. Each queue will apply for an expiration notification pipeline from the time wheel. If multiple queues apply for the expiration notification pipeline, they will be reused. The time wheel will assign a timeout time T to a query queue at a certain moment, and notify the queue through the pipeline when it expires. When a queue receives an expiration notification, it will assemble all the keys to be queried in the queue into a pipeline, submit a query request to redis, and apply for a new expiration notification pipeline to the time wheel to prepare for the next round.
本实施例中redis前面设置性能调整***,通过性能调整***进行过期通知,这样可以实现查询请求时间很好的监控,同时根据查询队列中查询请求的响应时间,确定redis的查询方式,可以提高redis的查询率,进一步地保障redis的***性能。In this embodiment, a performance adjustment system is set up in front of redis, and expiration notification is provided through the performance adjustment system. This can achieve good monitoring of the query request time. At the same time, the query method of redis is determined based on the response time of the query request in the query queue, which can improve redis The query rate further ensures the system performance of redis.
参照图5,图5是本申请实施例中提供的基于redis的性能调整方法中参数调整一个 实施例的流程示意图。Referring to Figure 5, Figure 5 is a parameter adjustment in the redis-based performance adjustment method provided in the embodiment of the present application. Flow diagram of the embodiment.
在本申请一些实施例中,步骤204若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求,具体地包括步骤401-403:In some embodiments of the present application, if the system performance of redis does not meet the requirements in step 204, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of redis meets the requirements. Requirements, specifically including steps 401-403:
401,若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度。401. If the system performance of the redis does not meet the requirements, adjust the timeout period corresponding to the expiration notification, the number of queues in the query queue, or the queue length of the query queue.
若redis的***性能不符合要求,服务器则获取过期通知对应的超时时间、查询队列的队列数量和查询队列的队列长度,服务器可以控制一个量不变,调整另外两个,例如,服务器控制过期通知对应的超时时间不变,调整查询队列的队列数量和查询队列的队列长度;或者服务器控制查询队列的队列长度不变,调整查询队列的队列数量和过期通知对应的超时时间。If the system performance of redis does not meet the requirements, the server obtains the timeout corresponding to the expiration notification, the number of queues in the query queue, and the queue length of the query queue. The server can control one quantity to remain unchanged and adjust the other two. For example, the server controls the expiration notification. If the corresponding timeout period remains unchanged, adjust the number of queues in the query queue and the queue length of the query queue; or the server controls the queue length of the query queue to remain unchanged and adjust the number of queues in the query queue and the timeout period corresponding to the expiration notification.
服务器将新的redis查询请求分配至调整后的查询队列;若查询队列重新接收到过期通知,服务器则将查询队列中的各查询请求组装成通讯管道并向redis提交。The server distributes the new redis query request to the adjusted query queue; if the query queue receives the expiration notification again, the server assembles each query request in the query queue into a communication pipeline and submits it to redis.
402,获取调整后的查询队列对应新的查询结果,根据所述新的查询结果关联的响应时间,确定新的平均延时。402. Obtain new query results corresponding to the adjusted query queue, and determine a new average delay based on the response time associated with the new query results.
服务器接收redis基于所述通讯管道反馈新的查询结果,服务器获取新的查询结果关联的响应时间,服务器将各个查询请求的响应时间进行累加后求取平均值,得到新的平均延时;服务器将新的平均延时和预设时延阈值进行比对,其中,预设延时阈值是用户根据预期设置的延时时间,例如,预设延时阈值设置为0.5s;若新的平均延时不超过预设时延阈值,则判定所述redis的***性能符合要求,不需要进行性能优化;若新的平均延时超过预设时延阈值,则判定所述redis的***性能不符合要求,则继续进行调整。The server receives new query results fed back by redis based on the communication channel, and the server obtains the response time associated with the new query results. The server accumulates the response times of each query request and averages them to obtain a new average delay; the server Compare the new average delay with the preset delay threshold. The preset delay threshold is the delay time set by the user according to expectations. For example, the preset delay threshold is set to 0.5s; if the new average delay If it does not exceed the preset delay threshold, it is determined that the system performance of the redis meets the requirements, and performance optimization is not required; if the new average delay exceeds the preset delay threshold, it is determined that the system performance of the redis does not meet the requirements. Then continue to make adjustments.
403,直至所述新的平均延时不超过预设时延阈值,则确定所述redis的***性能符合要求。403. Until the new average delay does not exceed the preset delay threshold, it is determined that the system performance of redis meets the requirements.
若新的平均延时不超过预设时延阈值,则服务器进一步地检测redis的其他性能参数,使得redis的***性能符合要求;具体地,包括:If the new average delay does not exceed the preset delay threshold, the server further detects other performance parameters of redis to make the system performance of redis meet the requirements; specifically, it includes:
1、若所述新的平均延时不超过预设时延阈值,则获取所述redis的CPU占用率和内存占用率;1. If the new average delay does not exceed the preset delay threshold, obtain the CPU usage and memory usage of redis;
2、若所述redis的CPU占用率超过预设占用率阈值,或所述redis的内存占用率超过预设占用率阈值,则反向调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度;2. If the CPU occupancy rate of redis exceeds the preset occupancy threshold, or the memory occupancy rate of redis exceeds the preset occupancy threshold, reversely adjust the timeout period corresponding to the expiration notification and the query queue timeout period. The number of queues or the queue length of the query queue;
3、若所述redis的CPU占用率和内存占用率都未超过预设占用率阈值,则确定所述redis的***性能符合要求。3. If neither the CPU occupancy rate nor the memory occupancy rate of the redis exceeds the preset occupancy threshold, it is determined that the system performance of the redis meets the requirements.
即,若新的平均延时不超过预设时延阈值,服务器则获取所述redis的CPU占用率和内存占用率;服务器将redis的CPU占用率和内存占用率分别和预设占用率阈值进行比较,其中,预设占用率阈值是指影响redis性能的临界值,例如,预设占用率阈值设置为80%。That is, if the new average delay does not exceed the preset delay threshold, the server obtains the CPU occupancy rate and memory occupancy rate of redis; the server compares the CPU occupancy rate and memory occupancy rate of redis with the preset occupancy threshold value respectively. Comparison, where the preset occupancy threshold refers to the critical value that affects redis performance, for example, the preset occupancy threshold is set to 80%.
若所述redis的CPU占用率超过预设占用率阈值,或redis的内存占用率超过预设占用率阈值,则反向调整过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度,以降低redis的CPU占用率和内存占用率,这样避免redis出现故障。若redis的CPU占用率和内存占用率都未超过预设占用率阈值,则确定所述redis的***性能符合要求,这样不需要增加redis的硬件结构,通过动态调整redis的参数,就可以实现redis的性能提升。If the CPU occupancy rate of redis exceeds the preset occupancy threshold, or the memory occupancy rate of redis exceeds the preset occupancy threshold, then reversely adjust the timeout corresponding to the expiration notification, the number of queues in the query queue, or the query The queue length of the queue to reduce the CPU usage and memory usage of redis, thus avoiding redis failure. If the CPU occupancy rate and memory occupancy rate of redis do not exceed the preset occupancy threshold, it is determined that the system performance of redis meets the requirements. In this way, there is no need to increase the hardware structure of redis. By dynamically adjusting the parameters of redis, redis can be realized performance improvement.
为了方便理解,继续参照图4,服务器中性能调整***的控制服务会获取用户给的预期延时L,并定时拉取查询服务的平均延时信息以及redis的CPU和内存占用率信息,通过不断调节队列数量M、队列长度N以及超时时间T这3个参数的值维持查询服务的平均延时低于L,同时控制redisCPU和内存占用率在合理的范围内。调节规则如下:在查询 服务第一次启动时,会给这3个参数分配经验值M=2,N=500,T=5ms。当拉取到的平均延时高于L时,会保持M,N,T中其中2个不变,增加会降低另1个参数的值的方式进行调整,如果平均延时有降低,就会按同样的方式调整该参数的值直到平均延时不再降低为止。如果参数的调节导致redis的cpu或内存占用超过了阀值,则会回退该参数的优化并尝试优化另外2个参数的值。To facilitate understanding, continue to refer to Figure 4. The control service of the performance adjustment system in the server will obtain the expected delay L given by the user, and regularly pull the average delay information of the query service and the CPU and memory usage information of redis. Through continuous Adjust the values of the three parameters of queue number M, queue length N and timeout time T to keep the average query service delay below L, and at the same time control the redisCPU and memory usage within a reasonable range. The adjustment rules are as follows: In query When the service is started for the first time, these three parameters will be assigned experience values M=2, N=500, and T=5ms. When the average delay obtained is higher than L, two of M, N, and T will be kept unchanged, and the increase will decrease the value of the other parameter. If the average delay decreases, it will Adjust the value of this parameter in the same manner until the average delay no longer decreases. If the adjustment of a parameter causes the CPU or memory usage of redis to exceed the threshold, the optimization of the parameter will be rolled back and an attempt will be made to optimize the values of the other two parameters.
本实施例中服务器给出了redis参数调整的具体实现方式,通过调整队列数量M、队列长度N以及超时时间T,使得redis的性能可以满足要求,极大地减少了手动干预,提升了***的稳定性,只需给控制服务指定预期的延时时间即可。In this embodiment, the server provides a specific implementation method for redis parameter adjustment. By adjusting the queue number M, queue length N and timeout time T, the performance of redis can meet the requirements, greatly reducing manual intervention and improving the stability of the system. , just specify the expected delay time for the control service.
参照图6,图6是本申请实施例中提供的基于redis的性能调整方法中查询请求分配的一个实施例流程示意图。Referring to Figure 6, Figure 6 is a schematic flowchart of an embodiment of query request allocation in the redis-based performance adjustment method provided in the embodiment of this application.
在本申请一些实施例中,步骤201将redis查询请求分配至预设的查询队列,具体地包括步骤501-503:In some embodiments of this application, step 201 allocates the redis query request to a preset query queue, specifically including steps 501-503:
501,通过查询服务模块解析查询请求,提取对redis的查询请求。501. Parse the query request through the query service module and extract the query request for redis.
服务器通过查询服务模块解析查询请求,提取对redis的查询请求,即,本实施例中通过性能调整***对查询请求进行筛选,提取对redis的查询请求,以根据对redis的查询请求对redis进行性能调整。The server parses the query request through the query service module and extracts the query request for redis. That is, in this embodiment, the query request is filtered through the performance adjustment system and the query request for redis is extracted to perform performance evaluation on redis based on the query request for redis. Adjustment.
502,获取对redis的所述查询请求的请求数量,以及预设的查询队列的队列数量,以及各所述查询队列的队列长度。502. Obtain the number of query requests to redis, the number of preset query queues, and the queue length of each query queue.
服务器获取对redis的查询请求的请求数量,以及预设的查询队列的队列数量,以及各所述查询队列的队列长度,这里的队列长度包括队列实时的长度和查询队列的队列长度阈值,例如,查询队列的长度中实时长度为300,队列长度阈值为500。The server obtains the number of requests for redis query requests, as well as the preset number of query queues, and the queue length of each query queue. The queue length here includes the real-time length of the queue and the queue length threshold of the query queue, for example, The real-time length of the query queue is 300, and the queue length threshold is 500.
503,根据所述队列数量和所述队列长度,将所述请求数量的所述查询请求分配至各所述查询队列。503. According to the queue number and the queue length, allocate the query requests of the requested number to each of the query queues.
服务器根据队列数量和所述队列长度,将请求数量的所述查询请求分配至各所述查询队列,即,本实施例中服务器根据查询队列的队列数量和队列长度,对请求数量个查询请求进行分配,可以使得各个查询队列的队列长度更加平均,减少队列中请求的延时。The server allocates the requested number of query requests to each of the query queues according to the number of queues and the queue length. That is, in this embodiment, the server distributes the requested number of query requests according to the number of queues and the queue length of the query queue. Distribution can make the queue length of each query queue more even and reduce the delay of requests in the queue.
参照图7,图7是本申请实施例中提供的基于redis的性能调整方法中初始参数配置一个实施例的流程示意图。Referring to Figure 7, Figure 7 is a schematic flow chart of an embodiment of initial parameter configuration in the redis-based performance adjustment method provided in the embodiment of this application.
在本申请一些实施例中,本申请实施例步骤201将redis查询请求分配至预设的查询队列之前,基于redis的性能调整方法还包括步骤601-603:In some embodiments of the present application, before allocating the redis query request to the preset query queue in step 201 of the embodiment of the present application, the redis-based performance adjustment method also includes steps 601-603:
601,通过预设的查询服务模块拉取redis查询请求的平均延时;601. Pull the average delay of redis query requests through the preset query service module;
602,接收用户设置的预期延时,根据所述预期延时和所述平均延时,配置redis对应查询队列的队列数量和队列长度;602. Receive the expected delay set by the user, and configure the queue number and queue length of the query queue corresponding to redis according to the expected delay and the average delay;
603,将所述平均延时设置为过期通知初始的超时时间,将所述队列数量和所述队列长度设置为所述查询队列初始的队列信息。603. Set the average delay as the initial timeout time of the expiration notification, and set the queue number and the queue length as the initial queue information of the query queue.
本实施例中在执行redis的性能调整之前,需要预先设置redis的相关参数,本实施例中给出一种初始参数设置的方式,具体地包括:服务器通过预设的查询服务模块拉取redis查询请求的平均延时;服务器接收用户设置的预期延时,根据预期延时和平均延时,配置redis对应查询队列的队列数量和队列长度;服务器将所述平均延时设置为过期通知初始的超时时间,将所述队列数量和所述队列长度设置为所述查询队列初始的队列信息。In this embodiment, before performing redis performance adjustment, it is necessary to pre-set the relevant parameters of redis. This embodiment provides an initial parameter setting method, which specifically includes: the server pulls the redis query through the preset query service module. The average delay of the request; the server receives the expected delay set by the user, and configures the queue number and queue length of the redis corresponding query queue based on the expected delay and the average delay; the server sets the average delay as the initial timeout of the expiration notification time, and set the queue number and the queue length as the initial queue information of the query queue.
本实施例中服务器可以根据用户的平均延时设置为过期通知初始的超时时间;根据预期延时和平均延时,配置redis对应查询队列的队列数量和队列长度;服务器进行查询请求分配时,根据初始的队列信息进行请求分配,方便后期进行参数调整。In this embodiment, the server can set the initial timeout time of the expiration notification based on the user's average delay; configure the queue number and queue length of the redis corresponding query queue based on the expected delay and average delay; when the server distributes query requests, according to The initial queue information is requested for allocation to facilitate subsequent parameter adjustment.
如图8所示,图8是本申请实施例中提供的基于redis的性能调整装置的一个实施例结构示意图。 As shown in Figure 8, Figure 8 is a schematic structural diagram of an embodiment of the redis-based performance adjustment device provided in the embodiment of the present application.
为了更好实施本申请实施例中基于redis的性能调整方法,在基于redis的性能调整方法基础之上,本申请实施例中还提供一种基于redis的性能调整装置,所述基于redis的性能调整装置包括:In order to better implement the redis-based performance adjustment method in the embodiment of the present application, on the basis of the redis-based performance adjustment method, the embodiment of the present application also provides a redis-based performance adjustment device. The redis-based performance adjustment device Devices include:
分配模块701,用于将redis查询请求分配至预设的查询队列;Distribution module 701, used to distribute redis query requests to preset query queues;
组装模块702,用于若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;The assembly module 702 is used to assemble each query request in the query queue into a communication pipeline and submit it to the redis if the query queue receives an expiration notification;
确定模块703,用于接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;The determination module 703 is used to receive the query results fed back by the redis based on the communication channel, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
调整模块704,用于若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。The adjustment module 704 is used to adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue if the system performance of the redis does not meet the requirements until the system performance of the redis meets the requirements.
在本申请一些实施例中,所述的基于redis的性能调整装置中执行所述若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交之前,包括:In some embodiments of the present application, the redis-based performance adjustment device performs the step of assembling each query request in the query queue into a communication pipeline and sending the query request to the query queue if the query queue receives an expiration notification. Before the redis is submitted, include:
控制预设的时间轮向所述查询队列分配超时时间,并控制所述查询队列向所述时间轮申请过期通知管道;Control a preset time wheel to allocate a timeout to the query queue, and control the query queue to apply for an expiration notification channel from the time wheel;
若存在至少两个所述查询队列申请过期通知管道,则获取超过所述超时时间的所述查询队列的队列标识;If there are at least two query queue application expiration notification channels, obtain the queue identifier of the query queue that exceeds the timeout time;
通过所述过期通知管道发送过期通知至所述队列标识对应的查询队列。Send an expiration notification to the query queue corresponding to the queue identifier through the expiration notification pipeline.
在本申请一些实施例中,所述的基于redis的性能调整装置中确定模块703执行所述接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求,包括:In some embodiments of the present application, the determination module 703 of the redis-based performance adjustment device executes the step of receiving the query results fed back by the redis based on the communication pipeline, and determines based on the response time associated with the query results. Whether the system performance of redis meets the requirements, including:
接收所述redis基于所述通讯管道反馈的查询结果,获取所述查询结果关联的响应时间;Receive the query result fed back by the redis based on the communication channel, and obtain the response time associated with the query result;
统计各所述查询结果关联的响应时间,计算所述redis的平均延时;Count the response times associated with each query result and calculate the average delay of redis;
若所述平均延时超过预设时延阈值,则判定所述redis的***性能不符合要求。If the average delay exceeds the preset delay threshold, it is determined that the system performance of redis does not meet the requirements.
在本申请一些实施例中,所述的基于redis的性能调整装置中调整模块704,执行所述若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求,包括:In some embodiments of the present application, the adjustment module 704 in the redis-based performance adjustment device executes the step of adjusting the timeout period and/or the corresponding timeout period of the expiration notification if the system performance of the redis does not meet the requirements. Query the queue information of the queue until the system performance of the redis meets the requirements, including:
若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度;If the system performance of the redis does not meet the requirements, adjust the timeout corresponding to the expiration notification, the number of queues in the query queue, or the queue length of the query queue;
获取调整后的查询队列对应新的查询结果,根据所述新的查询结果关联的响应时间,确定新的平均延时;Obtain new query results corresponding to the adjusted query queue, and determine a new average delay based on the response time associated with the new query results;
直至所述新的平均延时不超过预设时延阈值,则确定所述redis的***性能符合要求。Until the new average delay does not exceed the preset delay threshold, it is determined that the system performance of redis meets the requirements.
在本申请一些实施例中,所述的基于redis的性能调整装置中,调整模块704执行所述直至所述新的平均延时不超过预设时延阈值,则确定所述redis的***性能符合要求,包括:In some embodiments of the present application, in the redis-based performance adjustment device, the adjustment module 704 executes until the new average delay does not exceed the preset delay threshold, then it is determined that the system performance of redis meets Requirements include:
若所述新的平均延时不超过预设时延阈值,则获取所述redis的CPU占用率和内存占用率;If the new average delay does not exceed the preset delay threshold, obtain the CPU usage and memory usage of redis;
若所述redis的CPU占用率超过预设占用率阈值,或所述redis的内存占用率超过预设占用率阈值,则反向调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度;If the CPU occupancy rate of redis exceeds the preset occupancy threshold, or the memory occupancy rate of redis exceeds the preset occupancy threshold, the timeout period corresponding to the expiration notification and the number of queues in the query queue will be adjusted in reverse Or the queue length of the query queue;
若所述redis的CPU占用率和内存占用率都未超过预设占用率阈值,则确定所述redis的***性能符合要求。If neither the CPU occupancy rate nor the memory occupancy rate of the redis exceeds the preset occupancy threshold, it is determined that the system performance of the redis meets the requirements.
在本申请一些实施例中,所述的基于redis的性能调整装置中分配模块701,执行所述将redis查询请求分配至预设的查询队列,包括: In some embodiments of the present application, the allocation module 701 in the redis-based performance adjustment device performs the allocation of redis query requests to preset query queues, including:
通过查询服务模块解析查询请求,提取对redis的查询请求;Parse the query request through the query service module and extract the query request for redis;
获取对redis的所述查询请求的请求数量,以及预设的查询队列的队列数量,以及各所述查询队列的队列长度;Obtain the number of query requests to redis, the number of preset query queues, and the queue length of each query queue;
根据所述队列数量和所述队列长度,将所述请求数量的所述查询请求分配至各所述查询队列。According to the queue number and the queue length, the query requests of the request number are allocated to each of the query queues.
在本申请一些实施例中,所述的基于redis的性能调整装置中执行所述将redis查询请求分配至预设的查询队列之前,包括:In some embodiments of the present application, before performing the process of allocating redis query requests to a preset query queue in the redis-based performance adjustment device, the process includes:
通过预设的查询服务模块拉取redis查询请求的平均延时;Pull the average delay of redis query requests through the preset query service module;
接收用户设置的预期延时,根据所述预期延时和所述平均延时,配置redis对应查询队列的队列数量和队列长度;Receive the expected delay set by the user, and configure the queue number and queue length of the redis corresponding query queue based on the expected delay and the average delay;
将所述平均延时设置为过期通知初始的超时时间,将所述队列数量和所述队列长度设置为所述查询队列初始的队列信息。The average delay is set as the initial timeout time of the expiration notification, and the queue number and the queue length are set as the initial queue information of the query queue.
本实施例中基于redis的性能调整装置:将redis查询请求分配至预设的查询队列;若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求;本申请实施例中根据查询请求关联的响应时间,可以得到redis的***是否出现响应延迟,然后确定redis的***性能是否符合要求;若redis的***性能不符合要求,则对redis的***对应的超时时间和/或查询队列的队列信息进行动态调整,使得redis的***性能符合要求,这样不需要增加redis***的硬件结构,也不需要人工干预,通过简单的参数调整,就可以提高redis的***性能。The redis-based performance adjustment device in this embodiment: allocates redis query requests to preset query queues; if the query queue receives an expiration notification, assembles each query request in the query queue into a communication pipeline and submit it to the redis; receive the query results fed back by the redis based on the communication channel, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results; if the system performance of the redis If the requirements are not met, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of the redis meets the requirements; in the embodiment of the present application, according to the response time associated with the query request, we can obtain Whether there is a response delay in the redis system, then determine whether the redis system performance meets the requirements; if the redis system performance does not meet the requirements, dynamically adjust the corresponding timeout time of the redis system and/or the queue information of the query queue, so that redis The system performance meets the requirements, so there is no need to increase the hardware structure of the redis system or manual intervention. Through simple parameter adjustment, the system performance of redis can be improved.
本发明实施例还提供一种电子设备,如图9所示,图9是本申请实施例中提供的电子设备的一个实施例结构示意图。An embodiment of the present invention also provides an electronic device, as shown in Figure 9. Figure 9 is a schematic structural diagram of an embodiment of the electronic device provided in the embodiment of the present application.
电子设备集成了本发明实施例所提供的任一种基于redis的性能调整装置,所述电子设备包括:The electronic device integrates any redis-based performance adjustment device provided by the embodiment of the present invention, and the electronic device includes:
一个或多个处理器;one or more processors;
存储器;以及memory; and
一个或多个应用程序,其中所述一个或多个应用程序被存储于所述存储器中,并配置为由所述处理器执行上述基于redis的性能调整方法实施例中任一实施例中所述的基于redis的性能调整方法中的步骤。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor as described in any of the above redis-based performance adjustment method embodiments. Steps in the redis-based performance tuning method.
具体来讲:电子设备可以包括一个或者一个以上处理核心的处理器801、一个或一个以上计算机存储介质的存储器802、电源803和输入单元804等部件。本领域技术人员可以理解,图9中示出的电子设备结构并不构成对电子设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:Specifically: the electronic device may include components such as a processor 801 of one or more processing cores, a memory 802 of one or more computer storage media, a power supply 803, and an input unit 804. Those skilled in the art can understand that the structure of the electronic device shown in FIG. 9 does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange different components. in:
处理器801是该电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器802内的软件程序和/或模块,以及调用存储在存储器802内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。可选的,处理器801可包括一个或多个处理核心;优选的,处理器801可集成应用处理器和调制解调处理器,其中,应用处理器主要处理性能调整***、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器801中。The processor 801 is the control center of the electronic device, using various interfaces and lines to connect various parts of the entire electronic device, by running or executing software programs and/or modules stored in the memory 802, and calling software programs stored in the memory 802. Data, perform various functions of the electronic device and process the data to conduct overall monitoring of the electronic device. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, where the application processor mainly processes the performance adjustment system, user interface and application programs. etc., the modem processor mainly handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 801.
存储器802可用于存储软件程序以及模块,处理器801通过运行存储在存储器802的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器802可主要包括存储程序区和存储数据区,其中,存储程序区可存储性能调整***、至少一个功能所需的应用程 序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据电子设备的使用所创建的数据等。此外,存储器802可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器802还可以包括存储器控制器,以提供处理器801对存储器802的访问。The memory 802 can be used to store software programs and modules, and the processor 801 executes various functional applications and data processing by running the software programs and modules stored in the memory 802 . The memory 802 may mainly include a stored program area and a stored data area, where the stored program area may store an application program required for the performance adjustment system and at least one function. programs (such as sound playback function, image playback function, etc.); the storage data area can store data created based on the use of electronic devices, etc. In addition, memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802 .
电子设备还包括给各个部件供电的电源803,优选的,电源803可以通过电源管理***与处理器801逻辑相连,从而通过电源管理***实现管理充电、放电、以及功耗管理等功能。电源803还可以包括一个或一个以上的直流或交流电源、再充电***、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The electronic device also includes a power supply 803 that supplies power to various components. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system. The power supply 803 may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
该电子设备还可包括输入单元804,该输入单元804可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。The electronic device may also include an input unit 804 that may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical, or trackball signal input related to user settings and function control.
尽管未示出,电子设备还可以包括显示单元等,在此不再赘述。具体在本实施例中,电子设备中的处理器801会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行文件加载到存储器802中,并由处理器801来运行存储在存储器802中的应用程序,从而实现各种功能,如下:Although not shown, the electronic device may also include a display unit and the like, which will not be described again here. Specifically, in this embodiment, the processor 801 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 802 according to the following instructions, and the processor 801 will run the executable files stored in The application program in the memory 802 implements various functions, as follows:
将redis查询请求分配至预设的查询队列;Distribute redis query requests to the preset query queue;
若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;If the query queue receives an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis;
接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;Receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。If the system performance of redis does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of redis meets the requirements.
本领域普通技术人员可以理解,上述实施例的各种方法中的全部或部分步骤可以通过指令来完成,或通过指令控制相关的硬件来完成,该指令可以存储于一计算机存储介质中,并由处理器进行加载和执行。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer storage medium and controlled by The processor performs loading and execution.
为此,本发明实施例提供一种计算机存储介质,该计算机存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)、磁盘或光盘等。其上存储有计算机程序,所述计算机程序被处理器进行加载,以执行本发明实施例所提供的任一种基于redis的性能调整方法中的步骤。例如,所述计算机程序被处理器进行加载可以执行如下步骤:To this end, embodiments of the present invention provide a computer storage medium. The computer storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc. A computer program is stored thereon, and the computer program is loaded by the processor to execute the steps in any of the redis-based performance adjustment methods provided by the embodiments of the present invention. For example, when the computer program is loaded by the processor, the following steps may be performed:
将redis查询请求分配至预设的查询队列;Distribute redis query requests to the preset query queue;
若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;If the query queue receives an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis;
接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;Receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。If the system performance of redis does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of redis meets the requirements.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对其他实施例的详细描述,此处不再赘述。In the above embodiments, each embodiment is described with its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the above detailed descriptions of other embodiments and will not be described again here.
具体实施时,以上各个单元或结构可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个单元或结构的具体实施可参见前面的方法实施例,在此不再赘述。During specific implementation, each of the above units or structures can be implemented as an independent entity, or can be combined in any way and implemented as the same or several entities. For the specific implementation of each of the above units or structures, please refer to the previous method embodiments. Here No longer.
以上各个操作的具体实施可参见前面的实施例,在此不再赘述。For the specific implementation of each of the above operations, please refer to the previous embodiments and will not be described again here.
以上对本申请实施例所提供的一种基于redis的性能调整方法进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮 助理解本发明的方法及其核心思想;同时,对于本领域的技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 The above is a detailed introduction to a redis-based performance adjustment method provided by the embodiments of the present application. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for assistance. To help understand the method and core idea of the present invention; at the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of the present invention. In summary, the content of this specification does not It should be understood as a limitation of the invention.

Claims (10)

  1. 一种基于redis的性能调整方法,其特征在于,所述基于redis的性能调整方法包括:A redis-based performance adjustment method, characterized in that the redis-based performance adjustment method includes:
    将redis查询请求分配至预设的查询队列;Distribute redis query requests to the preset query queue;
    若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;If the query queue receives an expiration notification, assemble each query request in the query queue into a communication pipeline and submit it to the redis;
    接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;Receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
    若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。If the system performance of redis does not meet the requirements, adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue until the system performance of redis meets the requirements.
  2. 根据权利要求1所述的基于redis的性能调整方法,其特征在于,所述若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交之前,所述方法包括:The performance adjustment method based on redis according to claim 1, characterized in that if the query queue receives an expiration notification, each query request in the query queue is assembled into a communication pipeline and sent to the query queue. Before the redis is submitted, the method includes:
    控制预设的时间轮向所述查询队列分配超时时间,并控制所述查询队列向所述时间轮申请过期通知管道;Control a preset time wheel to allocate a timeout to the query queue, and control the query queue to apply for an expiration notification channel from the time wheel;
    若存在至少两个所述查询队列申请过期通知管道,则获取超过所述超时时间的所述查询队列的队列标识;If there are at least two query queue application expiration notification channels, obtain the queue identifier of the query queue that exceeds the timeout period;
    通过所述过期通知管道发送过期通知至所述队列标识对应的查询队列。Send an expiration notification to the query queue corresponding to the queue identifier through the expiration notification pipeline.
  3. 根据权利要求1所述的基于redis的性能调整方法,其特征在于,所述接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求,包括:The performance adjustment method based on redis according to claim 1, characterized in that: receiving the query results fed back by the redis based on the communication pipeline, and determining the redis based on the response time associated with the query results. Whether the system performance meets the requirements, including:
    接收所述redis基于所述通讯管道反馈的查询结果,获取所述查询结果关联的响应时间;Receive the query result fed back by the redis based on the communication channel, and obtain the response time associated with the query result;
    统计各所述查询结果关联的响应时间,计算所述redis的平均延时;Count the response times associated with each query result and calculate the average delay of redis;
    若所述平均延时超过预设时延阈值,则判定所述redis的***性能不符合要求。If the average delay exceeds the preset delay threshold, it is determined that the system performance of redis does not meet the requirements.
  4. 根据权利要求1所述的基于redis的性能调整方法,其特征在于,所述若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求,包括:The redis-based performance adjustment method according to claim 1, characterized in that if the system performance of the redis does not meet the requirements, the timeout corresponding to the expiration notification and/or the queue of the query queue is adjusted. Information until the redis system performance meets the requirements, including:
    若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度;If the system performance of the redis does not meet the requirements, adjust the timeout corresponding to the expiration notification, the number of queues in the query queue, or the queue length of the query queue;
    获取调整后的查询队列对应新的查询结果,根据所述新的查询结果关联的响应时间,确定新的平均延时;Obtain new query results corresponding to the adjusted query queue, and determine a new average delay based on the response time associated with the new query results;
    直至所述新的平均延时不超过预设时延阈值,则确定所述redis的***性能符合要求。Until the new average delay does not exceed the preset delay threshold, it is determined that the system performance of redis meets the requirements.
  5. 根据权利要求4所述的基于redis的性能调整方法,其特征在于,所述直至所述新的平均延时不超过预设时延阈值,则确定所述redis的***性能符合要求,包括:The performance adjustment method based on redis according to claim 4, characterized in that until the new average delay does not exceed a preset delay threshold, it is determined that the system performance of redis meets the requirements, including:
    若所述新的平均延时不超过预设时延阈值,则获取所述redis的CPU占用率和内存占用率;If the new average delay does not exceed the preset delay threshold, obtain the CPU usage and memory usage of redis;
    若所述redis的CPU占用率超过预设占用率阈值,或所述redis的内存占用率超过预设占用率阈值,则反向调整所述过期通知对应的超时时间、所述查询队列的队列数量或所述查询队列的队列长度;If the CPU occupancy rate of redis exceeds the preset occupancy threshold, or the memory occupancy rate of redis exceeds the preset occupancy threshold, the timeout period corresponding to the expiration notification and the number of queues in the query queue will be adjusted in reverse Or the queue length of the query queue;
    若所述redis的CPU占用率和内存占用率都未超过预设占用率阈值,则确定所述redis的***性能符合要求。 If neither the CPU occupancy rate nor the memory occupancy rate of the redis exceeds the preset occupancy threshold, it is determined that the system performance of the redis meets the requirements.
  6. 根据权利要求1所述的基于redis的性能调整方法,其特征在于,所述将redis查询请求分配至预设的查询队列,包括:The redis-based performance adjustment method according to claim 1, wherein the allocating the redis query request to a preset query queue includes:
    通过查询服务模块解析查询请求,提取对redis的查询请求;Parse the query request through the query service module and extract the query request for redis;
    获取对redis的所述查询请求的请求数量,以及预设的查询队列的队列数量,以及各所述查询队列的队列长度;Obtain the number of query requests to redis, the number of preset query queues, and the queue length of each query queue;
    根据所述队列数量和所述队列长度,将所述请求数量的所述查询请求分配至各所述查询队列。According to the queue number and the queue length, the query requests of the request number are allocated to each of the query queues.
  7. 根据权利要求1-6任一项所述的基于redis的性能调整方法,其特征在于,所述将redis查询请求分配至预设的查询队列之前,所述方法包括:The redis-based performance adjustment method according to any one of claims 1-6, characterized in that, before allocating the redis query request to the preset query queue, the method includes:
    通过预设的查询服务模块拉取redis查询请求的平均延时;Pull the average delay of redis query requests through the preset query service module;
    接收用户设置的预期延时,根据所述预期延时和所述平均延时,配置redis对应查询队列的队列数量和队列长度;Receive the expected delay set by the user, and configure the queue number and queue length of the redis corresponding query queue based on the expected delay and the average delay;
    将所述平均延时设置为过期通知初始的超时时间,将所述队列数量和所述队列长度设置为所述查询队列初始的队列信息。The average delay is set as the initial timeout time of the expiration notification, and the queue number and the queue length are set as the initial queue information of the query queue.
  8. 一种基于redis的性能调整装置,其特征在于,所述基于redis的性能调整装置包括:A redis-based performance adjustment device, characterized in that the redis-based performance adjustment device includes:
    分配模块,用于将redis查询请求分配至预设的查询队列;Distribution module, used to distribute redis query requests to preset query queues;
    组装模块,用于若所述查询队列接收到过期通知,则将所述查询队列中的各所述查询请求组装成通讯管道并向所述redis提交;An assembly module, configured to assemble each query request in the query queue into a communication pipeline and submit it to the redis if the query queue receives an expiration notification;
    确定模块,用于接收所述redis基于所述通讯管道反馈的查询结果,并根据所述查询结果关联的响应时间,确定所述redis的***性能是否符合要求;A determination module configured to receive the query results fed back by the redis based on the communication pipeline, and determine whether the system performance of the redis meets the requirements based on the response time associated with the query results;
    调整模块,用于若所述redis的***性能不符合要求,则调整所述过期通知对应的超时时间和/或所述查询队列的队列信息,直至所述redis的***性能符合要求。An adjustment module, configured to adjust the timeout corresponding to the expiration notification and/or the queue information of the query queue if the system performance of the redis does not meet the requirements until the system performance of the redis meets the requirements.
  9. 一种电子设备,其特征在于,所述电子设备包括:An electronic device, characterized in that the electronic device includes:
    一个或多个处理器;one or more processors;
    存储器;以及memory; and
    一个或多个应用程序,其中所述一个或多个应用程序被存储于所述存储器中,并配置为由所述处理器执行以实现权利要求1至7中任一项所述的基于redis的性能调整方法中的步骤。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the redis-based method of any one of claims 1 to 7 Steps in the performance tuning method.
  10. 一种计算机存储介质,其特征在于,其上存储有计算机程序,所述计算机程序被处理器进行加载,以执行权利要求1至7任一项所述的基于redis的性能调整方法中的步骤。 A computer storage medium, characterized in that a computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the redis-based performance adjustment method described in any one of claims 1 to 7.
PCT/CN2023/112963 2022-06-14 2023-08-14 Redis-based performance adjustment method and apparatus, electronic device and medium WO2023241742A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210674807.8 2022-06-14
CN202210674807.8A CN117271597A (en) 2022-06-14 2022-06-14 Redis-based performance adjustment method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
WO2023241742A1 true WO2023241742A1 (en) 2023-12-21

Family

ID=89192361

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/112963 WO2023241742A1 (en) 2022-06-14 2023-08-14 Redis-based performance adjustment method and apparatus, electronic device and medium

Country Status (2)

Country Link
CN (1) CN117271597A (en)
WO (1) WO2023241742A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8321515B1 (en) * 2009-04-22 2012-11-27 Sprint Communications Company L.P. Defined delays to support consistent tiered messaging performance
US20160094640A1 (en) * 2014-09-25 2016-03-31 International Business Machines Corporation Processing a message received by a message server
CN113010552A (en) * 2021-03-02 2021-06-22 腾讯科技(深圳)有限公司 Data processing method, system, computer readable medium and electronic device
CN113282619A (en) * 2021-04-13 2021-08-20 国网山东省电力公司物资公司 Data rapid query method and system
CN113419832A (en) * 2021-06-24 2021-09-21 广州欢网科技有限责任公司 Processing method and device of delay task and terminal
CN113625954A (en) * 2021-06-30 2021-11-09 济南浪潮数据技术有限公司 Volume information query method, device, equipment and readable storage medium
CN114490744A (en) * 2021-12-13 2022-05-13 中企云链(北京)金融信息服务有限公司 Data caching method, storage medium and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8321515B1 (en) * 2009-04-22 2012-11-27 Sprint Communications Company L.P. Defined delays to support consistent tiered messaging performance
US20160094640A1 (en) * 2014-09-25 2016-03-31 International Business Machines Corporation Processing a message received by a message server
CN113010552A (en) * 2021-03-02 2021-06-22 腾讯科技(深圳)有限公司 Data processing method, system, computer readable medium and electronic device
CN113282619A (en) * 2021-04-13 2021-08-20 国网山东省电力公司物资公司 Data rapid query method and system
CN113419832A (en) * 2021-06-24 2021-09-21 广州欢网科技有限责任公司 Processing method and device of delay task and terminal
CN113625954A (en) * 2021-06-30 2021-11-09 济南浪潮数据技术有限公司 Volume information query method, device, equipment and readable storage medium
CN114490744A (en) * 2021-12-13 2022-05-13 中企云链(北京)金融信息服务有限公司 Data caching method, storage medium and electronic device

Also Published As

Publication number Publication date
CN117271597A (en) 2023-12-22

Similar Documents

Publication Publication Date Title
JP6637186B2 (en) Resource allocation for computer processing
US8145759B2 (en) Dynamically configurable resource pool
JP4970939B2 (en) Hierarchical management of dynamic resource allocation in multi-node systems
CN108009236A (en) A kind of big data querying method, system, computer and storage medium
WO2019153488A1 (en) Service configuration management method, apparatus, storage medium and server
US20120330915A1 (en) Streaming transaction notifications
WO2021134861A1 (en) Method for managing resource state information, and resource downloading system
CN111786895A (en) Method and apparatus for dynamic global current limiting
US20210389995A1 (en) Information processing system and control method
KR20090054424A (en) Workload manager for relational database management systems
US20100333104A1 (en) Service-Based Endpoint Discovery for Client-Side Load Balancing
WO2018223789A1 (en) Method and system for performing operation with respect to transaction id, and computer readable storage medium
EP3567491A1 (en) Workload aware data placement for join-based query processing in a cluster
US11947534B2 (en) Connection pools for parallel processing applications accessing distributed databases
WO2023241742A1 (en) Redis-based performance adjustment method and apparatus, electronic device and medium
US10164889B1 (en) High throughput flow control
WO2020094064A1 (en) Performance optimization method, device, apparatus, and computer readable storage medium
CN114201294A (en) Task processing method, device and system, electronic equipment and storage medium
CN109977140B (en) Transaction data query method, device and system
EP4357916A1 (en) Job processing method and apparatus, computer device, and storage medium
CN112615795A (en) Flow control method and device, electronic equipment, storage medium and product
EP3602294B1 (en) Systems, methods, and apparatuses for pausing and resuming a virtual assistant
CN113986523A (en) Method, system, equipment and medium for optimizing resource allocation of Flink system
CN115904640A (en) Distributed task processing system and method
CN112966051A (en) Distributed data exchange system and method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23823308

Country of ref document: EP

Kind code of ref document: A1