Data request method, system, storage medium and server
By setting delay queues and multi-cycle request limits in the data request method and system, the problem of high costs for enterprises in obtaining data is solved, and efficient data requests are achieved without increasing costs.
Patent Information
- Application Number
- CN202110858850.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-28
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-07-28
AI Technical Summary
When enterprises provide full-ecological content and data services, it is difficult to provide complete services alone and need to cooperate with third parties, resulting in high data acquisition costs.
By setting delay queues and multi-cycle request limits in the data request method and system, we can determine whether the data request is within the limit and decide whether to obtain data from the third-party server immediately or add the request to the delay queue to avoid requests that exceed the third-party server. Limit to achieve delayed processing of data requests.
It minimizes the frequency and cost of data requests to third-party servers, ensuring that third-party data can be obtained effectively without incurring unnecessary costs.
Smart Images

Figure CN113590563B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a data request method, system, storage medium and server. Background Art
[0002] With the development of Internet technology, the trend of cloud computing has been gradually promoted by enterprise users. With the development of enterprises and the expansion of business, the services provided by enterprises are basically in the form of content services, data asset distribution, etc. However, since most enterprises focus on their own business areas, it is difficult to provide full-ecosystem content and data services alone. This requires cooperation with third parties to connect data, and cooperation with third parties requires a certain fee. Enterprise users need to try to reduce the fee in the process of obtaining data.
[0003] In the existing technology, enterprise users will give priority to using local data copies and data copies obtained from service providers, reduce the call to third-party data, and thus reduce the cost of obtaining data as much as possible. Summary of the invention
[0004] The embodiment of the present invention provides a data request method, system, storage medium and server, which are implemented.
[0005] An embodiment of the present invention provides a data request method, including:
[0006] Obtaining a data request initiated by a service terminal, wherein the data request is used to request to obtain the requested data;
[0007] Determining whether the data request is within the request limits of a plurality of preset cycles respectively, and obtaining a determination result;
[0008] If the judgment result includes: the data request is within the request limit of the second cycle but not within the request limit of the first cycle, the data request is added to the delay queue, and the request timing of the data request is set to the next first cycle, and the duration of the second cycle is longer than the duration of the first cycle;
[0009] If the judgment result includes: the data request is within the request limit of all cycles in the multiple cycles, obtain the requested data corresponding to the data request from the third-party server, return the requested data to the service terminal, and update the current request amount of each cycle in the multiple cycles.
[0010] Another aspect of the present invention provides a data request device, including:
[0011] A request acquisition unit, used to acquire a data request initiated by a service terminal, wherein the data request is used to request to acquire the requested data;
[0012] A limit judgment unit, used to judge whether the data request is within the request limits of a plurality of preset cycles respectively, and obtain a judgment result;
[0013] a delay queue unit, configured to add the data request to a delay queue if the judgment result includes: the data request is within the request limit of the second cycle but not within the request limit of the first cycle, and set the request timing of the data request to the next first cycle, and the duration of the second cycle is longer than the duration of the first cycle;
[0014] A third-party request unit is used to obtain the requested data corresponding to the data request from a third-party server if the judgment result includes: the data request is within the request limit of all cycles in the multiple cycles, return the requested data to the service terminal, and update the current request amount of each cycle in the multiple cycles.
[0015] Another aspect of the embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of computer programs, wherein the computer programs are suitable for being loaded by a processor and executing the data request method as described in one aspect of the embodiment of the present invention.
[0016] Another aspect of the embodiment of the present invention further provides a server, including a processor and a memory;
[0017] The memory is used to store multiple computer programs, and the computer programs are used to be loaded by the processor and execute the data request method as described in one aspect of an embodiment of the present invention; the processor is used to implement each computer program in the multiple computer programs.
[0018] It can be seen that in the method of this embodiment, a delay queue and a request limit of multiple cycles are set in the data request device. When the service terminal initiates a data request, it is determined whether to obtain the requested data from the third-party server immediately and return it to the service terminal, or to first add the data request to the delay queue and wait for the request time to arrive before obtaining the requested data from the third-party server and returning it to the service terminal. In this process, data can be obtained from the third-party server within each cycle to the maximum limit. When the data request exceeds the request limit set by the third-party server, delay processing is performed, and when the request time of the delayed request data arrives, data can be obtained from the third-party server immediately, ensuring that third-party data requests can be performed to the maximum extent without incurring unnecessary additional costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0020] Figure 1 is a schematic diagram of a data request method provided by an embodiment of the present invention;
[0021] Figure 2 is a flow chart of a data request method provided by an embodiment of the present invention;
[0022] Figure 3 is a flow chart of a method for requesting quota determination in one embodiment of the present invention;
[0023] Figure 4 is a schematic diagram of a scenario in which a data request method is applied in an application embodiment of the present invention;
[0024] Figure 5 is a flow chart of a data request method provided by an application embodiment of the present invention;
[0025] Figure 6 is a schematic diagram of a distributed system to which a data request method in another application embodiment of the present invention is applied;
[0026] Figure 7 is a schematic diagram of a block structure in another application embodiment of the present invention;
[0027] Figure 8 is a logical structure diagram of a data request device provided by an embodiment of the present invention;
[0028] Fig. 9 It is a schematic diagram of the logical structure of a server provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] The embodiment of the present invention provides a data request method, which is mainly used in a method of requesting a service server to obtain data through a service terminal, such as Figure 1 As shown, the data request device can implement the data request according to the following method:
[0032] Obtaining a data request initiated by a service terminal, wherein the data request is used to request to obtain the requested data;
[0033] Determining whether the data request is within the request limits of a plurality of preset cycles respectively, and obtaining a determination result;
[0034] If the judgment result includes: the data request is within the request limit of the second cycle but not within the request limit of the first cycle, the data request is added to the delay queue, and the request timing of the data request is set to the next first cycle, and the duration of the second cycle is longer than the duration of the first cycle;
[0035] If the judgment result includes: the data request is within the request limit of all cycles in the multiple cycles, obtain the requested data corresponding to the data request from the third-party server, return the requested data to the service terminal, and update the current request amount of each cycle in the multiple cycles.
[0036] In practical applications, in one case, the data request device can be any business server, which mainly provides various business data in the corresponding business field, and the business server can cooperate with a third-party server to connect data; in another case, the data request device is directly a business terminal.
[0037] In this process, data can be obtained from the third-party server to the maximum extent in each cycle. When the data request exceeds the request limit set by the third-party server, delayed processing is performed. When the request timing for the delayed request data arrives, data can be obtained from the third-party server immediately, ensuring that third-party data requests can be made to the maximum extent possible without incurring unnecessary additional charges.
[0038] An embodiment of the present invention provides a data request method, which is mainly executed by the above-mentioned data request device. The flow chart is as follows: Figure 2 As shown, including:
[0039] Step 101: obtaining a data request initiated by a service terminal, where the data request is used to request to obtain requested data.
[0040] It can be understood that in one case, the user can operate the service terminal to initiate a data request to the service server to request the service server to return the corresponding service data, and the service server, as a data requesting device, can initiate the process of this embodiment. In another case, the user can operate the service terminal, and the service terminal, as a data requesting device, can initiate the process of this embodiment.
[0041] Since in actual applications, it is necessary to pay a certain fee when obtaining data from a third-party server, in order to minimize the cost of data acquisition, the data request device will first search whether the requested data corresponding to the data request is stored locally or in the service provider of the business corresponding to the data request. If it is not found, the following steps 102 to 106 will be executed; if it is found, the corresponding requested data will be directly returned. In this way, in the process of data request, the local data set and the data stored by the business service provider are used first. When the local data set and the business service provider do not store the corresponding data, the data is obtained from the third-party server, thereby reducing the frequency of real-time calls to the third-party server.
[0042] Step 102, determining whether the data request is within the request limits of a plurality of preset cycles, and obtaining a determination result.
[0043] The multiple periodic request limits preset here refer to the various limiting methods of the third-party server's requests for its own data, such as the request limit for one day is n1 requests, the request limit for one week is n2 requests, and the request limit for one second is n3 requests.
[0044] Here, the judgment result may include: the currently initiated data request is within the request limit of any cycle, or the data request is not within the request limit of any cycle, etc. Specifically, when the judgment result includes: the data request is within the request limit of the second cycle, but not within the request limit of the first cycle, the data request device will execute the following step 103; when the judgment result includes: the data request is within the request limit of all cycles in the above multiple cycles, the data request device will execute the following step 104. Among them, the duration of the second cycle is greater than the duration of the first cycle.
[0045] Step 103: Add the data request to the delay queue, and set the request timing of the data request to the next first cycle.
[0046] The data requests stored in the delay queue here are all unexecuted data requests that need to be requested from a third-party server.
[0047] Step 104, obtain the pending data corresponding to the above data request from the third-party server, return the obtained pending data to the service terminal, and update the current request amount of each cycle in the above multiple cycles, that is, add 1 based on the current request amount of each cycle.
[0048] At the same time, the data requesting device can also synchronously store the requested data locally and at the service provider of the business, so that when the business terminal initiates a data request for the requested data later, the requested data can be directly returned without having to obtain it from a third-party server again, thereby reducing the frequency of obtaining data from a third-party server.
[0049] Furthermore, if the judgment result obtained in the above step 102 includes: the data request is within the request limit of the first cycle, but not within the request limit of the second cycle, the data request device will execute step 105, that is, add the data request to the delay queue and set the request timing of the data request to the next second cycle.
[0050] Furthermore, if the judgment result obtained in the above step 102 includes: the data request is not within the request limit of any cycle in the multiple cycles, the data request device will execute step 106, that is, adding the data request to the delay queue and setting the request timing of the data request to the next third cycle, and the third cycle is the longest cycle in the multiple cycles. If the above multiple cycles are two cycles, the third cycle is the above second cycle.
[0051] It should be noted that, since a delay queue is set in the data request device, the data requests in the delay queue are all data requests that have not been executed. Therefore, the data request device needs to extract at least one data request from the delay queue while processing the data request initiated by the service terminal. When the request timing of the at least one data request arrives, the above steps 102 to 106 are executed for any data request in the at least one data request, that is, the steps of obtaining the judgment result and adding the data request to the delay queue and setting the request timing of the data request are executed; or, the steps of obtaining the judgment result and obtaining the requested data corresponding to the data request from the third-party server, and updating the current request amount of each cycle in multiple cycles are executed. In this way, the requested data obtained by the data request device from the third-party server in each of the above cycles can include the requested data corresponding to the data request initiated in real time by the service terminal and the requested data corresponding to the data request processed delayed in the delay queue.
[0052] Before extracting at least one data request from the delay queue, the data request device also needs to determine the number of the at least one data request, so that the data request device extracts a corresponding number of data requests from the delay queue according to the number of the at least one data request. Specifically, when determining the number of data requests:
[0053] When the current request amount of the longest cycle among the multiple cycles exceeds the request limit of the longest cycle, the number of at least one data request is determined to be 0.
[0054] When the current request amount of the above-mentioned second cycle does not exceed the request limit of the second cycle, the number of at least one data request is determined as the difference between the weighted value of the request limit of the above-mentioned first cycle and the current request amount of the first cycle. In this case, the data request device will extract at least one data request from the delay queue with the first cycle as a period, and the duration of the second cycle is greater than the duration of the first cycle.
[0055] It can be seen that in the method of this embodiment, a delay queue and a request limit of multiple cycles are set in the data request device. When the service terminal initiates a data request, it is determined whether to obtain the requested data from the third-party server immediately and return it to the service terminal, or to first add the data request to the delay queue and wait for the request time to arrive before obtaining the requested data from the third-party server and returning it to the service terminal. In this process, data can be obtained from the third-party server within each cycle to the maximum limit. When the data request exceeds the request limit set by the third-party server, delay processing is performed, and when the request time of the delayed request data arrives, data can be obtained from the third-party server immediately, ensuring that third-party data requests can be performed to the maximum extent without incurring unnecessary additional costs.
[0056] Another embodiment of the present invention provides a data request method, which is mainly executed by the above-mentioned data request device. The method of this embodiment is similar to the method of the above-mentioned embodiment, except that, since multiple cycle request limits are preset in the data request device, in the above-mentioned embodiment, when executing the above-mentioned step 102, it is possible to determine whether the data request is within the request limit of each cycle in the multiple cycles, and obtain a corresponding judgment result for each cycle, and then execute the above-mentioned steps 103 to 106 based on the judgment; while in this embodiment, it is first determined whether the data request is within the request limit of one of the cycles, and then based on a judgment result, it is determined whether it is necessary to continue to determine whether the data request is within the request limit of other cycles, which can save the judgment process of the request limit. Specifically, Figure 3 As shown, the data request in this embodiment may include the following steps:
[0057] Step 201: obtaining a data request initiated by a service terminal, where the data request is used to request to obtain the requested data.
[0058] In order to minimize the cost of data acquisition, after obtaining the data request, the data request device will first search locally or at the service provider of the business corresponding to the data request to see whether the requested data corresponding to the data request is stored. If not found, the following steps 202 to 207 will be executed; if found, the corresponding requested data will be directly returned.
[0059] Step 202, determine that the current judgment cycle is one of the preset multiple cycles. In the initial first cycle, the current judgment cycle can be determined to be the longest cycle among the multiple cycles.
[0060] Step 203, determine whether the above data request is within the request limit of the current judgment cycle. If the judgment result is not within the request limit of the current judgment cycle, execute step 204; if the judgment result is within the request limit of the current judgment cycle, execute step 205.
[0061] Step 204, adds the data request to the delay queue, sets the request timing of the data request to the next current judgment cycle, and stops judging whether the data request is within the request limit of the current judgment cycle in multiple cycles, which can simplify the judgment process of the request limit in the data request process.
[0062] Step 205 , determining whether the above step 203 has been executed for all the request quotas of the cycles preset in the data request device, if so, executing step 206 ; if not, executing step 207 .
[0063] Step 206, obtain the pending data corresponding to the above data request from the third-party server, return the obtained pending data to the business terminal, and update the current request amount of each cycle in the above multiple cycles, that is, add 1 based on the current request amount of each cycle.
[0064] Step 207, update the current judgment period to another period in multiple periods, which is adjacent to the above-mentioned period in time length sorting and has a time length less than the above-mentioned period. For example, if the above-mentioned period is the longest period, then the updated current judgment period is the second longest period, and return to execute step 203, that is, the step of determining whether the data request is within the request limit of the current judgment period.
[0065] In this way, the request limit judgment of the current judgment cycle can be repeated until it is determined that the request limit judgment needs to be stopped according to the judgment result of the request limit of a certain cycle, or the request limit of all cycles has been judged, and the process can be ended.
[0066] In the method of this embodiment, data can be obtained from the third-party server to the maximum extent in each cycle. When the data request exceeds the request limit set by the third-party server, delayed processing is performed, and when the request timing for the delayed request data arrives, data can be obtained from the third-party server immediately, ensuring that third-party data requests can be made to the maximum extent possible without incurring unnecessary additional charges.
[0067] The following is a specific application example to illustrate the data request method of the present invention. The method in this embodiment can be applied to: Figure 4 In the scenario shown, the scenario includes a service terminal, a service server, a service provider, and a third-party server, wherein:
[0068] The business terminal is used to initiate a data request to the business server to obtain business data.
[0069] A business server is mainly a business server of a certain enterprise user. It can store the business data of the enterprise and is used to receive data requests initiated by business terminals. It obtains the requested data corresponding to the data request locally, from the business server, or from a third-party server, and returns it to the business terminal.
[0070] The business service provider is mainly the party that provides services to the enterprise user and can store the business data of the enterprise user through distributed cache or distributed database.
[0071] The third-party server is used to store the business data of the third party and can cooperate with the enterprise user to connect the data. In this way, the enterprise user can obtain the corresponding business data from the third-party server through the business server after paying a certain fee.
[0072] In this embodiment, the data request device is specifically the above-mentioned business server, and two cycles of request limits are preset in the data request device, specifically a request limit m1 within one second and a request limit m2 within one day. The following items also need to be preset in the business server:
[0073] (1) The business server can use open source software, web crawlers and other technologies to generate a data set in advance, store it in the business server, and use timed tasks and other technologies to periodically update this data set, namely the local data set.
[0074] (2) A delay queue is pre-set in the business server. The data requests stored in the delay queue are all unexecuted requests that need to obtain data from a third-party server.
[0075] Specifically, Figure 5 As shown, in this embodiment, the data request method may include the following steps:
[0076] Step 301: A user operates a service terminal to initiate a data request to a service server through the service terminal to request to obtain the requested data.
[0077] In step 302 , the business server first searches the local data center to see whether the requested data corresponding to the data request is stored. If so, the business server returns the corresponding requested data to the business terminal. If not, step 303 is executed.
[0078] In step 303, the business server queries the distributed database or distributed cache of the business service provider whether the corresponding requested data is stored. If stored, the corresponding requested data is stored in the local data set and the corresponding requested data is returned to the business terminal. If not stored, it is necessary to obtain the requested data from the third-party server and first execute the following step 304.
[0079] In step 304, the business server determines whether the data request is within the request limit m2 of the longest period (one day). If not, the data request is added to the delay queue and the request timing of the data request is set to the next longest period, that is, one day later. It returns to the business terminal that there is no corresponding requested data and ends the process; if so, continue to step 305.
[0080] In step 305, the business server determines whether the book request is within the request limit m1 of the shortest period (for example, one second). If not, the data request is added to the delay queue and the request timing of the data request is set to the next shortest period, that is, one second later. It returns to the business terminal that there is no corresponding requested data and ends the process; if so, continue to step 306.
[0081] In step 306, the business server obtains the pending data corresponding to the data request from the third-party server and returns it to the business terminal. At the same time, the pending data can be synchronized to the local data set and the business service provider for storage. Furthermore, the business server will also update the current request volume of each cycle, that is, add 1 to the current request volume of one day and add 1 to the current request volume of one second.
[0082] If the third-party server does not store the requested data, the business server will return to the business terminal that there is no corresponding requested data and end the process.
[0083] During the above data request process, the business server will also perform the following steps:
[0084] In step 307, the business server will extract a number of (for example, m) data requests from the delay queue in the shortest period, i.e., in seconds. The timing of these data requests is earlier than the current time, and perform data query on the third-party server for each data request. When querying, it is necessary to return to execute step 304.
[0085] Among them, for the calculation of m, if the current request volume of a day exceeds the daily request limit m2, the number of data requests that need to be extracted from the delay queue m is 0; if the current request volume of a day does not exceed the daily request limit m2, the number of data requests that need to be extracted from the delay queue m is the difference between the weighted value of the one-second request limit and the current request volume of one second, that is, the one-second request limit m1 / n-the current request volume of one second. Among them, n is the weight value of the delay queue, and the minimum is 1.
[0086] In this embodiment, data can be obtained from the third-party server every day and every second to the maximum extent. When the data request exceeds the request limit set by the third-party server, delayed processing is performed, and when the request timing of the delayed request data arrives, the data can be immediately obtained from the third-party server, ensuring that third-party data requests can be made to the maximum extent without incurring unnecessary additional fees; and in the process of data request, local data sets and data stored by the business service provider are used preferentially. When the local data set and the business service provider do not store the corresponding data, data is obtained from the third-party server, thereby reducing the frequency of real-time calls to the third-party server, and completing the full amount of data services with fewer service quotas.
[0087] The following is another specific application example to illustrate the data request method in the present invention. The data request device in the embodiment of the present invention is mainly a distributed system 100, which may include a client 300 and multiple nodes 200 (any form of computing device in the access network, such as a server, a user terminal), and the client 300 and the node 200 are connected through network communication.
[0088] Take the distributed system as the blockchain system as an example, see Figure 6 This is an optional structural diagram of the distributed system 100 provided by the embodiment of the present invention applied to the blockchain system, which is formed by multiple nodes 200 (any form of computing devices in the access network, such as servers and user terminals) and clients 300, and a peer-to-peer (P2P) network is formed between the nodes. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.
[0089] See also Figure 6 The functions of each node in the blockchain system shown include:
[0090] 1) Routing: a basic function of a node, used to support communication between nodes.
[0091] In addition to the routing function, the node can also have the following functions:
[0092] 2) Applications, which are deployed in the blockchain to implement specific businesses according to actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to the temporary block when they successfully verify the source and integrity of the record data.
[0093] For example, the business implemented by the application includes the code for implementing the data request function, which mainly includes:
[0094] Obtain a data request initiated by a service terminal, wherein the data request is used to request to obtain the requested data; determine whether the data request is within the request limits of multiple preset cycles, respectively, and obtain a determination result; if the determination result includes: the data request is within the request limit of the second cycle, but not within the request limit of the first cycle, add the data request to a delay queue, and set the request timing of the data request to be the next first cycle, the duration of the second cycle being greater than the duration of the first cycle; if the determination result includes: the data request is within the request limits of all cycles in the multiple cycles, obtain the requested data corresponding to the data request from a third-party server, return the requested data to the service terminal, and update the current request amount of each cycle in the multiple cycles.
[0095] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.
[0096] See also Figure 7 An optional schematic diagram of the block structure provided by the embodiment of the present invention, each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block, and each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.
[0097] The embodiment of the present invention also provides a data request device, the structural diagram of which is shown in FIG. Figure 8 As shown, it may specifically include:
[0098] A request acquisition unit 10 is used to acquire a data request initiated by a service terminal, wherein the data request is used to request to acquire the requested data;
[0099] The limit judgment unit 11 is used to judge whether the data request obtained by the request obtaining unit 10 is within the request limit of a plurality of preset cycles respectively, and obtain a judgment result;
[0100] The delay queue unit 12 is used for adding the data request to the delay queue if the judgment result obtained by the limit judgment unit 11 includes: the data request is within the request limit of the second cycle but not within the request limit of the first cycle, and setting the request timing of the data request to the next first cycle, and the duration of the second cycle is longer than the duration of the first cycle;
[0101] The third-party request unit 13 is used to obtain the requested data corresponding to the data request from the third-party server if the judgment result obtained by the limit judgment unit 11 includes: the data request is within the request limit of all periods in the multiple periods, return the requested data to the service terminal, and update the current request amount of each period in the multiple periods.
[0102] In a specific application, the delay queue unit 12 is also used to add the data request to the delay queue and set the request timing of the data request to the next second cycle if the judgment result includes: the data request is not within the request limit of any cycle in the multiple cycles, but within the request limit of the first cycle. The delay queue unit 12 is also used to add the data request to the delay queue and set the request timing of the data request to the next third cycle if the judgment result includes: the data request is not within the request limit of any cycle in the multiple cycles, and the third cycle is the longest cycle among the multiple cycles.
[0103] In another specific application, the limit judgment unit 11 is specifically used to determine the current judgment cycle, which is one of the multiple cycles; judge whether the data request is within the request limit of the current judgment cycle; the delay queue unit 12 is specifically used to add the data request to the delay queue if the judgment result is not within the request limit of the current judgment cycle, and set the request timing of the data request to the next current judgment cycle, and the limit judgment unit 11 stops judging whether the data request is within the request limit of the multiple cycles whose duration is less than the current judgment cycle. In this case, the limit judgment unit 11 is also used to update the current judgment cycle to another cycle among the multiple cycles whose duration is adjacent to the one cycle and whose duration is less than the one cycle if the judgment result is within the request limit of the current judgment cycle, and execute the step of judging whether the data request is within the request limit of the current judgment cycle.
[0104] Furthermore, the data requesting device of this embodiment may further include:
[0105] The request extraction unit 14 is used to extract at least one data request from the delay queue. When the request timing of the at least one data request arrives, the limit judgment unit 11 is notified to execute the step of obtaining the judgment result for any one of the at least one data request.
[0106] The request extraction unit 14 is further configured to determine the number of at least one data request as 0 when the current request amount of the longest cycle among the multiple cycles exceeds the request limit of the longest cycle; and to determine the number of at least one data request as the difference between the weighted value of the request limit of the first cycle and the current request amount of the first cycle when the current request amount of the second cycle does not exceed the request limit of the second cycle. When extracting at least one data request from the delay queue, the request extraction unit 14 is specifically configured to extract a corresponding number of data requests from the delay queue according to the number of at least one data request.
[0107] The storage and return unit 15 is used to return the requested data when the local or the service provider of the business corresponding to the data request stores the requested data; when the local or the service provider of the business corresponding to the data request does not store the requested data, notify the limit judgment unit 11 to execute the step of judging whether the data request is within the request limits of the preset multiple cycles respectively.
[0108] It can be seen that in the data request device of this embodiment, a delay queue and a request limit of multiple cycles are set. When the service terminal initiates a data request, it is determined whether the third-party request unit 13 needs to immediately obtain the requested data from the third-party server and return it to the service terminal, or the delay queue unit 12 first adds the data request to the delay queue, waits for the request time to arrive, and then obtains the requested data from the third-party server and returns it to the service terminal. In this process, data can be obtained from the third-party server within each cycle to the maximum limit. When the data request exceeds the request limit set by the third-party server, delay processing is performed, and when the request time of the delayed request data arrives, data can be obtained from the third-party server immediately, ensuring that third-party data requests can be performed to the maximum extent without incurring unnecessary additional costs.
[0109] The embodiment of the present invention further provides a server, the structural diagram of which is shown in Fig. 9 As shown, the server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 20 (for example, one or more processors) and memory 21, and one or more storage media 22 (for example, one or more mass storage devices) storing application programs 221 or data 222. Among them, the memory 21 and the storage medium 22 can be short-term storage or permanent storage. The program stored in the storage medium 22 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 20 can be configured to communicate with the storage medium 22 and execute a series of instruction operations in the storage medium 22 on the server.
[0110] Specifically, the application 221 stored in the storage medium 22 includes an application for data request, and the program may include the request acquisition unit 10, the limit determination unit 11, the delay queue unit 12, the third-party request unit 13, the request extraction unit 14 and the storage return unit 15 in the above-mentioned data request device, which will not be described in detail here. Furthermore, the central processor 20 can be configured to communicate with the storage medium 22 and execute a series of operations corresponding to the application for data request stored in the storage medium 22 on the server.
[0111] The server may also include one or more power supplies 23, one or more wired or wireless network interfaces 24, one or more input and output interfaces 25, and / or one or more operating systems 223, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, FreeBSD TM, etc.
[0112] The steps performed by the data requesting device in the above method embodiment can be based on the Fig. 9 The structure of the server is shown.
[0113] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of computer programs, wherein the computer programs are suitable for being loaded by a processor and executing the data request method executed by the above-mentioned data request device.
[0114] Another aspect of the embodiment of the present invention further provides a server, including a processor and a memory;
[0115] The memory is used to store a plurality of computer programs, and the computer programs are used to be loaded by the processor and execute the data request method executed by the above-mentioned data request device; the processor is used to implement each computer program in the plurality of computer programs.
[0116] In addition, according to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data request method provided in the above-mentioned various optional implementations.
[0117] A person skilled in the art may understand that all or part of the steps in the various methods of the above-mentioned embodiments may be completed by instructing the relevant hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0118] The above is a detailed introduction to a data request method, system, storage medium and server provided in an embodiment of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A data request method, It is characterized in that include: Obtaining a data request initiated by a service terminal, wherein the data request is used to request to obtain the requested data; Determining whether the data request is within the request limits of a plurality of preset cycles respectively, and obtaining a determination result; If the judgment result includes: the data request is within the request limit of the second cycle but not within the request limit of the first cycle, the data request is added to the delay queue, and the request timing of the data request is set to the next first cycle, and the duration of the second cycle is longer than the duration of the first cycle; If the judgment result includes: the data request is within the request limit of all the cycles in the multiple cycles, obtaining the pending data corresponding to the data request from the third-party server, returning the pending data to the service terminal, and updating the current request amount of each cycle in the multiple cycles; The method further comprises: Extracting at least one data request from the delay queue, when the request timing of the at least one data request arrives, and for any data request among the at least one data request, executing the steps of obtaining the judgment result, adding the data request to the delay queue, and setting the request timing of the data request; Before extracting at least one data request from the delay queue, the method further includes: When the current request amount of the second cycle does not exceed the request limit of the second cycle, determining the number of the at least one data request to be a difference between a weighted value of the request limit of the first cycle and the current request amount of the second cycle; Then extracting at least one data request from the delay queue specifically includes: extracting a corresponding number of data requests from the delay queue according to the number of the at least one data request.
2. The method according to claim 1, It is characterized in that If the judgment result includes: the data request is not within the request limit of the second cycle, but within the request limit of the first cycle, the data request is added to the delay queue, and the request timing of the data request is set to the next second cycle.
3. The method according to claim 1, It is characterized in that If the judgment result includes: the data request is not within the request limit of any cycle in the multiple cycles, the data request is added to the delay queue, and the request timing of the data request is set to the next third cycle, and the third cycle is the longest cycle among the multiple cycles.
4. The method according to any one of claims 1 to 3, It is characterized in that The determining whether the data request is within the request limits of the preset multiple cycles respectively, and obtaining the determination result, specifically includes: Determine a current judgment period, where the current judgment period is one of the multiple periods; Determine whether the data request is within the request limit of the current judgment cycle. If the judgment result is that it is not within the request limit of the current judgment cycle, add the data request to the delay queue, set the request timing of the data request to the next current judgment cycle, and stop determining whether the data request is within the request limit of the current judgment cycle within a duration less than that of the multiple cycles.
5. The method according to claim 4, It is characterized in that If the judgment result is within the request limit of the current judgment cycle, update the current judgment cycle to another cycle among the multiple cycles, which is adjacent to the one cycle in time length sorting and has a time length less than the one cycle, and execute the step of determining whether the data request is within the request limit of the current judgment cycle.
6. The method according to any one of claims 1 to 3, It is characterized in that The method further comprises: For any data request among the at least one data request, the steps of obtaining the judgment result and acquiring the requested data corresponding to the data request from the third-party server, and updating the current request amount of each cycle in the multiple cycles are executed.
7. The method according to any one of claims 1 to 3, It is characterized in that Before determining whether the data request is within the request quotas of the preset multiple cycles, the method further includes: When the local or the service provider of the business corresponding to the data request stores the requested data, the requested data is returned; When the local or the service provider of the service corresponding to the data request does not store the requested data, the step of determining whether the data request is within the request limits of the preset multiple cycles is performed.
8. A data requesting device, It is characterized in that A request acquisition unit, used to acquire a data request initiated by a service terminal, wherein the data request is used to request to acquire the requested data; A limit judgment unit, used to judge whether the data request is within the request limits of a plurality of preset cycles respectively, and obtain a judgment result; a delay queue unit, configured to add the data request to a delay queue if the judgment result includes: the data request is within the request limit of the second cycle but not within the request limit of the first cycle, and set the request timing of the data request to the next first cycle, and the duration of the second cycle is longer than the duration of the first cycle; a third-party request unit, configured to, if the judgment result includes: the data request is within the request limit of all the cycles in the multiple cycles, obtain the pending data corresponding to the data request from the third-party server, return the pending data to the service terminal, and update the current request amount of each cycle in the multiple cycles; a request extraction unit, configured to extract at least one data request from the delay queue, and when a request timing of the at least one data request arrives, notify the limit judgment unit to execute the step of obtaining a judgment result for any one of the at least one data request; The request extraction unit is further used for: When the current request amount of the second cycle does not exceed the request limit of the second cycle, determining the number of the at least one data request to be a difference between a weighted value of the request limit of the first cycle and the current request amount of the second cycle; When extracting at least one data request from the delay queue, the request extraction unit is further configured to: extract a corresponding number of data requests from the delay queue according to the number of the at least one data request.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a plurality of computer programs, and the computer programs are suitable for being loaded by a processor and executing the data request method according to any one of claims 1 to 7.
10. A server, It is characterized in that including a processor and a memory; The memory is used to store a plurality of computer programs, and the computer programs are used to be loaded by a processor and execute the data request method according to any one of claims 1 to 7; the processor is used to implement each computer program among the plurality of computer programs.
