Method and device for responding to data service request, server and storage medium

By splitting the original data service request into sub-requests and dynamically matching thread pool processing, the problem of request response delay in high concurrency scenarios is solved, and more efficient response and throughput is achieved.

CN119520320APending Publication Date: 2025-02-25NEUSOFT CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411365872.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In the scenario of high concurrent data service requests, it is difficult for the prior art to achieve timely and fast responses to requests, resulting in problems such as large processing delays, high system resource usage and slow request responses.

Method used

By receiving the original data service request, it is split into multiple sub-data service requests, and based on the mapping relationship between the concurrency number of the data service provider and the thread pool and the requested concurrency number, it matches the appropriate thread pool for processing, and finally merges and returns the response results.

Benefits of technology

It significantly improves the system's response capability and throughput, reduces the overall response time, improves processing efficiency and response speed, and can better respond to high-concurrent service request scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520320A_ABST
    Figure CN119520320A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for responding to a data service request, a server and a storage medium. In the scheme, an original data service request sent by a data service request end is received; and if the original data service request corresponds to a plurality of data service providers, splitting the original data service request into a plurality of sub-data service requests according to dimensions of the data service providers. And respectively matching thread pools for the plurality of sub-data service requests from the plurality of groups of thread pools based on the concurrency number of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pools and the request concurrency number reference value. And respectively sending the plurality of sub-data service requests to corresponding data service providers through the matched threads in the thread pool. And combining the sub-response results returned by the data service providers into an integral response result. And returning the overall response result to the data service request end. And timely and rapid response to the high-concurrency data service request is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a method, device, server and storage medium for responding to a data service request. Background Art

[0002] With the widespread popularity of Internet applications and the rapid development of IoT technology, the amount of data and user requests that the system needs to process has increased dramatically, and data services are facing unprecedented high concurrency challenges. High concurrency scenarios usually occur in scenarios such as e-commerce promotions, online live broadcasts, social media sharing, game servers, and financial services. These scenarios require the system to be able to handle a large number of concurrent requests from users in a very short time, ensuring the real-time and accuracy of request responses and the stability of the system. Summary of the invention

[0003] Based on the above problems, the present application provides a method, device, server and storage medium for responding to data service requests, with the aim of achieving timely and rapid response to requests in scenarios with high concurrency of data service requests.

[0004] The embodiments of the present application disclose the following technical solutions:

[0005] A first aspect of the present application provides a method for responding to a data service request, the method comprising:

[0006] Receive the original data service request sent by the data service requester;

[0007] If the original data service request corresponds to multiple data service providers, split the original data service request into multiple sub-data service requests according to the dimension of the data service providers;

[0008] Based on the concurrency number of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency number, respectively matching the thread pools for the multiple sub-data service requests from the multiple groups of thread pools;

[0009] Sending the multiple sub-data service requests to corresponding data service providers respectively through threads in a matching thread pool;

[0010] Merge the sub-response results returned by each data service provider into an overall response result;

[0011] Return the overall response result to the data service request end.

[0012] In an optional implementation, before matching the plurality of sub-data service requests with thread pools from the plurality of groups of thread pools, the method for responding to the data service request further includes:

[0013] Obtaining a processing time reference value of each sub-data service request among the multiple sub-data service requests;

[0014] The method of matching thread pools for the plurality of sub-data service requests from a plurality of groups of thread pools respectively based on the number of concurrency of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the number of concurrency of requests includes:

[0015] Based on the concurrent number of sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the concurrent number of requests, matching the multiple sub-data service requests with the candidate thread pools that meet the mapping relationship from the multiple groups of thread pools;

[0016] From the candidate thread pools, based on the reference value of the processing time consumption of the sub-data service request, a target thread pool matching the reference value of the processing time consumption of the sub-data service request is matched for the sub-data service request.

[0017] In an optional implementation, the method for responding to a data service request further includes:

[0018] Analyzing the relationship between the processing time of the sub-data service request corresponding to the target data service provider and the number of the sub-data service requests corresponding to the target data service provider, and determining the maximum concurrent number of the sub-data service requests corresponding to the target data service provider according to three consecutive rising points of the processing time; the target data service provider is one of the multiple data service providers;

[0019] For the sub-data service requests corresponding to the target data service provider, the method of matching thread pools for the multiple sub-data service requests from multiple groups of thread pools based on the concurrency number of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency number, includes:

[0020] If the number of concurrency of the sub-data service request corresponding to the target data service provider in the current stage reaches the maximum concurrency, query the thread pool corresponding to the maximum concurrency from the mapping relationship between the thread pool and the reference value of the request concurrency number, and match the thread pool corresponding to the maximum concurrency for the sub-data service request corresponding to the target data service provider;

[0021] If the concurrency number of the sub-data service request corresponding to the target data service provider in the current stage does not reach the maximum concurrency number, the thread pool corresponding to the concurrency number of the current stage is queried from the mapping relationship between the thread pool and the reference value of the request concurrency number, and the thread pool corresponding to the concurrency number of the current stage is matched to the sub-data service request corresponding to the target data service provider.

[0022] In an optional implementation, after receiving the original data service request sent by the data service request end, the method for responding to the data service request further includes:

[0023] Querying from the primary data cache whether there is an overall response result corresponding to the original data service request, and if so, directly reading the overall response result from the primary data cache, and returning the overall response result to the data service request end;

