A method, device, equipment and storage medium for isolating business requests
By building a request container and request isolation pool in the microservice architecture, detecting the number of pending service requests and enabling the request current limiting function, establishing a target request queue and target communication connection, the avalanche problem caused by excessive concurrent service requests by users is solved, and the smooth operation of the application system and efficient processing of business requests is achieved.
Patent Information
- Application Number
- CN202411481120.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-10-23
AI Technical Summary
In the microservice architecture, when the user's concurrent business request is too large, the response of a microservice is slow, which in turn causes the entire application system to avalanche and affects the smooth operation of the system.
By building a request container, at least two request isolation pools are established according to the request frequency of service requests, and the number of service requests to be processed is detected, and the request current limiting function is enabled. Based on the request current limiting function, a target request queue is established, and a target communication connection method is established with the newly received service request, and a target service request is generated and placed into the target request queue is carried out for response processing.
It effectively avoids avalanche caused by exception response of pending service requests when the application system is too high, ensuring smooth operation of the application system and efficient handling of business requests.
Smart Images

Figure CN119071361B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of microservice technology, and in particular to a method, device, equipment and storage medium for isolating a business request. Background Art
[0002] Currently, in the microservice architecture, the business requests issued by users will first request the application gateway. When the number of concurrent users is too large, the business requests issued by users will also increase synchronously. In order to avoid the slow response of the business request of a certain microservice, which will cause the slow response of the entire application system, so that the entire application system will avalanche.
[0003] Therefore, there is an urgent need for a method for isolating business requests to ensure smooth operation of the application system when the application system is under excessive load pressure. Summary of the invention
[0004] The present invention provides a method, device, equipment and storage medium for isolating a business request, so as to ensure the smooth operation of an application system when the load pressure of the application system is too large.
[0005] According to one aspect of the present invention, a method for isolating a service request is provided, the method comprising:
[0006] Building a request container to receive a business request from a user, and establishing at least two request isolation pools in the request container according to the request frequency of the business request; wherein different request isolation pools have different processing modes for business requests in the request isolation pools;
[0007] Detect the number of pending business requests in the request isolation pool, and determine whether to enable the request current limiting function for the request container according to the detection result;
[0008] Based on the request current limiting function, a target request queue is established, and a target communication connection mode between the newly received processing service request is established, and a target service request corresponding to the service request is generated and placed in the target request queue;
[0009] According to the target request queue, a response process is performed on the target service request.
[0010] According to another aspect of the present invention, a device for isolating a service request is provided, the device comprising:
[0011] An isolation pool construction module is used to construct a request container to receive business requests from users, and to establish at least two request isolation pools in the request container according to the request frequency of the business requests; wherein different request isolation pools have different processing modes for business requests in the request isolation pools;
[0012] A current limiting module is used to detect the number of pending business requests in the request isolation pool, and determine whether to enable the request current limiting function for the request container according to the detection result;
[0013] A queue generation module is used to establish a target request queue based on the request current limiting function, and establish a target communication connection mode with the newly received processing service request, and at the same time generate a target service request corresponding to the service request and put it into the target request queue;
[0014] The response module is used to respond to the target service request according to the target request queue.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for isolating a service request described in any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for isolating a service request described in any embodiment of the present invention when executed.
[0020] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, it is used to implement the method for isolating a service request according to any embodiment of the present invention.
[0021] The technical solution of the embodiment of the present invention stores business requests in request isolation pools with different processing methods according to the request frequency of the business requests, improves the processing efficiency of business requests by reasonably allocating server resources, and detects the number of pending business requests in the request container to enable the request current limiting function. By starting the target communication connection service, a target business request corresponding to the newly received business request is generated to avoid an avalanche of the application system due to abnormal responses to pending business requests when the load pressure of the application system is too large, thereby ensuring the smooth operation of the application system.
[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.
[0024] Figure 1 This is a flowchart of a method for isolating a service request provided according to Embodiment 1 of the present invention;
[0025] Figure 2 is a flowchart of a method for isolating a service request provided according to Embodiment 2 of the present invention;
[0026] Figure 3 is a flowchart of a method for isolating a service request provided according to Embodiment 3 of the present invention;
[0027] Figure 4 This is a schematic diagram of the structure of a device for isolating a service request provided in Embodiment 4 of the present invention;
[0028] Figure 5 It is a structural schematic diagram of an electronic device for implementing the service request isolation method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. 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 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] Embodiment 1
[0032] Figure 1 A flowchart of a method for isolating a service request is provided for the first embodiment of the present invention. This embodiment is applicable to the case of receiving a service request sent by a user. The method can be executed by a service request isolation device. The service request isolation device can be implemented in the form of hardware and / or software. The service request isolation device can be configured in various general computing devices, such as a server device integrated with an application gateway. Figure 1 As shown, the method includes:
[0033] S110 , building a request container to receive a business request from a user, and building at least two request isolation pools in the request container according to the request frequency of the business request.
[0034] Among them, the processing methods of business requests corresponding to different request isolation pools are different, and the processing methods of business requests stored in the same request isolation pool are the same.
[0035] In an embodiment of the present invention, a business request may refer to a request message sent by a user to a microservice. A user may send request messages to different microservices to obtain functional services provided by the microservices. In other words, different business requests may access different access objects, i.e., microservice objects, to obtain functional services provided by the access objects. The request frequency of a business request actually refers to the access frequency of the access object corresponding to the business request, and the access frequency of the access object can be used to characterize the server resources required for the business request response processing process to a certain extent. Optionally, the higher the access frequency of the access object, the fewer server resources are required for the business request of the access object.
[0036] When a user issues a business request while using an application, all business requests will first reach the application gateway of the server. Therefore, an interceptor can be established in the application gateway to intercept the business requests and store the received business requests in at least two request isolation pools in the constructed request container according to the request frequency of the business requests.
[0037] S120: Detect the number of pending business requests in the request isolation pool, and determine whether to enable a request current limiting function for the request container according to the detection result.
[0038] The pending service request may refer to a service request in the request isolation pool that has not yet been allocated to a server resource.
[0039] In an embodiment of the present invention, the number of pending business requests in each request isolation pool can be detected in real time. When the number of pending business requests in all request isolation pools reaches a preset number threshold, the request current limiting function of the request container is enabled. Optionally, the preset threshold can be determined based on the semaphore processing threshold of the request isolation pool. It should be noted that the semaphore processing threshold can be used to indicate the number of processor resources that can be allocated by the request isolation pool, one processor resource can process one business request, and the semaphore thresholds corresponding to different request isolation pools can be the same or different.
[0040] Optionally, the number of pending business requests in the request isolation pool is detected, and it is determined whether to enable the request current limiting function for the request container based on the detection result, including: detecting the number of pending business requests in all request isolation pools, and if the number of pending business requests in the request isolation pool exceeds a first preset ratio of the sum of the signal processing thresholds of each request isolation pool, then determining to enable the request current limiting function of the request container.
[0041] Specifically, the number of pending services in each request isolation pool can be detected in real time. If the number of pending service requests in a request isolation pool exceeds a fixed ratio threshold (for example, 20 percent) of the total semaphore threshold of all request isolation pools, it is determined to enable the request current limiting function of the request container, and the request container will no longer continue to receive service requests.
[0042] By setting the request current limiting function, we can avoid the "avalanche" of the application system when the business request pressure is too high, thus ensuring the normal operation of the application system.
[0043] S130: Based on the request current limiting function, a target request queue is established, and a target communication connection mode between the newly received service request is established, and a target service request corresponding to the service request is generated and placed in the target request queue.
[0044] Among them, the target request queue is used to store the business requests newly received by the request container after the request current limiting function is turned on. The target business request may refer to the business request in the target request queue. The target communication connection method may refer to the communication connection method between the target business request and the server, and the communication connection method complies with the target communication protocol. Exemplarily, the target communication protocol may be the websocket communication protocol.
[0045] Specifically, when the request flow limiting function of the request container is turned on, the server can start the target communication connection service, and establish a target communication connection with the user party to which the newly received service request belongs after the request flow limiting function is turned on in the target communication connection mode; and generate a target service request that complies with the target communication protocol according to the request information of the newly received service request, and store it in the target request queue. It should be noted that the communication protocol that the target service request complies with is different from the communication protocol of the original service request corresponding to it. Under the communication protocol followed by the original service request, the user party and the server do not establish a long connection. If the server does not have time to process the original service request (no extra processor resources are allocated to the original service request), it will return a request exception to the user party of the service request. Through the target communication connection mode, a long connection is established between the user party and the server. If the target service request is not responded to in time, the message of request exception (request failure) will not be returned to the user party, but the connection with the server will be maintained, waiting for the allocation of server resources, and the target service request will maintain a long connection with the server and will not consume additional server resources of the server.
[0046] S140: Response processing is performed on the target service request according to the target request queue.
[0047] The technical solution of the embodiment of the present invention stores business requests in request isolation pools with different processing methods according to the request frequency of the business requests, improves the processing efficiency of business requests by reasonably allocating server resources, and detects the number of pending business requests in the request container to enable the request current limiting function. By starting the target communication connection service, a target business request corresponding to the newly received business request is generated to avoid an avalanche of the application system due to abnormal responses to pending business requests when the load pressure of the application system is too large, thereby ensuring the smooth operation of the application system.
[0048] Embodiment 2
[0049] Figure 2This is a flowchart of a method for isolating a business request provided in the second embodiment of the present invention. This embodiment further refines the above embodiment and provides specific steps for constructing a request container for receiving business requests from users and establishing at least two request isolation pools in the request container according to the request frequency of business requests. It should be noted that for the undetailed parts of the embodiment of the present invention, please refer to the relevant descriptions of other embodiments, which will not be repeated here. Figure 2 As shown, the method includes:
[0050] S210: Receive a service request from a user, and generate a request identifier of the service request according to request format information of the service request.
[0051] The request format information may refer to the request field information in the service request, such as queryString information, hander header information, and body data information. The request identifier may be used as an identifier of the service request, and the identifier information of each service request is different.
[0052] Specifically, a service request sent by a user is received, and request field information of the service request is extracted to generate a request identifier of the service request.
[0053] S220: Classify the service requests according to the access frequency of the access object, and generate at least two request isolation pools in the request container, wherein the access object refers to the object requested by the service request.
[0054] In the embodiment of the present invention, multiple users may issue service requests in the same time period. Therefore, different users may issue service requests for the same application function, that is, different users may have the same service requirements and issue service requests to access the same access object.
[0055] The server may classify the service requests according to the access frequency of the access objects, generate at least two request isolation pools in the request container, and classify the access objects accessing the same access request into the same request isolation pool.
[0056] Optionally, business requests are classified according to the access frequency of the access object to generate at least two request isolation pools, including: if the access frequency of the access object of the business request is less than or equal to the first access frequency, the business request is stored in the first request isolation pool; if the access frequency of the access object of the business request is greater than the first access frequency and less than the second access frequency, the business request is stored in the second request isolation pool; if the access frequency of the access object of the business request is greater than or equal to the second access frequency, the business request is stored in the third request isolation pool.
[0057] Among them, a fixed number of processor resources can be pre-set in the first request isolation pool, and the business requests in the first request isolation pool can use the processor resources in turn through polling. For each new business request in the second request isolation, a new processor resource will be synchronously created to process the new business request. In the third request isolation pool, only one business request is processed at the same time. The processor resources can be determined based on the semaphore processing threshold of the request isolation pool, and the setting of the semaphore processing threshold can be determined based on the number of CPU cores of the server.
[0058] It should be noted that the business requests in the first request isolation pool only consume the CPU resources of the server when being processed by the processor resources, and do not need to call third-party service resources (database resources, etc.). The business requests in the first request isolation pool consume fewer server resources, have a short processing cycle, can be processed quickly, and the processor resources can be released quickly. Therefore, the first request isolation pool uses a fixed number of processor resources to poll and process the business requests therein, and the number of processor resources pre-established in the first request isolation pool is equal to the signal processing threshold.
[0059] For each new service request in the second request isolation pool, a processor resource will be synchronously established for the service request until the processor resources established in the second request isolation pool reach the corresponding semaphore processing threshold. When the service requests in the second request isolation pool are processed by the processor resources, they not only consume the CPU resources of the server, but also require the assistance of third-party service resources. Therefore, the service requests in the second request isolation pool will consume more server resources than the service requests in the first request isolation pool, and the processing cycle will also be longer. At this time, if a fixed number of processor resources are established in advance, the processor resources will not be released quickly.
[0060] Compared with the business requests in the second request isolation pool, the business requests in the third request isolation pool need to call more third-party service resources, have a long processing cycle, and need to occupy processor resources for a longer time. Therefore, in the third request isolation pool, there is a business request that is calling processor resources at the same time.
[0061] Optionally, the first access frequency, the second access frequency and the third access frequency may be adaptively set according to those skilled in the art.
[0062] By classifying and storing business requests and processing them in different response methods, the utilization efficiency of server resources is improved and the processing efficiency of business requests is further improved.
[0063] S230: Store the business request in a key-value pair format in a request isolation pool.
[0064] Among them, the business requests stored in the request isolation pool have a unique corresponding request identifier, and the business requests stored in the request isolation pool use the transfer parameter string of the business request as the key and the type of the request isolation pool as the value. Optionally, the transfer string may refer to the queryString information in the business request, and the type of the request isolation pool may refer to the divided request isolation pool, such as the first request isolation pool and the second request isolation pool.
[0065] After receiving the service request, the transfer parameter string in the service request can be queried in the request container. If it does not exist in the request container, the service request is saved in the divided request isolation pool in the request container in the key-value pair format.
[0066] Optionally, after constructing a request container for receiving business requests from users and establishing at least two request isolation pools in the request container according to the request frequency of the business requests, it also includes: monitoring the number of request users that issue business requests, and when the number of users exceeds a preset user threshold, detecting the number of business requests stored in the request isolation pool in the request container, and if there is a request isolation pool whose number is greater than the total number of requests of a second preset ratio, updating the signal processing threshold of the request isolation pool.
[0067] In an embodiment of the present invention, the request isolation pool in the request container can be dynamically monitored and adjusted, and the number of request users of the current application system, that is, the number of users who issue business requests, is monitored at the same time. When the number of request users exceeds the preset user threshold, the current application system is determined to be a high-frequency application, otherwise it is a low-frequency application. When the application system is a high-frequency application, the total number of requests in the request container and the number of business requests in each request isolation pool can be monitored to determine the business request ratio of the business requests in each request isolation pool. Exemplarily, if the number of business requests in the first request isolation pool exceeds half of the total number of requests, the semaphore threshold of the first request isolation pool can be doubled; if the number of business requests in the second request isolation pool exceeds half of the total number of requests, the semaphore threshold of the second request isolation pool can be doubled. Optionally, the preset user threshold can be adaptively set according to those skilled in the art.
[0068] By dynamically monitoring and adjusting the request isolation pool, the server's stress resistance is improved and the processing efficiency of business requests is ensured.
[0069] A hardware listener can also be established on the server to monitor the CPU and memory usage of the server. If the CPU utilization exceeds a fixed utilization threshold (for example, 80 percent) but the memory utilization does not increase much, the dynamic monitoring and adjustment of the request isolation pool in the request container will be stopped; if the CPU utilization and memory utilization are both above the fixed utilization threshold, the dynamic monitoring and adjustment of the request isolation pool in the request container will continue until the memory utilization drops to the green utilization threshold (for example, 50 percent).
[0070] By monitoring the CPU and memory usage of the server as described above, it is ensured that the server can maintain sufficient memory resources to keep the server in high performance mode and avoid excessive load.
[0071] S240: Detect the number of pending business requests in the request isolation pool, and determine whether to enable a request current limiting function for the request container according to the detection result.
[0072] S250: Based on the request current limiting function, a target request queue is established, and a target communication connection mode between the newly received service request is established, and a target service request corresponding to the service request is generated and placed in the target request queue.
[0073] S260: According to the target request queue, respond to the target service request.
[0074] The technical solution of the embodiment of the present invention improves the utilization efficiency of server resources and further improves the processing efficiency of business requests by classifying and storing business requests, adopting different response methods to process them, and dynamically and reasonably allocating server resources.
[0075] Embodiment 3
[0076] Figure 3 This is a flowchart of a method for isolating a service request provided in the third embodiment of the present invention. This embodiment further refines the above embodiment and provides a method for establishing a target request queue based on a request current limiting function, establishing a communication connection method with a newly received service request, and generating a target service request corresponding to the service request and placing it in the target request queue. It should be noted that for the undetailed parts of the embodiments of the present invention, please refer to the relevant descriptions of other embodiments, which will not be repeated here. Figure 3 As shown, the method includes:
[0077] S310: Building a request container to receive a business request from a user, and establishing at least two request isolation pools in the request container according to the request frequency of the business request.
[0078] S320: Detect the number of pending business requests in the request isolation pool, and determine whether to enable a request current limiting function for the request container according to the detection result.
[0079] S330: When the request current limiting function is enabled, the target communication connection service is started, and the request identifier and target communication connection information of the newly received service request are returned to the sender of the service request to establish a target communication connection with the sender.
[0080] S340: Generate a target service request according to the request identifier and request format information of the service request, and store it in a target request queue.
[0081] Specifically, after the request current limiting function is turned on, the server can start the target communication connection service, and return the request identifier and target communication connection information of the newly received business request to the user who sent the business request, so that the user can establish a target communication connection with the server based on the request identifier and target communication connection information of the business request. And generate a target business request that complies with the target communication protocol based on the request identifier and request identifier information of the business request, and store it in the target request queue. The server will also establish a mapping relationship between the request identifier of the business request and the response function of the business request, and can determine the response function corresponding to the target business request in the mapping relationship based on the request identifier information. Optionally, the response function can refer to the business execution action of the request result corresponding to the business request to complete the business needs of the user, for example, displaying the request result, etc.
[0082] S350: According to the target request queue, respond to the target service request.
[0083] Specifically, the server can allocate the target business request in the target request queue to its corresponding request isolation pool according to the target request queue, wait for the request isolation pool to allocate processor resources, respond to it, and after responding to the target business request, the request result corresponding to the target business request and the response function determined according to the request identifier of the target business request can be returned to the user through the target communication protocol, so that the user can complete the corresponding business execution action according to the request result and the response function.
[0084] Optionally, the server can monitor the memory usage of the target request queue. If the target service request stored in the target request queue exceeds half of the maximum memory of the target request queue, all service requests are rejected. If the target service request stored in the target request queue is less than the minimum memory usage of the maximum memory of the target request queue, normal processing of service requests is resumed without converting the communication protocol for the newly received service request. Optionally, the minimum memory usage can be adaptively set according to those skilled in the art.
[0085] By dynamically adjusting the way business requests are processed, server resources can be reasonably allocated and the processing efficiency of business requests can be improved.
[0086] The technical solution of the embodiment of the present invention, by turning on the request current limiting function, requests the newly received business request to be rebuilt based on the target communication connection service, and establishes a target communication connection with the user party, thereby avoiding the server being unable to process the newly received business request in a timely manner and returning a request exception to the user party, resulting in the application system being unable to respond to the business request to perform the corresponding business execution action.
[0087] Embodiment 4
[0088] Figure 4 This is a schematic diagram of the structure of a device for isolating a service request provided by Embodiment 4 of the present invention. Figure 4 As shown, the device comprises:
[0089] The isolation pool construction module 410 is used to construct a request container to receive service requests from users, and to establish at least two request isolation pools in the request container according to the request frequency of the service requests; wherein different request isolation pools have different processing modes for service requests in the request isolation pools;
[0090] The current limiting module 420 is used to detect the number of pending business requests in the request isolation pool, and determine whether to enable the request current limiting function for the request container according to the detection result;
[0091] The queue generation module 430 is used to establish a target request queue based on the request current limiting function, and establish a target communication connection mode with the newly received processing service request, and at the same time generate a target service request corresponding to the service request and put it into the target request queue;
[0092] The response module 440 is used to respond to the target service request according to the target request queue.
[0093] The technical solution of the embodiment of the present invention stores business requests in request isolation pools with different processing methods according to the request frequency of the business requests, improves the processing efficiency of business requests by reasonably allocating server resources, and detects the number of pending business requests in the request container to enable the request current limiting function. By starting the target communication connection service, a target business request corresponding to the newly received business request is generated to avoid an avalanche of the application system due to abnormal responses to pending business requests when the load pressure of the application system is too large, thereby ensuring the smooth operation of the application system.
[0094] Optionally, the isolation pool construction module 410 includes:
[0095] An identifier generating unit, used for receiving a service request from a user, and generating a request identifier of the service request according to request format information of the service request;
[0096] An isolation pool generating unit is used to classify the service requests according to the access frequency of the access object, and generate at least two request isolation pools in the request container; wherein the access object refers to the object requested by the service request;
[0097] A storage unit is used to store the business request in a key-value pair format in a request isolation pool; wherein, the business request stored in the request isolation pool has a unique corresponding request identifier, and the business request stored in the request isolation pool uses the transmission parameter string of the business request as the key and the type of the request isolation pool as the value.
[0098] Optionally, the isolation pool generation unit includes:
[0099] The first isolation pool sub-unit is used to store the business request in the first request isolation pool if the access frequency of the access object of the business request is less than or equal to the first access frequency; wherein a fixed number of processor resources are pre-set in the first request isolation pool, and the business requests in the first request isolation pool use the processor resources in turn through polling.
[0100] The second isolation pool sub-unit is used to store the business request in the second request isolation pool if the access frequency of the access object of the business request is greater than the first access frequency and less than the second access frequency; wherein, for each new business request in the second request isolation, a new processor resource will be synchronously created to process the new business request.
[0101] The third isolation pool subunit is used to store the business request in the third request isolation pool if the access frequency of the access object of the business request is greater than or equal to the second access frequency; wherein, in the third request isolation pool, only one business request is processed at the same time.
[0102] Optionally, the current limiting module 420 can be specifically used to: detect the number of pending business requests in all request isolation pools; if the number of pending business requests in the request isolation pool exceeds a first preset ratio of the sum of the signal processing thresholds of each request isolation pool, determine to enable the request current limiting function of the request container.
[0103] Optionally, the queue generation module 430 includes:
[0104] A communication establishing unit, configured to start a target communication connection service when the request current limiting function is turned on, and return the request identifier and target communication connection information of the newly received service request to the sender of the service request to establish a target communication connection with the sender;
[0105] The queue generating unit is used to generate a target service request according to the request identifier and request format information of the service request, and store the target service request in the target request queue.
[0106] Optionally, the device further comprises:
[0107] The monitoring update module is used to monitor the number of request users who issue business requests. When the number of users exceeds a preset user threshold, the number of business requests stored in the request isolation pool in the request container is detected. If there is a request isolation pool with a number greater than the total number of requests of a second preset ratio, the signal processing threshold of the request isolation pool is updated.
[0108] The service request isolation device provided in the embodiment of the present invention can execute the service request isolation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0109] Embodiment 5
[0110] Figure 5 A schematic diagram of the structure of an electronic device 510 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0111] like Figure 5As shown, the electronic device 510 includes at least one processor 511, and a memory connected to the at least one processor 511 in communication, such as a read-only memory (ROM 512), a random access memory (RAM 513), etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 511 can perform various appropriate actions and processes according to the computer program stored in the ROM 512 or the computer program loaded from the storage unit 518 to the RAM 513. In the RAM 513, various programs and data required for the operation of the electronic device 510 can also be stored. The processor 511, the ROM 512, and the RAM 513 are connected to each other via a bus 514. An input / output interface (I / O interface 515) is also connected to the bus 514.
[0112] A number of components in the electronic device 510 are connected to the I / O interface 515, including: an input unit 516, such as a keyboard, a mouse, etc.; an output unit 517, such as various types of displays, speakers, etc.; a storage unit 518, such as a disk, an optical disk, etc.; and a communication unit 519, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 519 allows the electronic device 510 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0113] The processor 511 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 511 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 511 executes the various methods and processes described above, such as the isolation method of the service request.
[0114] In some embodiments, the isolation method of business requests may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 518. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 510 via the ROM 512 and / or the communication unit 519. When the computer program is loaded into the RAM 513 and executed by the processor 511, one or more steps of the isolation method of business requests described above may be performed. Alternatively, in other embodiments, the processor 511 may be configured to perform the isolation method of business requests in any other appropriate manner (e.g., by means of firmware).
[0115] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0116] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0117] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0118] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0119] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0120] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0121] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0122] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for isolating a service request, characterized in that: The method comprises: Building a request container to receive a business request from a user, and establishing at least two request isolation pools in the request container according to the request frequency of the business request; wherein different request isolation pools have different processing modes for business requests in the request isolation pools; Detect the number of pending business requests in the request isolation pool, and determine whether to enable the request current limiting function for the request container according to the detection result; When the request current limiting function is enabled, the target communication connection service is started, and the request identifier and target communication connection information of the newly received service request are returned to the sender of the service request to establish a target communication connection with the sender; Generate a target service request according to the request identifier and request format information of the service request, and store it in the target request queue; wherein the target communication connection mode refers to the communication connection mode of the long connection established between the target service request and the server, and the communication protocol conforming to the communication connection mode is different from the communication protocol of the original service request corresponding to the target service request; According to the target request queue, respond to the target service request; The construction of a request container receives a business request from a user, and establishes at least two request isolation pools in the request container according to the request frequency of the business request, including: If the access frequency of the access object of the business request is less than or equal to the first access frequency, the business request is stored in the first request isolation pool; wherein a fixed number of processor resources are pre-set in the first request isolation pool, and the business requests in the first request isolation pool use the processor resources in turn by polling; the access object refers to the object requested by the business request; If the access frequency of the access object of the business request is greater than the first access frequency and less than the second access frequency, the business request is stored in the second request isolation pool; wherein, for each new business request in the second request isolation, a new processor resource will be synchronously created to process the new business request; If the access frequency of the access object of the business request is greater than or equal to the second access frequency, the business request is stored in the third request isolation pool; wherein, in the third request isolation pool, only one business request is processed at the same time.
2. The method for isolating a service request according to claim 1, characterized in that: Building a request container to receive a business request from a user, and establishing at least two request isolation pools in the request container according to the request frequency of the business request, further comprising: Receive a business request from a user, and generate a request identifier for the business request based on the request format information of the business request; the business request is stored in a request isolation pool in a key-value pair format, and the business requests stored in the request isolation pool have a unique corresponding request identifier. The business requests stored in the request isolation pool use the transfer parameter string of the business request as the key and the type of the request isolation pool as the value.
3. The method for isolating a service request according to claim 1, characterized in that: Detecting the number of pending business requests in the request isolation pool, and determining whether to enable the request current limiting function for the request container according to the detection result, including: The number of pending business requests in all request isolation pools is detected. If the number of pending business requests in the request isolation pool exceeds a first preset ratio of the sum of the signal processing thresholds of each request isolation pool, it is determined to enable the request current limiting function of the request container.
4. The method for isolating a service request according to claim 1, characterized in that: After building a request container for receiving a business request from a user and establishing at least two request isolation pools in the request container according to the request frequency of the business request, the method further includes: Monitor the number of request users that issue business requests. When the number of users exceeds a preset user threshold, detect the number of business requests stored in the request isolation pool in the request container. If there is a request isolation pool with a number greater than the total number of requests of a second preset ratio, update the signal processing threshold of the request isolation pool.
5. A device for isolating a service request, characterized in that: The device comprises: An isolation pool construction module is used to construct a request container to receive business requests from users, and to establish at least two request isolation pools in the request container according to the request frequency of the business requests; wherein different request isolation pools have different processing modes for business requests in the request isolation pools; A current limiting module is used to detect the number of pending business requests in the request isolation pool, and determine whether to enable the request current limiting function for the request container according to the detection result; A queue generation module is used to establish a target request queue based on the request current limiting function, and establish a target communication connection mode with the newly received processing service request, and at the same time generate a target service request corresponding to the service request and put it into the target request queue; wherein the target communication connection mode refers to a communication connection mode of a long connection established between the target service request and the server, and the communication protocol complied with by the communication connection mode is different from the communication protocol of the original service request corresponding to the target service request; A response module, used for responding to the target service request according to the target request queue; Among them, the queue generation module includes: A communication establishing unit, configured to start a target communication connection service when the request current limiting function is turned on, and return the request identifier and target communication connection information of the newly received service request to the sender of the service request to establish a target communication connection with the sender; A queue generating unit, used for generating a target service request according to the request identifier and request format information of the service request, and storing the target service request in a target request queue; Wherein, the isolation pool construction module includes: A first isolation pool subunit is used to store the service request in a first request isolation pool if the access frequency of the access object of the service request is less than or equal to the first access frequency; wherein a fixed number of processor resources are pre-set in the first request isolation pool, and the service requests in the first request isolation pool use the processor resources in turn by polling; A second isolation pool subunit is used to store the business request in a second request isolation pool if the access frequency of the access object of the business request is greater than the first access frequency and less than the second access frequency; wherein, for each new business request in the second request isolation, a new processor resource will be synchronously created to process the new business request; The third isolation pool subunit is used to store the business request in the third request isolation pool if the access frequency of the access object of the business request is greater than or equal to the second access frequency; wherein, in the third request isolation pool, only one business request is processed at the same time.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for isolating a service request according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for isolating a service request according to any one of claims 1 to 4 when executed.
8. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the method for isolating the service request according to any one of claims 1 to 4.
Citation Information
Patent Citations
Concurrent request processing method, computer equipment and computer readable storage medium
CN113794650A
Data processing method and device, electronic equipment and storage medium
CN118740742A