A Tomcat container service capacity evaluation method and system

By obtaining execution information of the Tomcat container through eBPF probes and combining read/write overhead and average execution time, the business capacity of system resources can be assessed. This solves the problems of inaccurate assessment and high cost in existing technologies, and realizes stable operation and elastic scaling support for business systems.

CN114185755BActive Publication Date: 2025-01-07HANGZHOU HARMONYCLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111505975.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-10
Publication Date
2025-01-07
Estimated Expiration
2041-12-10

AI Technical Summary

Technical Problem

Existing technologies for assessing business capacity suffer from problems such as inaccurate predictions, high costs, and the risk of production environment failures, making it difficult to accurately assess the resource requirements of business systems.

Method used

The eBPF probe is used to obtain information about the Tomcat container's execution URL, including the execution start time, end time, and read/write overhead. The system resource's business capacity is evaluated using a formula. Combining read/write overhead and average execution time, capacity assessment is achieved using a probe module, a read/write overhead calculation module, and an evaluation module.

Benefits of technology

It provides a simple and easy-to-use method for assessing business capacity, enabling real-time evaluation of the stable operation of business systems, supporting elastic scaling and alarms, and reducing cost risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114185755B_ABST
    Figure CN114185755B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for evaluating the business capacity of a Tomcat container, which belongs to the field of computer technology. The method comprises: obtaining information of a Tomcat container executing a website based on an eBPF probe, wherein the information includes the execution start time and the end time; obtaining the execution time of the website according to the execution start time and the end time; obtaining the read and write overhead of executing the website; and evaluating the business capacity of system resources according to the read and write overhead and the execution time. Based on the eBPF probe, the information of the execution website is obtained, the real system overhead of the execution website is obtained, and the business capacity is calculated. The evaluation method is simple and easy to implement; it is conducive to real-time evaluation of business capacity, and provides a data basis for the stable operation of the business system; and it provides data support for the elastic expansion and contraction of the business system and the alarm of the business operation status.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and system for evaluating the service capacity of a Tomcat container. Background Art

[0002] Capacity refers to the maximum processing ability of a system for requests when it is under maximum load or when a certain indicator reaches the maximum threshold, such as CPU, IO, memory and other indicators. The business is provided by a series of business systems, and each business system is deployed on different devices. With the development of the business, especially in the scenarios of large-scale promotions and marketing activities (such as Double 11, etc.), it is a big problem to prepare how many devices or device resources for each business system given the business usage. Capacity planning was born to solve this problem. The purpose of capacity assessment is to clearly know each business system: the carrying capacity of business requests, the maximum resource allocation and the optimal resource allocation.

[0003] At present, there are two methods for evaluating business capacity. Method 1: According to the algorithm, fit the relationship between user request volume and resources to predict the future business request volume, but the predicted value is prone to inaccuracy and can only be used as a reference value. Method 2: Find the actual carrying capacity of each system through full-link stress testing. Full-link stress testing generally refers to the full introduction of the associated system to actually use the online hardware environment, with the simulation of real requests as the core, completely simulating the real request traffic, and performing stress testing by simulating the scene through methods such as diversion. The large-scale access of the business is simulated while continuously increasing the pressure, and finally the resource usage is simulated. Method 2 obtains the capacity carrying capacity based on the actual production environment. The data is relatively prepared, but it requires the hardware support of the production environment, the cost is relatively high, and there is a risk of failure in the production environment. Summary of the invention

[0004] In view of the above technical problems existing in the prior art, the present invention provides a method and system for evaluating the business capacity of a Tomcat container, which evaluates the capacity of a business system and facilitates capacity planning.

[0005] The present invention discloses a method for evaluating the business capacity of a Tomcat container. The method comprises: obtaining information of a Tomcat container executing a URL based on an eBPF probe, the information comprising an execution start time and an end time; obtaining the execution time of the URL according to the execution start time and the end time; obtaining the read and write overhead of executing the URL; and evaluating the business capacity of system resources according to the read and write overhead and the execution time.

[0006] Preferably, multiple URLs are included.

[0007] Obtaining the execution cost of each URL respectively, wherein the execution cost includes read and write costs and average execution time;

[0008] Evaluate the business capacity of system resources based on the read and write overhead and average execution time of each URL.

[0009] Preferably, the service capacity is evaluated according to the following formula:

[0010]

[0011] C≤ω1×S

[0012] Where C represents the execution cost, T i It is represented as the execution time of URL i, IOT i It represents the read and write overhead of URL i, K represents the execution volume of URL i, n represents the total number of URLs, ω1 represents the system resource occupancy ratio, and S represents the system resources.