[0024] If there is no overall response result corresponding to the original data service request in the primary data cache area, then after splitting the original data service request into multiple sub-data service requests according to the dimension of the data service provider, the method further includes:

[0025] The secondary data cache area is queried to determine whether there are sub-response results corresponding to the multiple sub-data service requests respectively. If sub-response results corresponding to one or more sub-data service requests are found, the sub-response results corresponding to the one or more sub-data service requests are directly read from the secondary data cache area for merging into an overall response result.

[0026] In an optional implementation, the method for responding to a data service request further includes:

[0027] After associating the sub-response results returned by each data service provider with the sub-data service request, the sub-response results are stored in the secondary data cache area;

[0028] After associating the overall response result with the original data service request, it is stored in the primary data cache area.

[0029] In an optional implementation, associating the sub-response results returned by each data service provider with the sub-data service request includes:

[0030] Obtaining a hash value of the sub-data service request; the hash value is obtained based on a hash operation of request parameters carried in the sub-data service request;

[0031] Constructing a key-value pair according to the hash value and the sub-response result corresponding to the sub-data service request;

[0032] The associating the overall response result with the original data service request includes:

[0033] Obtaining a hash value of the original data service request; the hash value of the original data service request is obtained based on a hash operation of request parameters carried in the original data service request;

[0034] A key-value pair is constructed according to the hash value of the original data service request and the overall response result.

[0035] In an optional implementation, the method for responding to a data service request further includes:

[0036] If the sum of the concurrent numbers of sub-data service requests corresponding to the multiple data service providers has reached the control threshold of the total concurrent number of the current device, the sub-data service requests that exceed the control threshold of the total concurrent number of the current device will be allocated to other devices for processing; the current device is the device that receives the original data service request.

[0037] A second aspect of the present application provides a device for responding to a data service request, the device comprising:

[0038] A receiving module, used for receiving an original data service request sent by a data service request end;

[0039] a splitting module, configured to split the original data service request into multiple sub-data service requests according to the dimension of the data service providers if the original data service request corresponds to multiple data service providers;

[0040] A matching module, configured to match thread pools for the plurality of sub-data service requests respectively from a plurality of groups of thread pools based on the number of concurrencies of the sub-data service requests corresponding to the data service provider and a mapping relationship between the thread pool and a reference value of the number of concurrent requests;

[0041] A first sending module, configured to send the plurality of sub-data service requests to corresponding data service providers respectively through threads in a matching thread pool;

[0042] An integration module is used to merge the sub-response results returned by each data service provider into an overall response result;

[0043] The second sending module is used to return the overall response result to the data service request end.

[0044] A third aspect of the present application provides a server for responding to a data service request, the server comprising:

[0045] a memory having a computer program stored thereon;

[0046] A processor is used to execute the computer program in the memory to implement the steps of the method for responding to a data service request introduced in any implementation manner of the first aspect.

[0047] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for responding to a data service request described in any implementation of the first aspect are implemented.

[0048] Compared with the prior art, this application has the following beneficial effects:

[0049] In the technical solution of the present application, firstly, the original data service request sent by the data service request end is received; secondly, if the original data service request corresponds to multiple data service providers, the original data service request is split into multiple sub-data service requests according to the dimension of the data service provider; again, based on the concurrency of the sub-data service request corresponding to the data service provider, and the mapping relationship between the thread pool and the reference value of the request concurrency, the thread pools are matched for the multiple sub-data service requests from multiple groups of thread pools; then, the multiple sub-data service requests are sent to the corresponding data service provider respectively through the threads in the matched thread pool; then, the sub-response results returned by each data service provider are merged into the overall response result; finally, the overall response result is returned to the data service request end. It can be seen that in the technical solution of the present application, by splitting the original data service request into multiple sub-data service requests and sending them to different data service providers in a targeted manner, the processing capacity of each provider is fully utilized, and the response capacity and throughput of the system are significantly improved. At the same time, based on the concurrency of the sub-requests and the mapping relationship between the thread pool and the concurrency, the most suitable thread pool is dynamically selected for processing, and system resources are reasonably allocated to avoid waste or overload. Through parallel processing, the overall response time is significantly reduced in the face of high-concurrency service request scenarios, and the processing efficiency and response speed are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0051] Figure 1 A flow chart of a method for responding to a data service request provided in an embodiment of the present application;

[0052] Figure 2 A flowchart of another method for responding to a data service request provided in an embodiment of the present application;

[0053] Figure 3 A schematic diagram of the structure of a device for responding to a data service request provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] As mentioned above, current data service request processing methods play a vital role in data processing, information retrieval, and online services. However, in practical applications, existing data service request processing methods often encounter problems such as large processing delays, high system resource usage, and slow request responses when facing high-concurrency, large-scale data service requests. These problems seriously restrict the processing capacity and response speed of data services, especially in high-concurrency scenarios such as e-commerce promotions, online live broadcasts, and real-time financial transactions, which put forward higher requirements on the processing efficiency and response speed of data service requests.

[0055] After research, the inventor has proposed a method, device, server and storage medium for responding to data service requests.

[0056] First, an original data service request sent by a data service request end is received; secondly, if the original data service request corresponds to multiple data service providers, the original data service request is split into multiple sub-data service requests according to the dimension of the data service provider; again, based on the concurrency number of the sub-data service requests corresponding to the data service provider, and the mapping relationship between the thread pool and the reference value of the request concurrency number, thread pools are matched for the multiple sub-data service requests from multiple groups of thread pools; then, the multiple sub-data service requests are sent to the corresponding data service providers respectively through the threads in the matched thread pool; then, the sub-response results returned by each data service provider are merged into an overall response result; finally, the overall response result is returned to the data service request end.

[0057] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0058] See also Figure 1 , which is a flow chart of a method for responding to a data service request provided by an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0059] S101: Receive an original data service request sent by a data service requester.

[0060] The data service requester refers to the party that actively initiates a data request during the data service interaction process. The data service interaction process refers to a scenario in which a software or device sends a request to another software or device (usually a server) to obtain or submit data during network communication.

[0061] On the data service request side, the user or software program sends a request to the server through a specific interface, and the request contains information about the type of data or service required.

[0062] In an embodiment of the present application, the data service request end can be various types of software or devices, such as a web browser, a mobile application, a desktop application, an Internet of Things device, etc., which is not specifically limited here.

[0063] In the embodiments of the present application, the original data service request refers to a first-hand, unsplit or pre-processed request for a certain service or data initiated by a user or the system itself in a computer system, network service, database application or other type of service system. This request directly reflects the original needs of the user or the direct operational needs of the system.

[0064] S102: If the original data service request corresponds to multiple data service providers, split the original data service request into multiple sub-data service requests according to the dimension of the data service providers.

[0065] In the embodiment of the present application, the data service provider refers to the organizations, institutions or enterprises that are responsible for providing services such as data collection, processing, storage, analysis and transmission, and may also refer to data servers configured and used by the above organizations, institutions or enterprises. When the original data service request requires multiple data service providers to provide responses to the data service request, the original data service request is split into multiple sub-data service requests according to the dimension of the data service provider.

[0066] It should be noted that the personal information involved in this application when making data service requests is information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0067] In an example implementation, the original data service request is "to comprehensively assess the credit status of a customer." This request involves multiple aspects of data, including but not limited to personal credit information, bank transaction records, operator arrears records, court judgment records, and tax information.

[0068] These data correspond to multiple data service providers, including but not limited to the credit reporting center, which is used to provide personal credit reports, including key information such as credit records, overdue status, and number of inquiries; banks, which are used to provide the customer's transaction records in the bank, such as deposit balances, loan history, repayment records, etc.; operators, which are used to provide the customer's arrears records; public record data providers, which are used to provide public record data such as court judgment records, tax information, and lists of dishonest persons subject to execution. At this point, the system may first display a privacy prompt to the customer to ensure that the customer understands and agrees to the use of personal information, and that the customer understands and agrees to the use of personal information results. Then, according to the above data service providers, the original service request is split into the following sub-data service requests:

[0069] Sub-data service request 1: Send a request to the credit reporting center to query the customer's interest report;

[0070] Sub-data service request 2: Send a request to the relevant bank to query the customer's transaction records in the bank;

[0071] Sub-data service request 3: Send a request to the operator to query the customer's arrears record with the operator;

[0072] Subdata service request 4: Send a request to the public record data provider to query the client's public record data.

[0073] In this step, splitting the original data service request into multiple sub-data service requests according to the dimension of the data service provider helps to optimize resource utilization, improve response speed, and enable each data service provider to focus on processing data requests within its professional field.

[0074] S103 , matching thread pools for multiple sub-data service requests respectively from multiple groups of thread pools based on the concurrent number of sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the concurrent number of requests.

[0075] The thread pool is used to manage a group of threads, avoiding frequent creation and destruction of threads, thereby saving system resources and improving system response speed. The thread pool allows tasks to be executed concurrently, improving the execution efficiency of the program.

[0076] When processing requests sent by multiple users or devices, there may be multiple data providers, and there may be multiple sub-data service requests that need to be processed for the same data service provider. The concurrency number of sub-data service requests corresponding to the data service provider refers to the number of multiple sub-data service requests sent to the data service provider in the same time period and being processed or waiting to be processed. The sub-data service request refers to a request for a specific service or data set provided by the data service provider. It should be noted that in the embodiment of the present application, sub-data service requests with exactly the same request information are counted as one concurrency number.

[0077] In the embodiment of the present application, the reference value of the number of concurrent requests can be the maximum number of concurrent requests, that is, the maximum number of requests that can be executed by the thread pool, or a range of concurrent requests, which is not specifically limited here. For example, the reference value of the number of concurrent requests can be the maximum number of concurrent requests of 2000, or a range of 1800-2200.

[0078] In an example implementation, the mapping relationship between the thread pool and the reference value of concurrent requests can be monitored and limited by a counter. The optimal number of concurrent requests is found as the reference value of concurrent requests for the thread pool by gradually increasing the number of concurrent requests and observing the response time and throughput of the thread pool.

[0079] In this step, when matching the thread pools for the multiple sub-data service requests, it is necessary to perform the matching based on the concurrency of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency. This achieves a reasonable configuration of the thread pool, ensuring that the system can efficiently process requests and maintain good performance.

[0080] S104: Send multiple sub-data service requests to corresponding data service providers respectively through threads in the matching thread pool.

[0081] In an embodiment of the present application, multiple sub-data service requests are submitted as tasks to a matching thread pool. After the thread pool obtains the tasks, the threads in the thread pool send the multiple sub-data service requests to corresponding data service providers.

[0082] S105: Merge the sub-response results returned by each data service provider into an overall response result.

[0083] Each sub-data service request corresponds to a sub-response result. The sub-response results corresponding to multiple sub-data service requests split from the same original data service request are merged, and the final overall response result is constructed based on the merged sub-response results.

[0084] In the embodiment of the present application, the overall response result includes all necessary information corresponding to the original data service request, and the overall response result is combined in the format expected by the data service request end, for example, combined into a data list for display.

[0085] Optionally, when constructing the final overall response result, some additional metadata can be added, such as request processing time, status code, error information, etc., to help the data service requester understand and process the response.

[0086] S106: Return the overall response result to the data service requesting end.

[0087] In an embodiment of the present application, appropriate network protocols and transport layers, such as the Transmission Control Protocol and Internet Protocol (TCP / IP), can be used to send the overall response result to the data service request end, and the specific sending method is not limited here.

[0088] In the embodiment of the present application, by splitting the original data service request into multiple sub-data service requests according to the corresponding data service provider, the processing capacity of the data service provider is fully utilized, thereby greatly improving the data service request response capacity and throughput of the entire system; then based on the concurrency of multiple sub-data service requests and the mapping relationship between the thread pool and the reference value of the request concurrency, the multiple sub-data service requests are divided into the corresponding thread pool, and then through the thread pool, the sub-data service requests with the same or equivalent concurrency are sent in a targeted manner to obtain sub-response results. The most suitable thread pool is dynamically selected for processing according to the concurrency of the sub-data service request corresponding to the data service provider, and the system resources are allocated more reasonably, avoiding waste or overload of resources. Multiple sub-data service requests are processed in parallel by parallel processing, which significantly reduces the overall response time; finally, the sub-response results are merged into the overall response result and returned to the data service request end. In the face of high-concurrency data service request scenarios, the embodiment of the present application significantly improves the processing efficiency and response speed of data service requests.

[0089] Figure 2 Another flow chart of a method for responding to a data service request provided in an embodiment of the present application. In the embodiment introduced by this figure, a more detailed description is provided for the implementation of the method for responding to a data service request.

[0090] like Figure 2 The data synchronization method shown includes the following steps:

[0091] S201: Receive an original data service request sent by a data service requester.

[0092] The implementation of S201 is basically the same as that of S101 in the method embodiment described above, and will not be elaborated here. For related technical implementations, reference can be made to the description of S101 described above.

[0093] S202: Query the primary data cache area to see whether there is an overall response result corresponding to the original data service request.

[0094] In the embodiment of the present application, since in most business situations, data delays within 3 seconds are considered valid data, the first-level data cache is used to solve the problem of fast response to the same request. If the data in the first-level data cache is not accessed again by any request within 3 seconds, then these data items will be considered expired and removed from the cache. This setting can avoid the data in the cache from being too old while maintaining a certain degree of real-time performance. If there is an overall response result corresponding to the original data service request in the first-level data cache, then step S203 is entered. If there is no overall response result corresponding to the original data service request in the first-level data cache, then step S204 is entered.

[0095] S203: Read the overall response result from the first-level data buffer area.

[0096] If there is an overall response result corresponding to the original data service request in the primary data cache area, the overall response result is quickly read directly from the primary data cache area, and step S212 is entered to return the overall response result to the data service request end.

[0097] S204: If the original data service request corresponds to multiple data service providers, split the original data service request into multiple sub-data service requests according to the dimension of the data service requester.

[0098] If there is no overall response result corresponding to the original data service request in the first-level data cache area, the original data service request will be split according to the dimension of the data service requester, and each split point is an executable sub-data service request.

[0099] This step is basically the same as the implementation method of S102 in the method embodiment introduced above, and will not be described here in detail. For related technical implementations, please refer to the introduction and description of S102 above.

[0100] S205: Query from the secondary data cache whether there are sub-response results corresponding to the multiple sub-data service requests.

[0101] In the embodiment of the present application, the secondary data cache is queried to see whether there are sub-response results corresponding to the multiple sub-data service requests. Similarly, if the data in the secondary data cache is not accessed again by any request within 3 seconds, these data items will be deemed expired and removed from the cache. One or more sub-data service requests for which corresponding sub-response results are queried from the secondary data cache proceed to step S206, and one or more sub-data service requests for which corresponding sub-response results are not queried from the secondary data cache proceed to step S207.

[0102] S206: Read sub-response results corresponding to one or more sub-data service requests from the secondary data cache area.

[0103] The sub-response results corresponding to the one or more sub-data service requests corresponding to the sub-response results queried from the secondary data cache are read out from the secondary data cache, and the sub-response results are used to merge the overall response results.

[0104] S207: Obtain a reference value of processing time consumption of each sub-data service request among the one or more sub-data service requests.

[0105] A reference value of processing time consumption of each sub-data service request among one or more sub-data service requests for which no corresponding sub-response result is queried from the secondary data cache is obtained.

[0106] In the embodiment of the present application, the reference value of the processing time of each sub-data service request refers to a reference range or a specific value of the processing time of each sub-data service request.

[0107] S208: Based on the concurrent number of sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the concurrent number of requests, one or more sub-data service requests are matched with a candidate thread pool that meets the mapping relationship from multiple groups of thread pools.

[0108] When matching thread pools for the multiple sub-data service requests, firstly, it is necessary to match the candidate thread pools based on the concurrency of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency. This process is to match the thread pool corresponding to the concurrency of the sub-data service requests.

[0109] S209 , further based on the reference value of the processing time consumption of the sub-data service request, matching the sub-data service request with a target thread pool that matches the reference value of the processing time consumption of the sub-data service request from the thread pool to be selected.

[0110] Threads in the thread pool are shared resources used to execute multiple tasks concurrently. If some requests take much longer to process than other requests, these long-running requests will occupy threads in the thread pool for a long time, causing other short-running requests to wait for idle threads to be executed, thus reducing the overall throughput.

[0111] In an embodiment of the present application, this step further combines the processing time reference value of the sub-data service request to match the target thread pool from the candidate thread pool, thereby ensuring that the processing time reference value of the sub-data service request in the same thread pool is basically consistent, thereby avoiding requests with different processing times in one thread pool from affecting the overall throughput efficiency of the thread pool.

[0112] For example, if most requests take tens of milliseconds to process, these requests are usually completed quickly. In this case, the threads in the thread pool can efficiently process a large number of requests because each thread can complete its task in a short time and return to the thread pool to process the next request. At this time, the overall throughput efficiency of the thread pool is very high.

[0113] If some requests suddenly become complex computing tasks, these tasks take a long time to complete (such as several seconds or even longer). Since the size of the thread pool is fixed (for example, it may be 10 threads), when these long-time tasks are assigned to threads for execution, they will occupy the threads for a long time. At the same time, other short-time requests need to wait because there are no idle threads available. As time goes by, the number of waiting requests will increase, causing the thread pool to respond more slowly and the overall throughput efficiency to decrease.

[0114] S210 . Send one or more sub-data service requests to corresponding data service providers respectively through threads in a matching thread pool.

[0115] S211. Merge the sub-response results returned by each data service provider into an overall response result.

[0116] S212: Return the overall response result to the data service requesting end.

[0117] S210-S212 are implemented in substantially the same manner as S104-S106 in the method embodiment described above, and will not be elaborated here. For related technical implementations, reference may be made to the description of S104-S106 described above.

[0118] The embodiment of the present application adds a primary data cache area and a secondary data cache area, and before making a request to the data service provider, it queries whether there is a corresponding response result in the primary data cache area or the secondary data cache area. If so, there is no need to make an additional data service request to the data service provider, thereby achieving a fast response to the same request. By matching the data service request to the thread pool according to the concurrent number of data service requests and the processing time consumption, the overall throughput efficiency of the thread pool is improved, thereby improving the timeliness of the request response.

[0119] In an optional implementation of the technical solution of the present application, the method for responding to data service requests provided by an embodiment of the present application also includes analyzing the changing relationship between the processing time of the sub-data service requests corresponding to the target data service provider and the number of sub-data service requests corresponding to the target data service provider, gradually increasing the number of sub-data service requests, and determining the maximum concurrent number of sub-data service requests corresponding to the target data service provider based on three consecutive rising points in the processing time.

[0120] In an example implementation, the initial default number of sub-data service requests is 100. The 100 sub-data service requests are compiled into a thread to obtain the processing time of the sub-data service requests. Then, 5 sub-data service requests are compiled into the thread. If the processing time of the sub-data service requests does not change after compilation, 5 sub-data service requests are compiled, and the number of sub-data service requests in the thread is gradually increased to increase the number of concurrent threads. When the number of sub-data service requests in the thread increases to 150, the processing time of the sub-data service requests increases, and the sub-data service requests in the thread are withdrawn to 145. When the processing time of the sub-data service request decreases, the number of sub-data service requests in the thread is increased to 150 again, and the processing time of the sub-data service request increases. The sub-data service request in the thread is withdrawn to 145 again, and the processing time of the sub-data service request decreases. The number of sub-data service requests in the thread is increased to 150 again, and the processing time of the sub-data service request increases. It can be seen that the three consecutive increase points of the processing time are when 145 sub-data service requests are included in the thread, and the maximum concurrent number of sub-data service requests corresponding to the target data service provider is 145. The target data service provider is one of the multiple data service providers.

[0121] Optionally, for the sub-data service requests corresponding to the target data service provider, matching thread pools for the multiple sub-data service requests respectively from multiple groups of thread pools based on the concurrency number of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency number includes:

[0122] If the number of concurrency of the sub-data service request corresponding to the target data service provider in the current stage reaches the maximum concurrency, query the thread pool corresponding to the maximum concurrency from the mapping relationship between the thread pool and the reference value of the request concurrency number, and match the thread pool corresponding to the maximum concurrency for the sub-data service request corresponding to the target data service provider;

[0123] If the concurrency number of the sub-data service request corresponding to the target data service provider in the current stage does not reach the maximum concurrency number, the thread pool corresponding to the concurrency number of the current stage is queried from the mapping relationship between the thread pool and the reference value of the request concurrency number, and the thread pool corresponding to the concurrency number of the current stage is matched to the sub-data service request corresponding to the target data service provider.

[0124] In an example implementation, the concurrency of the sub-data service request corresponding to the target data service provider in the current stage is 1000. If the maximum concurrency is 800, the sub-data service request corresponding to the target data service provider is matched with the thread pool corresponding to the concurrency of 800; if the maximum concurrency is 1200, the sub-data service request corresponding to the target data service provider is matched with the thread pool corresponding to the concurrency of 1000.

