CN114238037A - High-concurrency service request result storage method and device, electronic equipment and storage medium - Google Patents

High-concurrency service request result storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114238037A
CN114238037A CN202210183124.2A CN202210183124A CN114238037A CN 114238037 A CN114238037 A CN 114238037A CN 202210183124 A CN202210183124 A CN 202210183124A CN 114238037 A CN114238037 A CN 114238037A
Authority
CN
China
Prior art keywords
service request
target database
requests per
result
request result
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202210183124.2A
Other languages
Chinese (zh)
Other versions
CN114238037B (en
Inventor
庞世娜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jindi Technology Co Ltd
Original Assignee
Beijing Jindi Technology Co Ltd
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 Beijing Jindi Technology Co Ltd filed Critical Beijing Jindi Technology Co Ltd
Priority to CN202210183124.2A priority Critical patent/CN114238037B/en
Publication of CN114238037A publication Critical patent/CN114238037A/en
Application granted granted Critical
Publication of CN114238037B publication Critical patent/CN114238037B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method and a device for storing a high-concurrency service request result, an electronic device and a storage medium, wherein the method comprises the following steps: caching the high-concurrency service request result and calculating the total quantity of the requests per second of the high-concurrency service request result; acquiring a total quantity threshold value of the requests per second of the target database and the total quantity of the requests per second of all service request results executed by the target database, and calculating to obtain the current remaining total quantity of the requests per second of the target database according to the total quantity threshold value and the total quantity of the requests per second of the target database; in response to a comparison result that the total number of requests per second of the high concurrent service request result is less than or equal to the current remaining total number of requests per second of the target database, storing the high concurrent service request result in the target database. The technical scheme of the invention can ensure that the target database can run safely, stably, efficiently and express, and can ensure that the target database is fully utilized.

Description

High-concurrency service request result storage method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for storing a result of a high-concurrency service request, an electronic device, and a storage medium.
Background
With the advent of the big data era, a large number of service request results are frequently generated in different application scenarios, and these high concurrent service request results have a great influence on the operation performance of the target database, for example, the high concurrent service request results may cause the target database to be down due to the large number of service request results.
Therefore, a method and an apparatus for storing a high-concurrency service request result, an electronic device, and a storage medium, which can ensure that a target database runs safely, stably, efficiently, and in a courier manner, and can ensure that the target database is fully utilized, are lacking in the prior art.
Disclosure of Invention
An object of the present invention is to provide a method and an apparatus for storing a result of a highly concurrent service request, and an electronic device and a storage medium, to solve the above-mentioned problems in the related art.
According to a first aspect of the present invention, there is provided a method for storing results of high concurrent service requests, the method comprising:
receiving and executing a high concurrency service request result to obtain a corresponding high concurrency service request result;
caching the high-concurrency service request result;
calculating the total quantity of the requests per second of the high concurrency service request result according to the cached high concurrency service request result;
acquiring a total quantity threshold value of the requests per second of the target database and the total quantity of the requests per second of all service request results executed by the target database;
calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database;
in response to a comparison result that the total number of requests per second of the high concurrent service request result is less than or equal to the current remaining total number of requests per second of the target database, storing the high concurrent service request result in the target database.
According to a second aspect of the present invention, there is provided a high concurrency service request result storage apparatus, comprising: the system comprises a result cache module, a high concurrent service request result evaluation module and a target database;
the result caching module is used for receiving the high-concurrency service request result and caching the high-concurrency service request result;
the high concurrency service request result evaluation module is used for calculating the total quantity of the requests per second of the high concurrency service request result according to the cached high concurrency service request result; acquiring a total quantity threshold of the requests per second of the target database and the total quantity of the requests per second of all service request results being executed by the target database, and calculating to obtain the current remaining total quantity of the requests per second of the target database according to the total quantity threshold of the requests per second of the target database and the total quantity of the requests per second of all service request results being executed by the target database; responding to a comparison result that the total quantity of the request numbers per second of the high-concurrency service request results is smaller than or equal to the current residual total quantity of the request numbers per second of the target database, and storing the high-concurrency service request results into the target database by the control result cache module;
and the target database is used for storing the high-concurrency service request result.
According to a third aspect of the present invention, there is provided an electronic apparatus comprising: a memory having a computer program stored thereon; a processor for executing the computer program in memory to implement the steps of any of the above methods.
According to a fourth aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of any of the methods described above.
According to the method and the device for storing the high-concurrency service request result, the electronic device and the storage medium, whether the high-concurrency service request result is stored in the target database or not can be determined according to the comparison result of the total quantity of the request number per second of the high-concurrency service request result and the total quantity threshold value of the request number per second of the target database, namely the current operation state of the target database, so that the target database can be ensured to operate safely, stably, efficiently and quickly, the target database can be ensured to be fully utilized, and the problems of downtime and the like of the target database can be reduced.
Additional features and advantages of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
FIG. 1 is a flowchart illustrating a method for storing results of highly concurrent service requests according to an embodiment of the present invention;
FIG. 2 is another flowchart of a high concurrency service request result storage method according to a first embodiment of the present invention;
FIG. 3 is a flowchart of a first embodiment of a method for storing results of highly concurrent service requests according to the present invention;
FIG. 4 is a flowchart of a method for storing results of highly concurrent service requests according to a first embodiment of the present invention;
FIG. 5 is a flowchart of a second embodiment of a method for storing results of highly concurrent service requests according to the present invention;
FIG. 6 is a flowchart of a third embodiment of a high concurrency service request result storage device provided by the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
It should be noted that, in the present invention, the terms "first", "second", and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, nor order; the terms "S101", "S102", "S201", "S202", etc. are used to distinguish the steps and are not necessarily to be construed as performing method steps in a particular order or sequence; when the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. In addition, the plural in the present invention includes two or more, unless otherwise specified.
Exemplary method
Example one
Fig. 1 is a flowchart illustrating a method for storing results of highly concurrent service requests according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step S101: receiving and executing a high concurrency service request to obtain a corresponding high concurrency service request result;
step S102: caching the high-concurrency service request result;
step S103: calculating the total quantity of the requests per second of the high concurrency service request result according to the cached high concurrency service request result;
in this embodiment, the high concurrent service request result refers to a large number of high concurrent service request results sent to the target database at the same time, and therefore, what number of high concurrent service request results is considered to be high concurrency is determined based on the processing capability of the target database (i.e., the maximum total amount of requests per second of the target database), i.e., the number of high concurrent service request results is determined according to the processing capability of the target database (i.e., the maximum total amount of requests per second of the target database), and thus the number of high concurrent service request results is not particularly limited in this embodiment.
The types of the service request results in the high-concurrency service request results include: any one or more of the result of the high concurrent service request and the result of the high concurrent service request is charged, and of course, those skilled in the art may also select other types of high concurrent service request according to actual needs, which is not limited herein.
It should be noted that, in this embodiment, the total number of requests per second of the high concurrent service request results refers to the sum of the requests per second of all the high concurrent service request results, where the requests per second is the query rate per second (abbreviated as QPS). For example, if the high concurrent service request result includes three high concurrent service request results of R1, R2, and R3, the total number of requests per second of the high concurrent service request result is the sum of the number of requests per second of the R1 high concurrent service request result, the number of requests per second of the R2 high concurrent service request result, and the number of requests per second of the R3 high concurrent service request result, and so on, and the description thereof is omitted here.
In addition, the calculation method of the number of requests per second of the service request result in the high-concurrency service request result may adopt a calculation method in the prior art, and a person skilled in the art may select the calculation method according to actual needs, which is not limited herein.
Step S104: acquiring a total quantity threshold value of the requests per second of the target database and the total quantity of the requests per second of all service request results executed by the target database;
in this embodiment, the total amount threshold of the number of requests per second of the target database is set according to the maximum total amount of the number of requests per second of the target database, that is, the total amount threshold of the number of requests per second of the target database is set according to the maximum number of requests per second of the target database, so that a person skilled in the art can flexibly set the total amount threshold of the number of requests per second of the target database according to the maximum total amount of the number of requests per second of the target database, and the setting is not limited herein.
In order to ensure that the target database can safely, stably, efficiently and quickly process the result of the high concurrent service request, the threshold value of the total number of requests per second of the target database is preferably 80% of the maximum total number of requests per second of the target database.
It should be noted that the setting manner of the total amount threshold of the requests per second of the target database includes presetting or interactive obtaining, and a person skilled in the art may select the threshold according to actual needs, which is not limited herein. In addition, the monitoring method of the total amount threshold of the requests per second of the target database may be implemented by those skilled in the art by using the monitoring methods in the prior art, which are not limited herein, for example: the total amount threshold of requests per second of the target database may be monitored by calling a data interface of the airy cloud in the prior art, or may be monitored by consul (service registry) in combination with Prometheus in the prior art.
In this embodiment, the monitoring method for the total number of requests per second of all service request results being executed by the target database may also be adopted by those skilled in the art, and is not limited herein, for example: the total amount of requests per second of all the service request results being executed by the target database may be monitored by calling a data interface of the airy cloud in the prior art, or may be monitored by consul (service registry) in combination with Prometheus (prometix) in the prior art.
Step S105: calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database;
in this embodiment, the current remaining total number of requests per second for the target database is the difference between the total threshold number of requests per second for the target database and the total number of requests per second for all service request results being executed by the target database.
Step S106: in response to a comparison result that the total number of requests per second of the high concurrent service request result is less than or equal to the current remaining total number of requests per second of the target database, storing the high concurrent service request result in the target database.
In this embodiment, in order to ensure that the cached high concurrent service request result can be quickly and efficiently stored in the target database, it is preferable to store the cached high concurrent service request result in the target database in an asynchronous and synchronous manner.
In this embodiment, as shown in fig. 1, after step S105, the method may further include:
step S107: in response to a comparison result that the total number of requests per second of the high concurrency service request results is greater than the current remaining total number of requests per second of the target database, the high concurrency service request results wait to be stored.
In an alternative embodiment, as shown in fig. 2, after step S107, the method further comprises:
step S1081: acquiring the total quantity of the request number per second of the cached high concurrent service request results, the total quantity threshold of the request number per second of the target database and the total quantity of the request number per second of all the service request results being executed by the target database;
step S1082: calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database;
step S1083: when the total amount of the request number per second responding to the high concurrent service request result is less than or equal to the current remaining total amount of the request number per second of the target database, the high concurrent service request result is stored in the target database;
step S1084: in response to a comparison result that the total number of requests per second of the high concurrency service request results is greater than the current remaining total number of requests per second of the target database, the high concurrency service request results wait to be stored.
After step S1084, the method in this embodiment may further jump to step S1081, so as to loop through steps S1081 to S1084, so as to store the cached high concurrent service request result in the target database when the current operating state of the target database meets the requirement.
In this alternative embodiment, when there is a situation where the high concurrent service request result is waiting to be stored, the method can perform monitoring of the current operating state of the target database, so as to determine whether the high concurrent service request result is stored to the target database or continues to wait to be stored according to the current operating state of the target database. The method can ensure that the target database can run safely, stably, efficiently and quickly, can ensure that the target database is fully utilized, and can reduce the probability of the problems of downtime and the like of the target database.
In another alternative embodiment, as shown in fig. 3, after step S107, the method further includes:
step S1091: marking corresponding timestamps for the high concurrent service request results according to the cache time sequence, and sequencing the high concurrent service request results according to the sequence of the timestamps to obtain a high concurrent service request result queue;
step S1092: acquiring the total quantity of requests per second of all service request results executed by a target database;
step S1093: calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database;
step S1094: extracting the current residual total amount of high concurrent service request results which are less than or equal to the requests per second of the target database in the high concurrent service request result queue according to the sequence of the timestamps, and storing the high concurrent service request results in the target database;
step S1095: the high concurrent service request results remaining in the high concurrent service request result queue continue to wait for storage.
Optionally, as shown in fig. 4, after step S1095, the method further includes:
step S1101: after continuing to cache the new high concurrent service request result, marking the corresponding timestamps for the high concurrent service request result according to the cache time sequence, sequencing the timestamps in sequence, and adding the timestamps to the remaining high concurrent service request result in the high concurrent service request result queue to obtain a new high concurrent service request result queue;
step S1102: acquiring the total quantity of requests per second of all service request results executed by a target database;
step S1103: calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database;
step S1104: extracting the current residual total amount of high concurrent service request results which are less than or equal to the requests per second of the target database in the high concurrent service request result queue according to the sequence of the timestamps, and storing the high concurrent service request results in the target database;
step S1105: the high concurrent service request results remaining in the high concurrent service request result queue continue to wait for storage.
After step S1105, since there is a high concurrent service request result in the high concurrent service request result queue, it is possible to jump to step S1101 after step S1105 and to loop the above-described steps S1101 to S1105.
In this alternative embodiment, when there is a situation where the high concurrent service request result is waiting to be stored, the method can implement monitoring the current operating state of the target database, thereby determining the specific number of the high concurrent service request results stored to the target database according to the current operating state of the target database. The method can ensure that the target database can run safely, stably, efficiently and quickly, can ensure that the target database is fully utilized, and can reduce the probability of the problems of downtime and the like of the target database.
It should be noted that the method shown in fig. 4 includes steps S101 to S107 and steps S1091 to S1095, which are not shown for the purpose of making fig. 4 simpler and more intuitive. As shown in fig. 2 to 4, steps S1081 to S1084 and steps S1091 to S1105 are two parallel technical solutions, which may be used alone or in combination, for example, steps S1091 to S1105 are adopted after steps S1081 to S1084, or steps S1081 to S1084 are adopted after steps S1091 to S1105, and those skilled in the art may flexibly select the solutions according to actual needs, which is not limited herein.
The method for storing the high-concurrency service request result provided by this embodiment can also determine whether the high-concurrency service request result is stored in the target database according to a comparison result between the total amount of the number of requests per second of the high-concurrency service request result and the total amount threshold of the number of requests per second of the target database, that is, the current operation state of the target database, so that not only can the target database be ensured to operate safely, stably, efficiently and expressedly, but also the target database can be ensured to be fully utilized, and the probability of problems such as downtime of the target database can be reduced.
Example two
Fig. 5 is a flowchart of a second embodiment of a method for storing results of highly concurrent service requests according to the present invention. As shown in fig. 5, the method includes: the method for storing the result of the high concurrent service request in the first embodiment (excluding step S101), and the following steps:
step S111: receiving a high-concurrency service request, and calculating the total amount of the requests per second of the high-concurrency service request according to the high-concurrency service request;
in this embodiment, the high-concurrency service request refers to a large number of users initiating service requests to the target execution module at the same time, and therefore, what number of service requests is considered to be high concurrency is determined based on the execution processing capability of the target execution module (i.e., the maximum total number of requests per second of the target execution module), that is, the number of high-concurrency service requests is determined according to the execution processing capability of the target execution module (i.e., the maximum total number of requests per second of the target execution module), and therefore, the number of high-concurrency service requests is not specifically limited in this embodiment.
The types of the service requests in the high-concurrency service requests comprise: any one or more of the recharging service request and the consuming service request, and of course, those skilled in the art may select other kinds of service requests according to actual needs, which is not limited herein.
It should be noted that, in this embodiment, the total number of requests per second of the high concurrent service requests refers to a sum of the requests per second of all the service requests in the high concurrent service requests, where the requests per second is a query rate per second (abbreviated as QPS). For example, if the high-concurrency service request includes three service requests R1, R2, and R3, the total number of requests per second of the high-concurrency service request is the sum of the number of requests per second of the R1 service request, the number of requests per second of the R2 service request, and the number of requests per second of the R3 service request, and so on, and will not be described herein again.
In addition, the calculation method of the number of requests per second of the service request in the high-concurrency service request may adopt a calculation method in the prior art, and a person skilled in the art may select the calculation method according to actual needs, which is not limited herein.
Step S112: determining the sending mode of the high concurrent service request to be a synchronous sending mode or an asynchronous sending mode in response to the comparison result of the total quantity of the requests per second of the high concurrent service request and the total quantity threshold of the requests per second of the target execution module;
in this embodiment, the total amount threshold of the number of requests per second of the target execution module is set according to the maximum total amount of the number of requests per second of the target execution module, that is, the total amount threshold of the number of requests per second of the target execution module is set according to the maximum number of requests per second of the target execution module, so that a person skilled in the art can flexibly set the total amount threshold of the number of requests per second of the target execution module according to the maximum total amount of the number of requests per second of the target execution module, and the setting is not limited herein.
In order to ensure that the target execution module can safely, stably, efficiently and quickly execute the high concurrent service requests, the threshold value of the total number of requests per second of the target execution module is preferably 80% of the maximum total number of requests per second of the target execution module.
It should be noted that the setting manner of the total amount threshold of the requests per second of the target execution module includes presetting or interactive obtaining, and a person skilled in the art may select the threshold according to actual needs, which is not limited herein. In addition, the monitoring method of the total amount threshold of the requests per second of the target execution module may adopt a monitoring method in the prior art by those skilled in the art, which is not limited herein, for example: the total threshold of the number of requests per second of the target execution module may be monitored by calling a data interface of the airy cloud in the prior art, or may be monitored by consul (service registry) in combination with Prometheus (promethas) in the prior art.
Optionally, in this embodiment, step S112 specifically includes:
responding to the comparison result of the total amount of the requests per second of the high concurrent service requests and the total amount threshold of the requests per second of the target execution module;
when the comparison result is that the total quantity of the requests per second of the high concurrent service requests is less than or equal to the total quantity threshold of the requests per second of the target execution module, the sending mode of the high concurrent service requests is a synchronous sending mode;
and when the comparison result is that the total quantity of the requests per second of the high concurrent service requests is greater than the total quantity threshold value of the requests per second of the target execution module, the sending mode of the high concurrent service requests is an asynchronous sending mode.
Step S113: the sending mode responding to the high concurrency service request is a synchronous sending mode: after the target execution module receives the high concurrency service request sent in a synchronous sending mode, executing the high concurrency service request;
step S114: the sending mode responding to the high concurrency service request is an asynchronous sending mode: and caching the high-concurrency service request, and executing the high-concurrency service request after the target execution module receives the cached high-concurrency service request.
As shown in fig. 5, step S114 may specifically include:
step S1141: the sending mode responding to the high concurrency service request is an asynchronous sending mode: caching the high concurrent service request;
step S1142: and after the target execution module receives the cached high concurrency service request, executing the high concurrency service request.
In an alternative implementation, as shown in fig. 5, after the caching the high concurrent service request in step S114, that is, after step S1141, the method of this embodiment further includes:
step S115: acquiring the total amount of the request number per second of the cached high concurrent service requests, the total amount threshold value of the request number per second of the target execution module and the total amount of the request number per second of all the service requests executed by the target execution module;
step S116: calculating the current remaining total amount of the request number per second of the target execution module according to the total amount threshold of the request number per second of the target execution module and the total amount of the request number per second of all service requests being executed by the target execution module;
step S117: and responding to a comparison result that the total quantity of the requests per second of the high concurrent service requests is larger than the current remaining total quantity of the requests per second of the target execution module, and sending the cached high concurrent service requests to the standby execution module for execution.
In another alternative implementation, as shown in fig. 5, after caching the high concurrent service request in step S114, that is, between step S1141 and step S1142, the method of this embodiment further includes:
step S115: acquiring the total amount of the request number per second of the cached high concurrent service requests, the total amount threshold value of the request number per second of the target execution module and the total amount of the request number per second of all the service requests executed by the target execution module;
step S116: calculating the current remaining total amount of the request number per second of the target execution module according to the total amount threshold of the request number per second of the target execution module and the total amount of the request number per second of all service requests being executed by the target execution module;
step S118: and responding to a comparison result that the total amount of the requests per second of the high concurrent service requests is less than or equal to the current remaining total amount of the requests per second of the target execution module, and sending the cached high concurrent service requests to the target execution module.
In this embodiment, the current remaining total number of requests per second of the target execution module is a difference between the total threshold of requests per second of the target execution module and the total number of requests per second of all service requests being executed by the target execution module.
The monitoring method for the total amount of requests per second of all service requests being executed by the target execution module may be implemented by a monitoring method in the prior art, which is not limited herein, for example: the total amount of requests per second of all service requests being executed by the target execution module may be monitored by calling a data interface of the airy cloud in the prior art, or may be monitored by consul (service registry) in combination with Prometheus (prometies) in the prior art.
In steps S115 to S118, the method for storing results of high concurrent service requests according to this embodiment can enable the standby execution module for the cached high concurrent service requests after determining that the sending mode is the asynchronous sending mode, which not only ensures that the high concurrent service requests can be executed quickly and prevented from being accumulated, that is, ensures the timeliness of the execution of the target execution module, but also ensures the experience of the user initiating the service request.
In this embodiment, for the method for storing the result of the high concurrent service request in the first embodiment, all descriptions of the first embodiment can be referred to, and are not repeated herein.
The method for storing the result of the high concurrent service request provided by this embodiment can automatically select different sending modes according to the comparison result between the total amount of the requests per second of the high concurrent service request and the total amount threshold of the requests per second of the target execution module, so as to adapt to the current execution state of the target execution module, and has strong flexibility and reduced execution pressure of the target execution module. And after the sending mode is determined to be the asynchronous sending mode, the standby execution module can be started for the cached high concurrent service request, so that the high concurrent service request can be quickly executed and not accumulated, namely the execution timeliness is ensured, and the experience of a user initiating the service request is also ensured.
In addition, the method for storing the high concurrent service request result provided in this embodiment can also determine whether the high concurrent service request result is stored in the target database according to a comparison result between the total amount of the number of requests per second of the high concurrent service request result and the total amount threshold of the number of requests per second of the target database, that is, the current operating state of the target database, which not only can ensure that the target database operates safely, stably, efficiently and in a express manner, but also can ensure that the target database is fully utilized, thereby reducing the probability of problems such as downtime of the target database.
Exemplary devices
EXAMPLE III
Fig. 6 is a flowchart of a third embodiment of the high concurrency service request result storage device according to the present invention. As shown in fig. 6, the apparatus includes: a result caching module 201, a high concurrency service request result evaluation module 202 and a target database 203; the result caching module 201 is configured to cache a high concurrency service request result sent by the target execution module or the standby execution module; the high concurrency service request result evaluation module 202 is configured to calculate a total amount of requests per second of the high concurrency service request result according to the cached high concurrency service request result; acquiring a total quantity threshold of the number of requests per second of the target database and the total quantity of the number of requests per second of all service request results being executed by the target database, calculating to obtain the current remaining total quantity of the number of requests per second of the target database according to the total quantity threshold of the number of requests per second of the target database and the total quantity of the number of requests per second of all service request results being executed by the target database, and controlling the result cache module 202 to store the high-concurrency service request results into the target database 203 in response to a comparison result that the total quantity of the number of requests per second of the high-concurrency service request results is less than or equal to the current remaining total quantity of the number of requests per second of the target database; and the target database 203 is used for storing the high-concurrency service request result.
Optionally, the high concurrent service request result evaluation module 202 is further configured to obtain a total amount of requests per second of the cached high concurrent service request results, a total amount threshold of requests per second of the target database, and a total amount of requests per second of all service request results being executed by the target database; calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database; when the total amount of the request number per second of the high concurrency service request result is smaller than or equal to the current residual total amount of the request number per second of the target database, the control result cache module stores the high concurrency service request result into the target database; and in response to a comparison result that the total amount of the requests per second of the high concurrent service request result is greater than the current remaining total amount of the requests per second of the target database, controlling the result cache module to wait for the high concurrent service request result to be stored.
Optionally, the high concurrent service request result evaluating module 202 is further configured to control the result caching module 201 to mark corresponding timestamps for the high concurrent service request results according to the caching time sequence, and to sequentially sort the timestamps to obtain a high concurrent service request result queue; acquiring the total quantity of requests per second of all service request results executed by a target database; calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database; the control result caching module 201 extracts the high concurrent service request results of the current remaining total amount, which is less than or equal to the number of requests per second of the target database, in the high concurrent service request result queue according to the sequence of the timestamps, and stores the high concurrent service request results in the target database 203.
Optionally, the high concurrent service request result evaluating module 202 is further configured to, after continuing to cache a new high concurrent service request result, control the result caching module 201 to mark corresponding timestamps for the high concurrent service request result according to the caching time sequence, and sort the timestamps in sequence, and obtain a new high concurrent service request result queue after adding the timestamp to the remaining high concurrent service request results in the high concurrent service request result queue; acquiring the total quantity of requests per second of all service request results executed by a target database; calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results being executed by the target database; the control result caching module 201 extracts the high concurrent service request results of the current remaining total amount, which is less than or equal to the number of requests per second of the target database, in the high concurrent service request result queue according to the sequence of the timestamps, and stores the high concurrent service request results in the target database 203.
In an optional implementation manner, the apparatus in this embodiment further includes: a first service request evaluation module (not shown), a cache module (not shown) and a target execution module (not shown); the first service request evaluation module is used for receiving the high concurrent service request, calculating the total quantity of the requests per second of the high concurrent service request according to the high concurrent service request, and determining that the sending mode of the high concurrent service request is a synchronous sending mode or an asynchronous sending mode in response to a comparison result of the total quantity of the requests per second of the high concurrent service request and a total quantity threshold value of the requests per second of the target execution module; the cache module is used for caching the high concurrent service request after the first service request evaluation module determines that the sending mode of the high concurrent service request is an asynchronous sending mode; and the target execution module is used for executing the high concurrent service request to obtain a corresponding high concurrent service request result after receiving the high concurrent service request sent by the first service request evaluation module in a synchronous sending mode, and executing the high concurrent service request to obtain a corresponding high concurrent service request result after receiving the high concurrent service request sent by the cache module.
In an optional implementation manner, the apparatus in this embodiment further includes: a second service request evaluation module (not shown) and a standby execution module (not shown); the second service request evaluation module is used for acquiring the total quantity of the cached high concurrent service requests per second, the total quantity threshold of the target execution module per second and the total quantity of all service requests per second being executed by the target execution module, and calculating the current remaining total quantity of the target execution module per second according to the total quantity threshold of the target execution module per second and the total quantity of all service requests per second being executed by the target execution module; in response to a comparison result that the total amount of the requests per second of the high concurrency service requests is larger than the current remaining total amount of the requests per second of the target execution module, controlling the cache module to send the cached high concurrency service requests to the standby execution module; and in response to a comparison result that the total amount of the number of requests per second of the high concurrency service request is less than or equal to the current remaining total amount of the number of requests per second of the target execution module, controlling the cache module to send the cached high concurrency service request to the target execution module; and the standby execution module is used for executing the high-concurrency service request after receiving the high-concurrency service request sent by the cache module to obtain a corresponding high-concurrency service request result.
It should be noted that the high concurrency service request result storage device in the third embodiment corresponds to the high concurrency service request result storage methods in the first and second embodiments, and the description of the high concurrency service request result storage device in the third embodiment can refer to the description of the high concurrency service request result storage methods in the first and second embodiments, and is not repeated here.
The high-concurrency service request result storage device provided by this embodiment can automatically select different sending modes according to the comparison result between the total quantity of requests per second of high-concurrency service requests and the total quantity threshold of requests per second of the target execution module, so as to adapt to the current execution state of the target execution module, and has strong flexibility and reduced execution pressure of the target execution module. In addition, the standby execution module can be started for the cached high concurrent service request after the sending mode is determined to be the asynchronous sending mode, so that the high concurrent service request can be quickly executed and not accumulated, namely the execution timeliness is ensured, and the experience of a user initiating the service request is also ensured.
In addition, the high-concurrency service request result storage device provided by this embodiment can also determine whether the high-concurrency service request result is stored in the target database according to a comparison result between the total number of requests per second of the high-concurrency service request result and the total number threshold of requests per second of the target database, that is, the current operating state of the target database, which not only can ensure that the target database operates safely, stably, efficiently and in a express manner, but also can ensure that the target database is fully utilized, and reduce the problem that the target database is down and the like.
Exemplary electronic device
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device may be either or both of the first device and the second device, or a stand-alone device separate from them, which stand-alone device may communicate with the first device and the second device to receive the acquired input signals therefrom. As shown in fig. 7, the electronic device 30 includes one or more processors 31 and a memory 32.
The processor 31 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
Memory 32 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer readable storage medium and executed by the processor 31 to implement the method for determining an actual control person and/or other desired functionality of the software program of the various embodiments of the present disclosure described above. In one example, the electronic device may further include: an input device 33 and an output device 34, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
The input device 33 may also include, for example, a keyboard, a mouse, and the like.
The output device 34 can output various information to the outside. The output devices 54 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, among others.
Of course, for simplicity, only some of the components of the electronic device relevant to the present disclosure are shown in fig. 7, omitting components such as buses, input/output interfaces, and the like. In addition, the electronic device may include any other suitable components, depending on the particular application.
Exemplary computer program product and storage Medium
In addition to the above-described methods and apparatus, embodiments of the present disclosure may also be a computer program product comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the method for determining an actual control person according to various embodiments of the present disclosure described in the "exemplary methods" section above of this specification.
The computer program product may write program code for carrying out operations for embodiments of the present disclosure in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform steps in a method for determining an actual controlling person according to various embodiments of the present disclosure described in the "exemplary methods" section above in this specification.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing describes the general principles of the present disclosure in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present disclosure are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present disclosure. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the disclosure is not intended to be limited to the specific details so described.
In the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts in the embodiments are referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The block diagrams of devices, apparatuses, systems referred to in this disclosure are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
The methods and apparatus of the present disclosure may be implemented in a number of ways. For example, the methods and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order for the steps of the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above unless specifically stated otherwise. Further, in some embodiments, the present disclosure may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
It is also noted that in the devices, apparatuses, and methods of the present disclosure, each component or step can be decomposed and/or recombined. These decompositions and/or recombinations are to be considered equivalents of the present disclosure. The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the disclosure to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (10)

1. A method for storing results of highly concurrent service requests, the method comprising:
receiving and executing a high concurrency service request to obtain a corresponding high concurrency service request result;
caching the high concurrency service request result;
calculating the total quantity of the requests per second of the high concurrency service request result according to the cached high concurrency service request result;
acquiring a total quantity threshold value of the requests per second of the target database and the total quantity of the requests per second of all service request results executed by the target database;
calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results executed by the target database;
in response to a comparison result that a total number of requests per second of the high concurrent service request result is less than or equal to a current remaining total number of requests per second of the target database, storing the high concurrent service request result in the target database.
2. The method of claim 1, wherein after calculating the current remaining total number of requests per second for the target database based on the threshold total number of requests per second for the target database and the total number of requests per second for all service request results being performed by the target database, further comprising:
in response to a comparison result that the total number of requests per second of the high concurrency service request result is greater than the current remaining total number of requests per second of the target database, the high concurrency service request result waits to be stored.
3. The method of claim 2, wherein the comparing, responsive to the total number of requests per second of the high concurrency service request result being greater than the current remaining total number of requests per second of the target database, the high concurrency service request result waiting to be stored, further comprises:
acquiring the total amount of the cached requests per second of the high-concurrency service request results, the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all the service request results being executed by the target database;
calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results executed by the target database;
when the total amount of the requests per second of the high concurrent service request result is smaller than or equal to the current remaining total amount of the requests per second of the target database, storing the high concurrent service request result into the target database;
in response to a comparison result that the total number of requests per second of the high concurrency service request result is greater than the current remaining total number of requests per second of the target database, the high concurrency service request result waits to be stored.
4. The method of claim 2, wherein the comparing, responsive to the total number of requests per second of the high concurrency service request result being greater than the current remaining total number of requests per second of the target database, the high concurrency service request result waiting to be stored, further comprises:
marking corresponding timestamps for the high concurrent service request results according to the cache time sequence, and sequencing the high concurrent service request results according to the sequence of the timestamps to obtain a high concurrent service request result queue;
acquiring the total quantity of requests per second of all service request results executed by the target database;
calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results executed by the target database;
extracting the current residual total amount of the high concurrent service request results which are less than or equal to the requests per second of the target database in the high concurrent service request result queue according to the sequence of the timestamps, and storing the high concurrent service request results in the target database;
and the high concurrent service request result remained in the high concurrent service request result queue continuously waits for storage.
5. The method of claim 4, wherein after the remaining high concurrent service request results in the high concurrent service request result queue continue to wait for storage, further comprising:
after continuing to cache new high concurrent service request results, marking corresponding timestamps for the high concurrent service request results according to a cache time sequence, sequencing the timestamps in sequence, and adding the timestamps to the remaining high concurrent service request results in the high concurrent service request result queue to obtain a new high concurrent service request result queue;
acquiring the total quantity of requests per second of all service request results executed by a target database;
calculating to obtain the current remaining total amount of the requests per second of the target database according to the total amount threshold of the requests per second of the target database and the total amount of the requests per second of all service request results executed by the target database;
extracting the current residual total amount of the high concurrent service request results which are less than or equal to the requests per second of the target database in the high concurrent service request result queue according to the sequence of the timestamps, and storing the high concurrent service request results in the target database;
and the high concurrent service request result remained in the high concurrent service request result queue continuously waits for storage.
6. The method of claim 2, wherein the current remaining total number of requests per second for the target database is a difference between a threshold total number of requests per second for the target database and a total number of requests per second for all high concurrent service request results being performed by the target database.
7. The method of any one of claims 1-6, wherein the threshold total number of requests per second for the target database is a maximum total number of requests per second for the target database, or wherein the threshold total number of requests per second for the target database is 80% of the maximum total number of requests per second for the target database.
8. A high concurrency service request result storing apparatus, the apparatus comprising: the system comprises a result cache module, a high concurrent service request result evaluation module and a target database;
the result caching module is used for receiving the high concurrency service request result and caching the high concurrency service request result;
the high concurrency service request result evaluation module is used for calculating the total quantity of the requests per second of the high concurrency service request result according to the cached high concurrency service request result; acquiring a total quantity threshold of the requests per second of a target database and the total quantity of the requests per second of all service request results being executed by the target database, and calculating to obtain the current remaining total quantity of the requests per second of the target database according to the total quantity threshold of the requests per second of the target database and the total quantity of the requests per second of all service request results being executed by the target database; and in response to a comparison result that the total number of requests per second of the high concurrent service request result is less than or equal to the current remaining total number of requests per second of the target database, controlling the result caching module to store the high concurrent service request result in the target database;
and the target database is used for storing the high concurrency service request result.
9. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202210183124.2A 2022-02-28 2022-02-28 High-concurrency service request result storage method and device, electronic equipment and storage medium Active CN114238037B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210183124.2A CN114238037B (en) 2022-02-28 2022-02-28 High-concurrency service request result storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210183124.2A CN114238037B (en) 2022-02-28 2022-02-28 High-concurrency service request result storage method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114238037A true CN114238037A (en) 2022-03-25
CN114238037B CN114238037B (en) 2022-04-29

Family

ID=80748200

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210183124.2A Active CN114238037B (en) 2022-02-28 2022-02-28 High-concurrency service request result storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114238037B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114625625A (en) * 2022-05-12 2022-06-14 深圳市艾德网络科技发展有限公司 Event time sequence data processing method and system based on user behavior identification
CN115002225A (en) * 2022-05-07 2022-09-02 阿里巴巴(中国)有限公司 Request processing method and device and readable medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202581A (en) * 2016-08-30 2016-12-07 北京奇艺世纪科技有限公司 A kind of data search method and device
US20180276265A1 (en) * 2015-01-08 2018-09-27 Beijing Jingdong Shangke Information Technology Co., Ltd. Method and device for storing high-concurrency data
CN108958893A (en) * 2017-05-23 2018-12-07 ***通信集团重庆有限公司 Resource control method, device and the computer readable storage medium of high concurrent business
CN109815004A (en) * 2017-11-21 2019-05-28 腾讯科技(深圳)有限公司 Request load control method, device, storage medium and computer equipment
CN111277629A (en) * 2020-01-13 2020-06-12 浙江工业大学 High-availability-based web high-concurrency system and method
CN111338575A (en) * 2020-02-20 2020-06-26 苏州浪潮智能科技有限公司 Storage service quality control method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180276265A1 (en) * 2015-01-08 2018-09-27 Beijing Jingdong Shangke Information Technology Co., Ltd. Method and device for storing high-concurrency data
CN106202581A (en) * 2016-08-30 2016-12-07 北京奇艺世纪科技有限公司 A kind of data search method and device
CN108958893A (en) * 2017-05-23 2018-12-07 ***通信集团重庆有限公司 Resource control method, device and the computer readable storage medium of high concurrent business
CN109815004A (en) * 2017-11-21 2019-05-28 腾讯科技(深圳)有限公司 Request load control method, device, storage medium and computer equipment
CN111277629A (en) * 2020-01-13 2020-06-12 浙江工业大学 High-availability-based web high-concurrency system and method
CN111338575A (en) * 2020-02-20 2020-06-26 苏州浪潮智能科技有限公司 Storage service quality control method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邬林: "企业计算Web ***常见高并发高可用处理技术研究", 《信息通信》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002225A (en) * 2022-05-07 2022-09-02 阿里巴巴(中国)有限公司 Request processing method and device and readable medium
CN114625625A (en) * 2022-05-12 2022-06-14 深圳市艾德网络科技发展有限公司 Event time sequence data processing method and system based on user behavior identification
CN114625625B (en) * 2022-05-12 2022-08-05 深圳市艾德网络科技发展有限公司 Event time sequence data processing method and system based on user behavior identification

Also Published As

Publication number Publication date
CN114238037B (en) 2022-04-29

Similar Documents

Publication Publication Date Title
CN114238037B (en) High-concurrency service request result storage method and device, electronic equipment and storage medium
US10268515B2 (en) Releasing resources from processes in a particular order to provide required resources to start an application
US9558091B2 (en) Information processing device, fault avoidance method, and program storage medium
CN110083417B (en) User interface response method and device
CN109117153B (en) Application processing method, device, terminal and storage medium
KR20150001146A (en) Storage system and Operating method thereof
CN109710679B (en) Data extraction method and device
CN107633080B (en) User task processing method and device
JP6940761B2 (en) Information processing equipment, virtual machine monitoring programs, and information processing systems
CN113641544A (en) Method, apparatus, device, medium and product for detecting application status
KR102194306B1 (en) Apparatus and method for performing an application
CN114244902B (en) High-concurrency service request processing method and device, electronic equipment and storage medium
JP2007249663A (en) Transaction device, delay failure detection device and method, and program
CN112817687A (en) Data synchronization method and device
CN115269243A (en) Method, device and equipment for detecting process and storage medium
KR20230063015A (en) Apparatus and method for managing virtual machine cpu resource in virtualization server
JP2018045493A (en) CPU dynamic allocation program, CPU dynamic allocation device and CPU dynamic allocation method
CN114281604B (en) Data recovery method and device, electronic equipment and storage medium
CN114168431B (en) Method and apparatus for automatically monitoring service, electronic device and storage medium
CN115242623B (en) Log collection method, device, equipment and storage medium
CN117176613B (en) Data acquisition method and device
CN114422521B (en) Method and device for determining master node, electronic equipment and storage medium
CN113778657B (en) Data processing method and device
CN118093667A (en) Method, medium and computer equipment for inquiring statistical quantity of distributed database
JP2007272581A (en) Monitoring program, method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant