Method and system for adjusting service dependent thread pool in server

By dynamically adjusting the thread pool size in Hystrix based on the importance of the remote service and real-time resource information, the problem that the thread pool cannot automatically generate dynamic adjustments is solved, the service responsiveness and resource utilization are improved, and resource waste and blocking are avoided.

CN118550696AActive Publication Date: 2024-08-27BEIJING QICHUANG TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410619751.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-16
Publication Date
2024-08-27
Estimated Expiration
2044-05-16

AI Technical Summary

Technical Problem

When using Hystrix, the service thread pool cannot automatically generate dynamic adjustments, leading to resource waste or blocking problems. The existing technology relies on empirical settings and cannot be adjusted according to actual operating conditions.

Method used

By identifying the level in the xml file according to the importance of the remote service during the coding phase, real-time statistics of resource information and call frequency are used to dynamically adjust the thread pool size using formulas to ensure the appropriate size of the thread pool and avoid resource waste and blocking.

Benefits of technology

It realizes intelligent adjustment of the thread pool, avoids the shortcomings of experience settings, improves the intelligence of Hystrix, adapts to different load conditions, and ensures service responsiveness and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550696A
    Figure CN118550696A
Patent Text Reader

Abstract

The invention provides a method and system for adjusting a service dependency thread pool in a server, and the method comprises the steps: marking a remote service level called by a web application in an xml file in a program coding stage, and calculating a resource average value occupied by each thread in program operation; the instant calling frequency f and the average calling frequency faveage of the remote service are obtained, the residual resource information rremader of the server is collected in real time, and the resource information comprises CPU resource information, memory resource information and network bandwidth resource information; and determining the size of the thread pool of the remote service according to the level s, the instant calling frequency f of the remote service, the average calling frequency faveage, the average resource value of each thread, and the residual resource information rremainer of the server collected in real time every preset time. According to the method and the device, the problem that the size of the thread pool can only be manually set and cannot be dynamically adjusted in the process of using the Hystrix is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to service dependency, and in particular, to adjustment of a service dependency thread pool in a server. Background Art

[0002] Microservices were first proposed by Peter Rodgers in 2005. James Lewis and Martin Fowler published an article in 2014 that elaborated on microservices and promoted their development. Microservices are small and autonomous services that call and cooperate with each other to provide specific services to users. Microservices have the characteristics of high cohesion and low coupling. The mutual calls between microservices, that is, microservice dependency, refer to the mutual dependence between services. For example, service A depends on service B, that is, service A will call service B, and the call result of service B will be returned to service A so that service A can complete the service. Service dependency is the inevitable result of the development of high cohesion and low coupling.

[0003] Although service calls and service dependencies solve the problem of reinventing the wheel, since many services call a microservice, if a called service crashes, all services that call the service upstream will hang or even crash. A typical scenario is avalanche. Service avalanche is a phenomenon in which the service provided by the service provider is unavailable, resulting in a gradual increase in unavailability. There are many reasons for avalanches, such as hardware failure, program bugs, cache breakdown, etc. At the same time, in order to prevent avalanches, a variety of tools can be used to implement functions such as flow control and service degradation. Hystrix is ​​an open source architecture that provides delay and fault tolerance functions. Hystrix uses pool technology to isolate resources to prevent the program from exhausting resources. However, the inventor found during use that the service thread pool of Hystrix is ​​only set by the developer based on his own experience, and cannot be adjusted according to the actual operation during program operation. If too many thread pools are set, resources will be wasted. If too few thread pools are set, service requests will be blocked. How to let Hystrix adjust the number of threads in the thread pool by itself is a technical problem that needs to be solved in this field. Summary of the invention

[0004] In order to solve the above problems, the present invention provides a method and system for adjusting a service-dependent thread pool in a server.

[0005] In one aspect, the present invention provides a method for adjusting a service-dependent thread pool in a server, comprising the following steps:

[0006] S1, in the coding stage, according to the importance of remote services in the web program, the level s of all remote services in the web program is identified in the XML file;

[0007] S2: During program operation, the resource information occupied by the web program and the number of threads m in the remote call thread pool of the web program are counted, and the average resource occupied by each thread is calculated based on the resource information occupied by the web program and the number of threads in the remote call thread pool of the web program. Get the instantaneous call frequency f and average call frequency f of the remote service average , and collect the remaining resource information of the server in real time in Respectively represent the average CPU usage, average memory usage, and average network bandwidth usage of each thread. Respectively represent the remaining CPU resources, memory resources, and network bandwidth resources of the real-time acquisition server;

[0008] S3, at preset intervals, according to the level s, the instantaneous call frequency f of the remote service, and the average call frequency f average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool for the remote service.

[0009] Preferably, the S3 further comprises respectively calculating Substitute the resource with the smallest ratio between the remaining server resources and the average resource value into formula (1), and obtain the adjusted number of threads n according to formula (1), which is:

[0010]

[0011] Wherein, s is any positive integer from 1 to 10. The larger s is, the more important the remote service is. f represents the instantaneous call frequency of the remote service. average represents the average call frequency of remote services, n0 represents the number of threads in the thread pool before adjustment, r′ remainder 、r average Respectively The resource with the smallest ratio corresponds to the remaining resource information in the server and the average resource occupied by each thread. When f>f average Indicates adding threads to the thread pool. When f <f average Indicates reducing the number of threads in the thread pool.

[0012] Preferably, during the cold start phase, the thread pool size for all remote calls is set to 1 or 2.

[0013] Preferably, S3 also includes determining the relationship between the size of the determined remote service thread pool and the size of the original remote service thread pool. If they are equal, the thread pool is not adjusted; if they are greater, a new thread is added to the thread pool; if they are less, when there are idle threads in the thread pool, the idle threads are removed from the thread pool.

[0014] Preferably, S2 further includes: during program operation, uploading the XML file to a server providing remote services, and the server allocating resources to the program providing remote services according to the collected XML file information.

[0015] On the other hand, the present invention also provides a service dependency thread pool adjustment system in a server, comprising the following modules:

[0016] The service level setting module, in the coding stage, identifies the level s of all remote services in the web program in the XML file according to the importance of the remote service in the web program;

[0017] The information collection and reporting module counts the resource information occupied by the web program and the number of threads m in the remote call thread pool of all web programs during program operation, and calculates the average resource occupied by each thread based on the resource information occupied by the web program and the number of threads in the remote call thread pool of all web programs. Get the instantaneous call frequency f and average call frequency f of the remote service average , and collect the remaining resource information of the server in real time in Respectively represent the average CPU usage, average memory usage, and average network bandwidth usage of each thread. Respectively represent the remaining CPU resources, memory resources, and network bandwidth resources of the real-time acquisition server;

[0018] The thread pool adjustment module adjusts the thread pool at preset intervals according to the level s, the instantaneous call frequency f of the remote service, and the average call frequency f. average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool for the remote service.

[0019] Preferably, the thread pool adjustment module further comprises: Substitute the resource with the smallest ratio between the remaining server resources and the average resource value into formula (1), and obtain the adjusted number of threads n according to formula (1), which is:

[0020]

[0021] Wherein, s is any positive integer from 1 to 10. The larger s is, the more important the remote service is. f represents the instantaneous call frequency of the remote service. average represents the average call frequency of remote services, n0 represents the number of threads in the thread pool before adjustment, r′ remainder , r′ average Respectively The resource with the smallest ratio corresponds to the remaining resource information in the server and the average resource occupied by each thread. When f>f average Indicates adding threads to the thread pool. When f <f average Indicates reducing the number of threads in the thread pool.

[0022] Preferably, the thread pool adjustment module also includes a judgment module, which is used to judge the relationship between the size of the determined remote service thread pool and the size of the original remote service thread pool. If they are equal, the thread pool is not adjusted; if they are greater, a new thread is added to the thread pool; if they are less than, when there are idle threads in the thread pool, the idle threads are removed from the thread pool.

[0023] Preferably, the information collection and reporting module is also used to: upload the XML file to the server providing remote services during program operation, and the server allocates resources to the program providing remote services based on the collected XML file information and the average calling frequency.

[0024] The present invention also provides a computer-readable storage medium for storing computer program instructions, wherein the computer program instructions implement the above-mentioned method when executed by a processor.