[0013] Preferably, the information also includes context switching time,

[0014] According to the execution start time, end time and context switch time, the execution time of the URL is obtained:

[0015] T i =cpu_end_timestamp-cpu_start_timestamp-switch_time

[0016] Among them, T i It represents the execution time of URL i, cpu_end_timestamp represents the end time of execution, cpu_start_timestamp represents the start time of execution, and switch_time represents the switching time.

[0017] Preferably, the read function is intercepted by the eBPF probe to obtain the execution start time; the write function is intercepted to obtain the execution end time; and the sched_switch function is intercepted to obtain the context switching time.

[0018] Preferably, the method for calculating the average execution time includes:

[0019] Step 301: Preset a plurality of time buckets according to the response time of the website;

[0020] Step 302: Allocate the execution time of the URL to the corresponding time buckets in sequence;

[0021] Step 303: Determine whether the sum of the allocation ratios of the first j duration buckets is greater than a second threshold value, where j is a positive integer;

[0022] If yes, execute step 304: take the average value of the data in the j-th duration bucket as the average execution time.

[0023] Preferably, the method for obtaining the read and write overhead of executing the URL includes:

[0024] Simulate sending of first data to obtain read and write overhead of the first data;

[0025] Calculate the unit read and write overhead according to the size of the first data;

[0026] The read and write overhead of the URL is calculated according to the read and write data volume of the URL.

[0027] The present invention also provides a system for implementing the above method, comprising:

[0028] Detection module, read / write cost calculation module and evaluation module,

[0029] The detection module obtains information about the execution URL of the Tomcat container based on the eBPF probe, wherein the information includes the execution start time and the end time;

[0030] The read-write cost calculation module is used to obtain the read-write cost of executing the website;

[0031] The evaluation module is used to evaluate the service capacity of system resources according to the read and write overhead and the execution time.

[0032] Preferably, the detection module is further used to obtain the execution time of the website according to the context switching time; and calculate the average execution time of the website according to the execution time of the website;

[0033] The read / write overhead calculation module is used to simulate sending the first data to obtain the read / write overhead of the first data; calculate the unit read / write overhead according to the size of the first data; calculate the read / write overhead of the website according to the read / write data volume of the website;

[0034] The evaluation module is also used to obtain the execution overhead of multiple websites, the execution overhead includes read and write overhead and average execution time; based on the read and write overhead and average execution time of each website, the business capacity of the system resources is evaluated.

[0035] Preferably, the system further comprises an elastic expansion module or an alarm module.

[0036] The evaluation module is also used to calculate the system resource occupancy ratio;

[0037] Determining whether the system resource occupancy ratio is greater than a first threshold value;

[0038] If so, the system resources are adjusted through the elastic scaling module, or the alarm module is used to send an alarm message to the management personnel.

[0039] Compared with the prior art, the beneficial effects of the present invention are: based on the eBPF probe, the information of the execution URL is obtained, the actual system overhead of the execution URL is obtained, the business capacity is calculated, and the evaluation method is simple and easy; it is conducive to real-time evaluation of business capacity and provides a data basis for the stable operation of the business system; it provides data support for the elastic scaling of the business system and the alarm of the business operation status. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a flow chart of the service capacity evaluation method of the Tomcat container of the present invention;

[0041] Figure 2 It is a system logic block diagram of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 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.

[0043] The present invention is further described in detail below in conjunction with the accompanying drawings:

[0044] A method for evaluating the service capacity of a Tomcat container, such as Figure 1 As shown, the method includes:

[0045] Step 101: Based on the eBPF probe, obtain the information of the Tomcat container execution URL (url), the information including the execution start time and the execution end time. For example, intercept the read function through the eBPF probe to obtain the execution start time; intercept the write function to obtain the execution end time.

[0046] Step 102: Obtain the execution time of the URL according to the execution start time and end time.

[0047] Step 103: Obtain the read and write overhead of executing the URL.

[0048] Step 104: Evaluate the service capacity of system resources according to the read / write overhead and execution time.

[0049] Based on the eBPF probe, the information of the execution URL is obtained, the actual system overhead of the execution URL is obtained, and the business capacity is calculated. The evaluation method is simple and easy; it is conducive to real-time evaluation of business capacity and provides a data basis for the stable operation of the business system; it provides data support for the elastic scaling of the business system and the alarm of the business operation status.

[0050] Among them, the services of the business system usually provide multiple URLs, and the execution overhead of each URL can be obtained separately, and the execution overhead includes read and write overhead and average execution time; based on the read and write overhead and average execution time of each URL, the business capacity of the system resources is evaluated.