[0125] In the present application, determining the maximum number of concurrent requests helps avoid overload and maintain service stability and response speed. Dynamically matching thread pools based on request concurrency. When the concurrency is low, using a smaller thread pool can reduce resource usage; and when the concurrency is close to or reaches the maximum concurrency, using a larger thread pool can ensure that all requests are processed in a timely manner. This method avoids the problem of resource waste or shortage that may be caused by static configuration of thread pools, and improves the flexibility and scalability of the system. In high-concurrency scenarios, by limiting the maximum number of concurrent requests and using an appropriate thread pool, problems such as service crashes or response delays can be effectively avoided, ensuring that user requests can be processed in a timely manner.

[0126] In an optional implementation of the technical solution of the present application, the method further includes associating the sub-response results returned by each data service provider with the sub-data service request and storing them in the secondary data cache area; associating the overall response result with the original data service request and storing them in the primary data cache area.

[0127] Optionally, associating the sub-response results returned by each data service provider with the sub-data service request includes:

[0128] Step 1: Get the hash value of the sub-data service request.

[0129] The hash value is obtained by hashing the request parameters carried in the sub-data service request.

[0130] In an example implementation, the process of obtaining the hash value of the sub-data service request can be performed by first extracting all key request parameters carried in the sub-data service request. These parameters usually determine the specific content and result of the request. Then, a hash function (such as MD5, SHA-1, SHA-256, etc.) is used to perform a hash operation on these request parameters. The result of the hash operation is a string of fixed length, namely the hash value, which can uniquely represent all key parameters carried in the sub-data service request.

[0131] Step 2: construct a key-value pair according to the hash value and the sub-response result corresponding to the sub-data service request;

[0132] Use the hash value generated in the previous step as the key (Key), and the sub-response result corresponding to the sub-data service request as the value (Value) to construct a key-value pair. Store this key-value pair in the secondary data cache area so that it can be quickly retrieved later.

[0133] Optionally, associating the overall response result with the original data service request includes:

[0134] Step 1: Obtain the hash value of the original data service request.

[0135] The hash value of the original data service request is obtained by hashing the request parameters carried in the original data service request.

[0136] In an example implementation, the process of obtaining the hash value of the original data service request can be performed by first extracting all key request parameters carried in the original data service request, and then performing a hash operation on these request parameters using a hash function (such as MD5, SHA-1, SHA-256, etc.) to obtain a hash value.

[0137] Step 2: construct a key-value pair according to the hash value of the original data service request and the overall response result.

[0138] Use the hash value generated in the previous step as the key (Key), and the overall response result corresponding to the original data service request as the value (Value) to construct a key-value pair. Store this key-value pair in the first-level data cache area so that it can be quickly retrieved later.

[0139] In the present application scheme, by storing the response results in the data cache, when the same request is received again, the system can directly retrieve and return the results from the cache without re-executing the entire data service process. This can significantly reduce response time and improve user experience. Moreover, in high-concurrency scenarios, a large number of repeated requests can be responded to directly through the data cache, reducing direct access to the data service provider, thereby avoiding overload of the data service provider.

[0140] By obtaining the hash value of the data service request through hash operation, it is possible to quickly determine whether two requests are the same, even if they come from different data service request terminals or are initiated at different time points. At the same time, since the hash value is usually much smaller than the original request parameter set, using the hash value as the cache key can save storage space. When the same data service request needs to be processed, the response result can be quickly obtained by calculating the hash value of the request again and looking up the key in the data cache. Since the hash value is generated based on the request parameters, it can ensure that the response result in the data cache strictly corresponds to the original data service request, thereby ensuring the accuracy of the response.

[0141] In an optional implementation of the technical solution of the present application, the method further includes: if the sum of the concurrent numbers of the sub-data service requests corresponding to the multiple data service providers has reached the control threshold of the total concurrent number of the current device, the sub-data service requests exceeding the control threshold of the total concurrent number of the current device are allocated to other devices for processing. The current device is the device that receives the original data service request.

[0142] In an example implementation, the control threshold can be determined based on the hardware resources of the device, such as CPU, memory, network bandwidth, etc., and performance requirements. The sub-data service requests exceeding the control threshold of the total bearer concurrency number are allocated to other devices for processing, which can be implemented through message queues, remote calls or other communication mechanisms.

[0143] The response results obtained after allocating the sub-data service requests exceeding the control threshold of the total concurrent bearer number to other devices for processing are returned to the data service request end by the allocated other devices.

[0144] In an example implementation, the total concurrent bearer number of the current device A is 10,000, the control threshold of the total concurrent bearer number of the current device A is 80% of the total concurrent bearer number, i.e., 8,000, and the sum of the concurrent numbers of sub-data service requests corresponding to multiple data service providers is 12,000. Then, 4,000 sub-data service requests that exceed the control threshold of the total concurrent bearer number need to be allocated to device B for processing, wherein the response results of the 8,000 sub-data service requests processed by device A are returned by device A to the data service request end, and the response results of the 4,000 sub-data service requests processed by device B are returned by device B to the data service request end.

[0145] In this application solution, by distributing requests that exceed the processing capacity of the current device to other devices, the current device can be prevented from being overloaded, thereby maintaining its stable operation. This helps to improve the performance and stability of the entire system and ensure that all requests can be processed in a timely and effective manner. Moreover, in high-concurrency scenarios, this helps to reduce resource bottlenecks and improve the overall processing capacity and response speed of the system.