[0025] The present invention solves the problem that the thread pool cannot be dynamically adjusted by itself when using Hystrix, and uses level s, remote service instantaneous call frequency f, and average call frequency f average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool of the remote service, which can not only increase the remote call thread pool, but also reduce the remote call thread pool, effectively improving the intelligence of Hystrix and avoiding the shortcomings of setting based on experience. Moreover, when the program using Hystrix is ​​transplanted to other servers, there is no need to manually modify the configuration of the thread pool, and the system will automatically adjust the thread pool size.

[0026] In addition, the server that provides remote services will also collect the user's setting information on the remote call level. For calls that the caller considers to be high-level calls, the service provider will allocate more resources to these services to prevent service blocking from affecting the caller. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0028] Figure 1 This is a schematic diagram of Hystrix;

[0029] Figure 2 This is a schematic diagram of an XML file of the present invention;

[0030] Figure 3 This is another schematic diagram of the XML file of the present invention. DETAILED DESCRIPTION

[0031] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] Attached Figure 1 The method of using Hystrix in the prior art to implement resource isolation in service dependencies is shown, such as Figure 1As shown, when using Hystrix, users can set the number of threads in the thread pool through the parameters coreSize and maximumSize. For example, to call service A, set coreSize and maximumSize to the default value of 10. You can also set them to other values ​​as needed during programming. However, once the above values ​​are set, they cannot be reset during program operation. On the other hand, the program itself cannot be adjusted dynamically, especially when the web program is migrated to another server.

[0034] In one embodiment, the present invention provides a method for adjusting a service-dependent thread pool in a server, comprising the following steps:

[0035] S1, in the coding stage, according to the importance of remote services in the web program, the level s of all remote services in the web program is identified in the XML file;

[0036] S2: During program operation, the resource information occupied by the web program and the number of threads m in the remote call thread pool of the web program are counted, and the average resource occupied by each thread is calculated based on the resource information occupied by the web program and the number of threads in the remote call thread pool of the web program. Get the instantaneous call frequency f and average call frequency f of the remote service average , and collect the remaining resource information of the server in real time in Respectively represent the average CPU usage, average memory usage, and average network bandwidth usage of each thread. Respectively represent the remaining CPU resources, memory resources, and network bandwidth resources of the real-time acquisition server;

[0037] S3, at preset intervals, according to the level s, the instantaneous call frequency f of the remote service, and the average call frequency f average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool for the remote service.

[0038] Preferably, the S3 further comprises respectively calculating Substitute the resource with the smallest ratio between the remaining server resources and the average resource value into formula (1), and obtain the adjusted number of threads n according to formula (1), which is:

[0039]

[0040] Wherein, s is any positive integer from 1 to 10. The larger s is, the more important the remote service is. f represents the instantaneous call frequency of the remote service. averagerepresents the average call frequency of remote services, n0 represents the number of threads in the thread pool before adjustment, r′ remainder , r′ average Respectively The resource with the smallest ratio corresponds to the remaining resource information in the server and the average resource occupied by each thread. When f>f average Indicates adding threads to the thread pool. When f <f average Indicates reducing the number of threads in the thread pool.

[0041] Preferably, during the cold start phase, the thread pool size for all remote calls is set to 1 or 2.

[0042] Preferably, S3 also includes determining the relationship between the size of the determined remote service thread pool and the size of the original remote service thread pool. If they are equal, the thread pool is not adjusted; if they are greater, a new thread is added to the thread pool; if they are less, when there are idle threads in the thread pool, the idle threads are removed from the thread pool.

[0043] Preferably, S2 further comprises: when the program is running, uploading the XML file to the server providing remote services, and the server allocates resources to the program providing remote services according to the collected XML file information and the average calling frequency.

[0044] In another embodiment, the xml file includes the average call frequency, and its exemplary structure is as shown in the attached Figure 3 If an XML file including the average call frequency is used, it is only necessary to upload the XML file, and the server where the remote service is located allocates resources to the program providing the remote service according to the collected XML file.

[0045] The following is a further description of an embodiment of the present invention by taking an example. It should be noted that this example is only for facilitating the understanding of the present invention and does not constitute a specific limitation of the present invention.