[0051] In a specific embodiment, the following formula is used to evaluate the service capacity:

[0052]

[0053] C≤ω1×S

[0054] Where C represents the execution cost, T i It is represented as the execution time of URL i, IOT i It is represented by the read and write overhead of URL i, K represents the execution volume of URL i, n represents the total number of URLs or the number of requests, ω1 represents the system resource occupancy ratio, and S represents the system resources. That is, the business capacity evaluation includes execution overhead and system resource occupancy ratio.

[0055] To ensure the availability of the business system, the system resource ratio is usually set to 60-80%. The above formula can be used to evaluate the overall capacity of the Tomcat container.

[0056] In step 101, the information of executing a URL may also include a context switching time. The execution time of the URL may be obtained according to the execution start time, end time and context switching time:

[0057] T i =cpu_end_timestamp-cpu_start_timestamp-switch_time

[0058] Among them, T i represents the execution time of URL i, cpu_end_timestamp represents the execution end time, cpu_start_timestamp represents the execution start time, and switch_time represents the switch time. The context switch time can be obtained by intercepting the sched_switch function.

[0059] If there is no context switch between write and read, switch_time is zero.

[0060] Tomcat processes URL requests mainly through the following steps: first, establish a network connection through the system call accept, and represent this connection with socketFD in the operating system; on socketFD, read the data requested by the user by calling the system call read until the reading is completed; the Tomcat thread calls the user code to execute on a CPU core, and this process may cause thread switching due to the expiration of the allocated time slice, and then continue to execute; after the Tomcat thread executes the user code on the CPU, it calls the write system call to return the user request result to the user. Among them, Tomcat is a network server running JAVA, and the Tomcat container is a Serlvet container.

[0061] In step 104, since the execution time has errors or deviations, such as execution time errors of different containers of the same service, the service capacity of the system resources can be evaluated based on the read and write overhead and the average execution time. In a specific embodiment, the bucket sort method is used to calculate the average execution time:

[0062] Step 301: Preset multiple duration buckets according to the response time of the URL. For example, within a certain period of time, the execution time of the URL is divided into 10 buckets, which are: 0-1000 nanoseconds, 1000-2000 nanoseconds, 2000-5000 nanoseconds, 5000-5300 nanoseconds, 5300-5600 nanoseconds, 5600-5700 nanoseconds, 5700-5800 nanoseconds, 5800-5900 nanoseconds, 5900-5950 nanoseconds, 5950-6000 nanoseconds. However, the time range and the duration bucket range are not limited to this.

[0063] Step 302: Allocate the execution time of the URL to the corresponding duration buckets in sequence. Since the execution time follows a uniform distribution, the execution time will be concentrated in one or several duration buckets.

[0064] Step 303: Determine whether the sum of the allocation ratios of the first j duration buckets is greater than a second threshold value, such as 90%, where j is a positive integer.

[0065] If yes, execute step 304: take the average value of the data in the jth time bucket as the average execution time. Execution times with large deviations will be ignored.

[0066] If not, the sum of the allocation ratios of the first j+1 duration buckets is calculated until the sum of the allocation ratios is greater than the second threshold value.

[0067] However, the present invention is not limited thereto. The duration buckets in step 302 may be arranged in descending order. When the sum of the allocation ratios of the first j duration buckets is greater than the second domain value, the average value of the data in the first j duration buckets is used as the average execution time.

[0068] In step 103, the method for obtaining the read-write overhead of executing the website includes: simulating the sending of the first data to obtain the read-write overhead of the first data; calculating the unit read-write overhead according to the size of the first data, wherein the unit read-write overhead = read-write overhead / size of the first data; calculating the read-write overhead of the website according to the read-write data volume of the website, wherein the read-write overhead of the website = read-write data volume * unit read-write overhead. In a specific embodiment, the first data uses 1M data, and the read-write overhead of the first data is the unit read-write overhead.

[0069] The present invention also provides a system for implementing the above service capacity evaluation method, such as Figure 2 As shown, it includes a detection module 1, a read-write overhead calculation module 2 and an evaluation module 3.

[0070] The detection module 1 obtains the information of the Tomcat container executing the URL based on the eBPF probe, and the information includes the execution start time and end time; the read-write overhead calculation module 2 is used to obtain the read-write overhead of executing the URL; the evaluation module 3 is used to evaluate the business capacity of the system resources based on the read-write overhead and execution time.

[0071] The detection module 1 is also used to obtain the execution time of the website according to the context switching time; and calculate the average execution time of the website according to the execution time of the website.