[0146] By distributing requests to multiple devices for processing, the system can more flexibly cope with higher concurrent demands that may arise in the future. When the system capacity needs to be expanded, more processing devices can be simply added without large-scale transformation of the existing system. By reducing request waiting time and improving response speed, users can get the data and services they need faster. This helps improve user experience.

[0147] Based on the method for responding to a data service request provided in the aforementioned embodiment, the present application also provides a device for responding to a data service request. Figure 3 A schematic diagram of a structure of a device for responding to a data service request provided in an embodiment of the present application. Figure 3 As shown, the device for responding to the data service request includes:

[0148] The receiving module 301 is used to receive the original data service request sent by the data service request end;

[0149] A splitting module 302 is configured to split the original data service request into multiple sub-data service requests according to the dimension of the data service providers if the original data service request corresponds to multiple data service providers;

[0150] A matching module 303 is used to match thread pools for the multiple sub-data service requests from multiple groups of thread pools based on the concurrent number of sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the concurrent number of requests;

[0151] A first sending module 304, configured to send the plurality of sub-data service requests to corresponding data service providers respectively through threads in a matching thread pool;

[0152] Integration module 305, used to merge the sub-response results returned by each data service provider into an overall response result;

[0153] The second sending module 306 is used to return the overall response result to the data service request end.

[0154] It can be seen that in the technical solution of this application, by splitting the original data service request into multiple sub-data service requests and sending them to different data service providers in a targeted manner, the processing capabilities of each provider are fully utilized, significantly improving the system's responsiveness and throughput. At the same time, based on the concurrency of the sub-requests and the mapping relationship between the thread pool and the concurrency, the most appropriate thread pool is dynamically selected for processing, and system resources are reasonably allocated to avoid waste or overload. Through parallel processing, the overall response time is significantly reduced in the face of high-concurrency service request scenarios, and the processing efficiency and response speed are improved.

[0155] Optionally, the matching module 303 is specifically used to: match one or more sub-data service requests from multiple groups of thread pools with candidate thread pools that meet the mapping relationship based on the concurrency number of sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency number; and from the candidate thread pools, further based on the processing time reference value of the sub-data service request, match the sub-data service request with a target thread pool that matches the processing time reference value of the sub-data service request.

[0156] Optionally, the device for responding to the data service request further includes:

[0157] The first-level cache module is used to cache the original data service request and the corresponding overall response result;

[0158] The secondary cache module is used to cache sub-data service requests and corresponding sub-response results;

[0159] A primary query module, used to query whether there is an overall response result corresponding to the original data service request in the primary data cache area;

[0160] A secondary query module, used to query whether there are sub-response results corresponding to the multiple sub-data service requests in the secondary data cache area;

[0161] A maximum concurrent number determination module is used to analyze the relationship between the processing time of the sub-data service request corresponding to the target data service provider and the number of sub-data service requests corresponding to the target data service provider, and determine the maximum concurrent number of sub-data service requests corresponding to the target data service provider according to three consecutive rising points of the processing time;

[0162] An allocation module, configured to allocate sub-data service requests exceeding the control threshold of the total concurrent bearer number to other devices for processing when the sum of the concurrent numbers of sub-data service requests corresponding to the multiple data service providers has reached the control threshold of the total concurrent bearer number of the current device;

[0163] An association module, used to associate the sub-response results returned by each data service provider with the sub-data service request, and to associate the overall response result with the original data service request;

[0164] Optionally, the association module includes:

[0165] A hash value acquisition module, used to obtain a hash value based on a hash operation of the request parameters carried in the sub-data service request, and also used to obtain a hash value based on a hash operation of the request parameters carried in the original data service request;

[0166] The key-value pair construction module is used to construct a key-value pair according to the hash value and the sub-response result corresponding to the sub-data service request, and is also used to construct a key-value pair according to the hash value of the original data service request and the overall response result.

[0167] Optionally, the matching module 303 is specifically used for:

[0168] If the number of concurrency of the sub-data service request corresponding to the target data service provider in the current stage reaches the maximum concurrency, query the thread pool corresponding to the maximum concurrency from the mapping relationship between the thread pool and the reference value of the request concurrency number, and match the thread pool corresponding to the maximum concurrency for the sub-data service request corresponding to the target data service provider;

[0169] If the concurrency number of the sub-data service request corresponding to the target data service provider in the current stage does not reach the maximum concurrency number, the thread pool corresponding to the concurrency number of the current stage is queried from the mapping relationship between the thread pool and the reference value of the request concurrency number, and the thread pool corresponding to the concurrency number of the current stage is matched to the sub-data service request corresponding to the target data service provider.

[0170] In addition, an embodiment of the present application also provides a server, which includes a processor and a memory.

[0171] The memory is used to store computer program code and transmit the program code to the processor;

[0172] The processor is used to execute the steps of the method for responding to a data service request introduced in any of the above method embodiments according to the instructions in the program code.

[0173] In addition, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the program is executed by a processor, a method for responding to a data service request as described in any of the method embodiments is implemented.