[0046] When developing a web program, there will be multiple remote calls. For example, the web program calls service A, service B, and service C. Service A involves order payment, service B involves order query, and service C involves comments. Since service A involves order payment, its importance level is the highest, followed by service B and service C. There is an xml file in the web program, and its structure is as shown in the attached figure. Figure 2 shown.

[0047] Attached Figure 2Here, id is the identifier of the service, name is the name of the service, and grade is the importance of the service in the web service. The same service may have different importance in different applications. For example, the importance of service A in this web program is 10, but it may be 3 in other web programs.

[0048] Service levels are also used in service degradation. For example, if service degradation occurs, the lower the level of service, the greater the degradation.

[0049] In one embodiment, the service provider will collect XML documents, or the service caller will upload XML files to the server providing remote services. The server will allocate resources to the program providing remote services based on the collected XML file information and the average call frequency. In this way, the resources occupied by the remote service can be dynamically adjusted according to the call situation, the response capability of the remote service can be improved, and the delay can be reduced. For example, if three service callers call on remote services A and B, and the levels set for service A in the three XMLs are 10, 8, and 2 respectively, and the average call frequency is 10, 5, and 2, and the levels set for service B are 4, 6, and 2 respectively, and the average call frequency is 20, 3, and 10, the call value for service A is calculated to be 10*10+8*5+2*2=144, and the call value for service B is 4*20+6*3+2*10=118, then more resources will be allocated to service A.

[0050] In another example, the resource adjustment is performed based on the comparison between the original call status of the service and the current call status. For example, if the original call value of service A is 180 and the current call value is 144, the resource allocation to service A is reduced.

[0051] The following takes the adjustment of threads in the thread pool of service A as an example to further illustrate the embodiments of the present invention.

[0052] When the web program is running, the resource information occupied by the web program and the number of threads m in the remote call thread pool of all the web programs are counted. According to the resource information occupied by the web program and the number of threads in the remote call thread pool of all the web programs, the average resource occupied by each thread r is calculated. average ; Get the remote service instantaneous call frequency f=50 and the average call frequency f average = 20, and collect the remaining resource information of the server in real time remainder, the resource information includes CPU resource information, memory resource information, and network bandwidth resource information. For example, the CPU resource occupied by the web program is 20%, the memory occupies 512M, and the network bandwidth occupancy rate is 10%. The number of threads in all remote call thread pools of the web program is n0=4 threads in the thread pool of service A, n0=4 threads in the thread pool of service B, and n0=2 threads in the thread pool of service C, a total of 10 threads. The average resource occupied by each thread is r average ={2%, 51.2M, 1%}. It should be noted that the present invention adopts the estimation method to adjust the thread pool, which is simple and fast to calculate and will not occupy too much system resources. The instantaneous call frequency of remote service A is 50, the average call frequency is 20, and the remaining resources of the server are r remainder ={50%, 1024M, 30%}.

[0053] Then, the remote service instantaneous call frequency f and the average call frequency f can be calculated at preset intervals according to the level s, the instantaneous call frequency f and the average call frequency f. average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool for the remote service.

[0054] In one embodiment, respectively calculate Substitute the resource with the smallest ratio between the remaining server resources and the average resource value into formula (1), and obtain the adjusted number of threads n according to formula (1), which is:

[0055]

[0056] calculate 25, 20, and 30 respectively. It can be seen that the change of the thread pool mainly depends on the memory. remainder =1024M, r′ average =51.2M, n0=4, f=50, f average =20, s=10, and substituting into formula (1), n=20, the thread pool size of service A is adjusted from the original 4 to 20.

[0057] Similarly, if the remote service instantaneous call frequency f = 20 and the average call frequency f average =50, and then we substitute it into formula (1), and get n=3, that is, the thread pool size of service A is adjusted from the original 4 to 3, where [] in formula (1) means rounding up.

[0058] How to determine the specific level s, remote service instantaneous call frequency f, and average call frequency f average And the average resource usage of each thread raverage , real-time collection of the remaining resource information of the server remainder There are many ways to determine the size of the thread pool of the remote service. The above is just an example and does not constitute a limitation of the present invention.