[0072] The read / write overhead calculation module 2 is used to simulate sending the first data to obtain the read / write overhead of the first data; calculate the unit read / write overhead according to the size of the first data; and calculate the read / write overhead of the URL according to the read / write data volume of the URL.

[0073] The evaluation module 3 is also used to obtain the execution overhead of multiple websites, which includes read and write overhead and average execution time; based on the read and write overhead and average execution time of each website, the service capacity of the system resources is evaluated.

[0074] The system of the present invention may further include an elastic scaling module 4 or an alarm module 5, and the evaluation module 3 is further used to calculate the system resource occupancy ratio;

[0075] Determining whether the system resource occupancy ratio is greater than a first threshold value;

[0076] If so, the system resources are adjusted through the elastic scaling module 4, or the alarm module 5 is used to send an alarm message to the management personnel.

[0077] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for evaluating the service capacity of a Tomcat container, characterized in that: The method comprises: Based on the eBPF probe, obtain the information of the Tomcat container execution URL, which includes the execution start time and end time; Obtaining the execution time of the URL according to the execution start time and end time; Get the read and write cost of executing the URL; evaluating the service capacity of system resources based on the read and write overhead and execution time; Among them, there are multiple URLs. Obtaining the execution cost of each URL respectively, wherein the execution cost includes read and write cost and execution time; Evaluate the business capacity of system resources based on the read and write overhead and execution time of each URL; The service capacity is evaluated according to the following formula: Where C represents the execution cost, T i It is represented as the execution time of URL i, IOT i Expressed as the read and write overhead of URL i, K i It is represented by the execution volume of URL i, and n is represented by the total number of URLs; Among them, the method for calculating the URL execution time is: Step 301: Preset a plurality of time buckets according to the response time of the website; Step 302: Allocate the execution time of the URL to the corresponding time buckets in sequence; Step 303: Determine whether the sum of the allocation ratios of the first, second, and third time buckets is greater than a second threshold, where is a positive integer; If yes, execute step 304: take the average value of the data in the j-th time bucket as the execution time; C≤ω1×S ω1 represents the system resource occupancy ratio, and S represents the system resources.

2. The service capacity evaluation method according to claim 1, characterized in that: The information also includes context switch time, According to the execution start time, end time and context switch time, the execution time of the URL is obtained: T i =cpu_end_timestamp-cpu_start_timestamp-switch_time Among them, T i It represents the execution time of URL i, cpu_end_timestamp represents the end time of execution, cpu_start_timestamp represents the start time of execution, and switch_time represents the switching time.

3. The service capacity evaluation method according to claim 2, characterized in that: The eBPF probe intercepts the read function to obtain the execution start time; intercepts the write function to obtain the execution end time; intercepts the sched_switch function to obtain the context switching time.

4. The service capacity evaluation method according to claim 1, characterized in that: The method for obtaining the read and write overhead of executing the URL includes: Simulate sending of first data to obtain read and write overhead of the first data; Calculate the unit read and write overhead according to the size of the first data; The read and write overhead of the URL is calculated according to the read and write data volume of the URL.

5. A system for implementing the service capacity evaluation method according to any one of claims 1 to 4, characterized in that: The system comprises: Detection module, read / write cost calculation module and evaluation module, The detection module obtains information about the execution URL of the Tomcat container based on the eBPF probe, wherein the information includes the execution start time and the end time; The read-write cost calculation module is used to obtain the read-write cost of executing the website; The evaluation module is used to evaluate the service capacity of system resources according to the read and write overhead and the execution time.

6. The system according to claim 5, characterized in that The detection module is also used to obtain the execution time of the website according to the context switching time; and calculate the execution time of the website according to the execution time of the website; The read / write overhead calculation module is used to simulate sending the first data to obtain the read / write overhead of the first data; calculate the unit read / write overhead according to the size of the first data; calculate the read / write overhead of the website according to the read / write data volume of the website; The evaluation module is also used to obtain the execution overhead of multiple websites, the execution overhead includes read and write overhead and execution time; based on the read and write overhead and execution time of each website, the business capacity of the system resources is evaluated.

7. The system according to claim 6, characterized in that It also includes elastic expansion module or alarm module. The evaluation module is also used to calculate the system resource occupancy ratio; Determining whether the system resource occupancy ratio is greater than a first threshold; If so, the system resources are adjusted through the elastic scaling module, or the alarm module is used to send an alarm message to the management personnel.

Citation Information

Patent Citations

  • Server performance index evaluation method for container bearing service application

    CN106557353A

  • Business capacity management method and device

    CN108268363A