[0174] It should be noted that each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and server embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The device and server embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0175] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for responding to a data service request, characterized in that: The method comprises: Receive the original data service request sent by the data service requester; If the original data service request corresponds to multiple data service providers, split the original data service request into multiple sub-data service requests according to the dimension of the data service providers; Based on the concurrency number of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency number, respectively matching the thread pools for the multiple sub-data service requests from the multiple groups of thread pools; Sending the multiple sub-data service requests to corresponding data service providers respectively through threads in a matching thread pool; Merge the sub-response results returned by each data service provider into an overall response result; Return the overall response result to the data service request end.

2. The method according to claim 1, characterized in that Before matching thread pools for the multiple sub-data service requests respectively from the multiple groups of thread pools, the method further includes: Obtaining a processing time reference value of each sub-data service request among the multiple sub-data service requests; The method of matching thread pools for the plurality of sub-data service requests from a plurality of groups of thread pools respectively based on the number of concurrency of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the number of concurrency of requests includes: Based on the concurrent number of sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the concurrent number of requests, matching the multiple sub-data service requests with the candidate thread pools that meet the mapping relationship from the multiple groups of thread pools; From the candidate thread pools, based on the reference value of the processing time consumption of the sub-data service request, a target thread pool matching the reference value of the processing time consumption of the sub-data service request is matched for the sub-data service request.

3. The method according to claim 1, characterized in that Also includes: Analyzing the relationship between the processing time of the sub-data service request corresponding to the target data service provider and the number of the sub-data service requests corresponding to the target data service provider, and determining the maximum concurrent number of the sub-data service requests corresponding to the target data service provider according to three consecutive rising points of the processing time; the target data service provider is one of the multiple data service providers; For the sub-data service requests corresponding to the target data service provider, the method of matching thread pools for the multiple sub-data service requests from multiple groups of thread pools based on the concurrency number of the sub-data service requests corresponding to the data service provider and the mapping relationship between the thread pool and the reference value of the request concurrency number, includes: If the number of concurrency of the sub-data service request corresponding to the target data service provider in the current stage reaches the maximum concurrency, query the thread pool corresponding to the maximum concurrency from the mapping relationship between the thread pool and the reference value of the request concurrency number, and match the thread pool corresponding to the maximum concurrency for the sub-data service request corresponding to the target data service provider; If the concurrency number of the sub-data service request corresponding to the target data service provider in the current stage does not reach the maximum concurrency number, the thread pool corresponding to the concurrency number of the current stage is queried from the mapping relationship between the thread pool and the reference value of the request concurrency number, and the thread pool corresponding to the concurrency number of the current stage is matched to the sub-data service request corresponding to the target data service provider.

4. The method according to claim 1, characterized in that: After receiving the original data service request sent by the data service request end, the method further includes: Querying from the primary data cache whether there is an overall response result corresponding to the original data service request, and if so, directly reading the overall response result from the primary data cache, and returning the overall response result to the data service request end; If there is no overall response result corresponding to the original data service request in the primary data cache area, then after splitting the original data service request into multiple sub-data service requests according to the dimension of the data service provider, the method further includes: The secondary data cache area is queried to determine whether there are sub-response results corresponding to the multiple sub-data service requests respectively. If sub-response results corresponding to one or more sub-data service requests are found, the sub-response results corresponding to the one or more sub-data service requests are directly read from the secondary data cache area for merging into an overall response result.

5. The method according to claim 1, characterized in that The method further comprises: After associating the sub-response results returned by each data service provider with the sub-data service request, the sub-response results are stored in the secondary data cache area; After associating the overall response result with the original data service request, it is stored in the primary data cache area.

6. The method according to claim 5, characterized in that The associating the sub-response results returned by each data service provider with the sub-data service request includes: Obtaining a hash value of the sub-data service request; the hash value is obtained by performing a hash operation on the request parameters carried in the sub-data service request; Constructing a key-value pair according to the hash value and the sub-response result corresponding to the sub-data service request; The associating the overall response result with the original data service request comprises: Obtaining a hash value of the original data service request; the hash value of the original data service request is obtained based on a hash operation of request parameters carried in the original data service request; A key-value pair is constructed according to the hash value of the original data service request and the overall response result.

7. The method according to any one of claims 1 to 6, characterized in that Also includes: If the sum of the concurrent numbers of the sub-data service requests corresponding to the multiple data service providers has reached the control threshold of the total concurrent number of bearers of the current device, the sub-data service requests exceeding the control threshold of the total concurrent number of bearers are allocated to other devices for processing; The current device is a device that receives the original data service request.

8. A device for responding to a data service request, characterized in that: The device comprises: A receiving module, used for receiving an original data service request sent by a data service request end; a splitting module, configured to split the original data service request into multiple sub-data service requests according to the dimension of the data service providers if the original data service request corresponds to multiple data service providers; A matching module, configured to match thread pools for the plurality of sub-data service requests respectively from a plurality of groups of thread pools based on the number of concurrencies of the sub-data service requests corresponding to the data service provider and a mapping relationship between the thread pool and a reference value of the number of concurrent requests; A first sending module, configured to send the plurality of sub-data service requests to corresponding data service providers respectively through threads in a matching thread pool; An integration module is used to merge the sub-response results returned by each data service provider into an overall response result; The second sending module is used to return the overall response result to the data service request end.

9. A server for responding to a data service request, characterized in that: The server comprises: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method for responding to a data service request according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for responding to a data service request according to any one of claims 1 to 7 are implemented.