[0059] In another embodiment, the xml file includes the average call frequency, and its exemplary structure is as shown in the attached Figure 3 If an XML file including the average call frequency is used, it is only necessary to upload the XML file, and the server where the remote service is located allocates resources to the program providing the remote service according to the collected XML file.

[0060] In another example, the resource adjustment is performed based on the comparison between the original call status of the service and the current call status. For example, if the original call value of service A is 180 and the current call value is 144, the resource allocation to service A is reduced.

[0061] In another embodiment, the present invention further provides a service dependency thread pool adjustment system in a server, comprising the following modules:

[0062] The service level setting module, in the coding stage, identifies the level s of all remote services in the web program in the XML file according to the importance of the remote service in the web program;

[0063] The information collection and reporting module counts the resource information occupied by the web program and the number of threads m in the remote call thread pool of all web programs during program operation, and calculates the average resource occupied by each thread based on the resource information occupied by the web program and the number of threads in the remote call thread pool of all web programs. Get the instantaneous call frequency f and average call frequency f of the remote service average , and collect the remaining resource information of the server in real time in Respectively represent the average CPU usage, average memory usage, and average network bandwidth usage of each thread. Respectively represent the remaining CPU resources, memory resources, and network bandwidth resources of the real-time acquisition server;

[0064] The thread pool adjustment module adjusts the thread pool at preset intervals according to the level s, the instantaneous call frequency f of the remote service, and the average call frequency f. average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool for the remote service.

[0065] Preferably, the thread pool adjustment module further comprises: Substitute the resource with the smallest ratio between the remaining server resources and the average resource value into formula (1), and obtain the adjusted number of threads n according to formula (1), which is:

[0066]

[0067] Wherein, s is any positive integer from 1 to 10. The larger s is, the more important the remote service is. f represents the instantaneous call frequency of the remote service. average represents the average call frequency of remote services, n0 represents the number of threads in the thread pool before adjustment, r′ remainder , r′ average Respectively The resource with the smallest ratio corresponds to the remaining resource information in the server and the average resource occupied by each thread. When f>f average Indicates adding threads to the thread pool. When f <f average Indicates reducing the number of threads in the thread pool.

[0068] Preferably, the thread pool adjustment module also includes a judgment module, which is used to judge the relationship between the size of the determined remote service thread pool and the size of the original remote service thread pool. If they are equal, the thread pool is not adjusted; if they are greater, a new thread is added to the thread pool; if they are less than, when there are idle threads in the thread pool, the idle threads are removed from the thread pool.

[0069] Preferably, the information collection and reporting module is also used to: upload the XML file to the server providing remote services during program operation, and the server allocates resources to the program providing remote services based on the collected XML file information and the average calling frequency.

[0070] In addition, in another embodiment, the present invention further provides a computer-readable storage medium for storing computer program instructions, wherein the computer program instructions implement the method described in Embodiment 1 when executed by a processor.

[0071] The various embodiments described in the present invention can be combined to implement the corresponding technical solutions. The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, software modules executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.

Claims

1. A method for adjusting a service-dependent thread pool in a server, characterized in that: The method comprises the following steps: S1, in the coding stage, according to the importance of remote services in the web program, the level s of all remote services in the web program is identified in the XML file; S2: During program operation, the resource information occupied by the web program and the number of threads m in the remote call thread pool of the web program are counted, and the average resource occupied by each thread is calculated based on the resource information occupied by the web program and the number of threads in the remote call thread pool of the web program. Get the instantaneous call frequency f and average call frequency f of the remote service average , and collect the remaining resource information of the server in real time in Respectively represent the average CPU usage, average memory usage, and average network bandwidth usage of each thread. Respectively represent the remaining CPU resources, memory resources, and network bandwidth resources of the real-time acquisition server; S3, at preset intervals, according to the level s, the instantaneous call frequency f of the remote service, and the average call frequency f average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool for the remote service.

2. The method according to claim 1, characterized in that The S3 also includes calculating Substitute the resource with the smallest ratio between the remaining server resources and the average resource value into formula (1), and obtain the adjusted number of threads n according to formula (1), which is: Wherein, s is any positive integer from 1 to 10. The larger s is, the more important the remote service is. f represents the instantaneous call frequency of the remote service. average Indicates the average call frequency of remote services, n0 indicates the adjustment front line The number of threads in the pool, r′ remainder , r′ average Respectively The resource with the smallest ratio corresponds to the remaining resource information in the server and the average resource occupied by each thread. When f>f average Indicates adding threads to the thread pool. When f <f average Indicates reducing the number of threads in the thread pool.

3. The method according to claim 1 or 2, characterized in that The S3 also includes setting the thread pool size of all remote calls to 1 or 2 during the cold start phase.

4. The method according to claim 1 or 2, characterized in that: The S3 also includes determining the relationship between the size of the determined remote service thread pool and the size of the original remote service thread pool. If they are equal, the thread pool is not adjusted; if they are greater, a new thread is added to the thread pool; if they are less, when there are idle threads in the thread pool, the idle threads are removed from the thread pool.

5. The method according to claim 1, characterized in that The S2 also includes: when the program is running, uploading the XML file to the server providing remote services, and the server allocating resources to the program providing remote services according to the collected XML file information and the average calling frequency.

6. A service-dependent thread pool adjustment system in a server, characterized in that: The system includes the following modules: The service level setting module, in the coding stage, identifies the level s of all remote services in the web program in the XML file according to the importance of the remote service in the web program; The information collection and reporting module counts the resource information occupied by the web program and the number of threads m in the remote call thread pool of all web programs during program operation, and calculates the average resource occupied by each thread based on the resource information occupied by the web program and the number of threads in the remote call thread pool of all web programs. Get the instantaneous call frequency f and average call frequency f of the remote service average , and collect the remaining resource information of the server in real time in Respectively represent the average CPU usage, average memory usage, and average network bandwidth usage of each thread. Respectively represent the remaining CPU resources, memory resources, and network bandwidth resources of the real-time acquisition server; The thread pool adjustment module adjusts the thread pool at preset intervals according to the level s, the instantaneous call frequency f of the remote service, and the average call frequency f. average And the average resource usage of each thread r average , real-time collection of the remaining resource information of the server remainder , determine the size of the thread pool for the remote service.

7. The system according to claim 6, characterized in that The thread pool adjustment module is also used to calculate Substitute the resource with the smallest ratio between the remaining server resources and the average resource value into formula (1), and obtain the adjusted number of threads n according to formula (1), which is: Wherein, s is any positive integer from 1 to 10. The larger s is, the more important the remote service is. f represents the instantaneous call frequency of the remote service. average represents the average call frequency of remote services, n0 represents the number of threads in the thread pool before adjustment, r′ remainder , r′ average Respectively The resource with the smallest ratio corresponds to the remaining resource information in the server and the average resource occupied by each thread. When f>f average Indicates adding threads to the thread pool. When f <f average Indicates reducing the number of threads in the thread pool.

8. The system according to claim 6 or 7, characterized in that The thread pool adjustment module also includes a judgment module, which is used to judge the relationship between the size of the determined remote service thread pool and the size of the original remote service thread pool. If they are equal, the thread pool is not adjusted; if they are greater, a new thread is added to the thread pool; if they are less than, when there are idle threads in the thread pool, the idle threads are removed from the thread pool.

9. The system according to claim 6, characterized in that The information collection and reporting module is also used to: upload the XML file to the server providing remote services during program operation, and the server allocates resources to the program providing remote services based on the collected XML file information and the average calling frequency.

10. A computer-readable storage medium for storing computer program instructions, characterized in that: The computer program instructions implement the method according to any one of claims 1 to 5 when executed by a processor.

Citation Information

Patent Citations

  • Method and device for adjusting thread pool, storage medium and computer equipment

    CN108874550A

  • Thread pool data processing method and device, storage medium and processor

    CN115454588A

  • Micro-service state adjustment method and device, equipment and storage medium

    CN116578359A

  • Socket thread pool design method for multi-terminal wireless communication

    CN116755863A

  • Dynamic adaptive adjustment method, system and equipment for thread pool and storage medium

    CN117707758A