High-load micro-service starting method and system, electronic equipment and storage medium

By optimizing microservice startup through hierarchical preloading, hash indexing, request verification, and probe-based dynamic adjustment, the resource contention and stability issues in high-load microservice scenarios are resolved, achieving efficient and stable system startup and response.

CN121387388APending Publication Date: 2026-01-23TONGFANG KNOWLEDGE DIGITAL PUBLISHING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511493198.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

In existing technologies, microservices face problems such as resource contention, response latency, service instability, high CPU utilization, high performance overhead, and frequent misjudgments when starting up under high load scenarios. They also lack a systematic coordination mechanism, resulting in high system complexity and poor stability.

Method used

The system employs a hierarchical preloading mechanism, optimized verification algorithm, request verification mechanism, and dynamic adjustment of probe parameters. This includes pre-compiling templates, establishing hash indexes, verifying request parameters, dynamically adjusting probe detection intervals, and stress testing verification, thereby optimizing resource allocation and parameter configuration.

Benefits of technology

It effectively reduces cold start resource contention, improves system startup efficiency and response speed, enhances verification processing efficiency and service accuracy, and ensures system stability and low resource consumption in high-concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121387388A_ABST
    Figure CN121387388A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a high-load micro-service starting method and system, electronic equipment and a storage medium, and the method comprises the steps: executing a hierarchical preloading mechanism, initializing a connection pool, and building a preset minimum idle connection number; checking algorithm optimization is executed, a client feature Trie tree is constructed, root nodes are initialized, child nodes are inserted in sequence according to character string characters, new nodes are created when the child nodes are missing, and the nodes are marked as word ending when character strings are ended; executing request verification mechanism optimization, and returning an error response or an unauthorized response when verification fails; probe parameter dynamic adjustment is executed, and the survival probe detection interval is dynamically adjusted according to the operation indexes; according to the method and the device, the problems of resource waste, low processing efficiency and insufficient stability in a traditional scheme are solved, and reliable technical guarantee is provided for a high-load micro-service scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computers, and in particular to a high-load micro-service starting method, system, electronic device and storage medium. BACKGROUND

[0002] At present, micro-service architecture is widely used in cloud-native environment, especially in high-concurrency business scenarios, the system needs to frequently update the version and restart the node. In the prior art, the micro-service faces many technical challenges in the starting stage:

[0003] In the cold start process, the new node needs to synchronously perform initialization operations such as probe detection, template compilation, database connection establishment, and forms resource competition with real-time business requests, resulting in response delay and unstable service.

[0004] The data verification link usually uses traversal comparison, when the verification data scale reaches 100,000 levels, the time complexity is O(n), causing CPU usage rate peak, affecting system throughput.

[0005] In the request verification mechanism, the request path information is frequently obtained by using reflection call, which produces significant performance overhead and reduces system processing efficiency. In addition, the default detection parameters of the readiness probe and the live probe cannot match the actual initialization time of the micro-service, which often causes the service to be misjudged as unavailable, causing unnecessary node restart or traffic scheduling error.

[0006] The existing solutions in the prior art mostly take local optimization measures for a single problem. For example, resource over-provisioning is used to alleviate the resource competition in cold start, but it significantly increases hardware cost; batch verification strategy is used to reduce CPU peak, but it prolongs the overall verification time; cache reflection results are used to reduce performance loss, but it still cannot fundamentally eliminate the reflection call overhead; or manually adjust the probe parameters to avoid misjudgment, which lacks precision and adaptive ability. These solutions are independent of each other and do not form a systematic and collaborative mechanism, and when solving a specific problem, they often introduce new resource waste, system complexity improvement or stability risk.

[0007] Therefore, the present application provides a high-load micro-service starting method to solve the above technical problems. SUMMARY

[0008] The purpose of the present application is to provide a high-load micro-service starting method, system, electronic device and storage medium, which can solve the technical problems of the prior art that cannot systemically coordinate resource allocation, lack precision and adaptive ability, have poor stability and high system complexity.

[0009] In order to solve the above technical problems, the present application provides a high-load micro-service starting method, comprising:

[0010] A hierarchical preloading mechanism is executed, including reading a configuration file to obtain static page path information, precompiling corresponding templates, and initializing a connection pool to establish a preset minimum number of idle connections;

[0011] A verification algorithm optimization is executed, including converting a verification data set into a hash mapping structure to establish a double-layer hash index, and constructing a client feature Trie tree by initializing a root node, inserting child nodes in order according to string characters and creating new nodes when missing, and marking a node as a word end when a string ends;

[0012] A request verification mechanism optimization is executed, implementing request parameter verification and request header source verification, and returning an error response or an unauthorized response when verification fails;

[0013] A probe parameter dynamic adjustment is executed, including setting an initial delay and a failure threshold for a startup phase probe, calling a service warm-up interface in a readiness check probe, and dynamically adjusting a live probe detection interval according to running indicators;

[0014] A stress test verification is executed, including configuring container resource parameters and adjusting thread pool size and connection number, simulating a high concurrency scenario to execute input / output intensive and computation intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results.

[0015] In some embodiments, a hierarchical preloading mechanism is executed, including reading a configuration file to obtain static page path information, precompiling corresponding templates, and initializing a connection pool to establish a preset minimum number of idle connections, further including:

[0016] Reading a configuration file, obtaining static page path information from a preset path, and splitting the content into multiple independent path items according to a delimiter;

[0017] Iterating through each path item, checking the path for non-empty, precompiling the corresponding template using a template engine to generate the final content, and recording preloading logs;

[0018] Initializing link fields, link data, table data, and grouping data, simulating actual request data structures and executing key logic to complete class loading and cache warm-up;

[0019] Sending an asynchronous HTTP request to a specified URL, simulating user behavior to trigger network communication and resource initialization, so that the template engine and related resources complete initialization at startup.

[0020] In some embodiments, a verification algorithm optimization is performed, including converting the verification dataset into a hash map structure to establish a double-layer hash index, and constructing a client feature Trie tree by initializing a root node, inserting child nodes in sequence according to string characters and creating new nodes when missing, marking the node as a word end at the end of the string, further including:

[0021] Converting the verification dataset into a hash map structure to realize a constant-time complexity comparison operation;

[0022] Initializing the Trie tree root node, which does not contain any characters, as the starting point of prefix matching;

[0023] Selecting corresponding child nodes in sequence according to string characters, creating new nodes when child nodes are missing, until the end of string processing;

[0024] Marking the node as a word end after complete word insertion.

[0025] In some embodiments, a request verification mechanism optimization is performed, realizing request parameter verification and request header source verification, and returning an error response or an unauthorized response when verification fails, further including:

[0026] Verifying the legality of the request parameter mapping to ensure that the parameters meet the preset specifications;

[0027] Verifying the request header source information to check whether the source contains a trusted domain name to confirm the request credibility;

[0028] Returning a specific error code and message when parameter verification fails to terminate the current request processing flow;

[0029] Returning an unauthorized response code and message when source verification fails to prevent illegal access and maintain system security.

[0030] In some embodiments, a probe parameter dynamic adjustment is performed, including setting the initial delay and failure threshold of the startup phase probe, calling the service warm-up interface in the readiness check probe, and dynamically adjusting the survival probe detection interval according to the running indicators, further including:

[0031] Setting the initial delay and failure threshold of the startup phase probe;

[0032] Calling the service warm-up interface in the readiness check probe to send a request through a command line tool to complete resource initialization;

[0033] Dynamically adjusting the survival probe detection interval according to the running phase monitoring indicators to adapt to system load changes;

[0034] Optimizing the probe parameters through real-time data.

[0035] In some embodiments, the stress test verification is performed, including configuring container resource parameters and adjusting thread pool size and connection number, simulating high concurrency scenarios to perform input and output intensive and computationally intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results, further including:

[0036] Configuring container resource parameters, adjusting the minimum idle thread number and the maximum thread number of the thread pool and the connection queue length;

[0037] Simulate high concurrency scenarios, respectively perform input and output intensive tasks and computationally intensive tasks to cover typical loads;

[0038] Measure system response time, error rate and resource usage, including CPU and memory data;

[0039] Optimize system parameters according to test results.

[0040] In some embodiments, the method further includes:

[0041] Coordinate resource initialization through a hierarchical preloading mechanism, including:

[0042] Complete template compilation and connection pool warm-up before service startup, establish a preset minimum idle connection number;

[0043] Preload all static pages and key data structures through a warm-up interface, complete class loading and cache initialization;

[0044] Perform initialization of link fields, link data, table data and grouping data, simulate actual request logic;

[0045] Optimize with a verification algorithm and dynamically adjust probe parameters to achieve resource coordination and system optimization.

[0046] Based on the same concept, the present application also provides a high-load microservice startup system, including:

[0047] A hierarchical preloading mechanism execution module configured to execute a hierarchical preloading mechanism, including reading a configuration file to obtain static page path information, precompiling corresponding templates, and initializing a connection pool to establish a preset minimum idle connection number;

[0048] A verification algorithm optimization module configured to perform verification algorithm optimization, including converting a verification data set into a hash map structure to establish a double-layer hash index, and constructing a client feature Trie tree by initializing a root node, inserting child nodes in order according to string characters and creating new nodes when missing, and marking nodes as word endings when the string ends;

[0049] The request verification mechanism optimization module is configured to perform request verification mechanism optimization, realize request parameter checking and request header source verification, and return an error response or an unauthorized response when verification fails.

[0050] The probe parameter dynamic adjustment module is configured to perform probe parameter dynamic adjustment, including setting the initial delay and failure threshold of the start-up phase probe, calling the service warm-up interface in the readiness check probe, and dynamically adjusting the survival probe detection interval according to the running index.

[0051] The stress test verification module is configured to perform stress test verification, including configuring container resource parameters and adjusting the thread pool size and the number of connections, simulating a high-concurrency scenario to perform input-output-intensive and computation-intensive tasks, measuring the system response time and error rate, and optimizing system parameters according to the test results.

[0052] Based on the same concept, the present application also provides an electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the high-load micro-service starting method.

[0053] Based on the same concept, the present application also provides a computer-readable storage medium storing a computer program executable by an electronic device, and when the computer program runs on the electronic device, the electronic device executes the steps of the high-load micro-service starting method.

[0054] Compared with the prior art, the present application has the following beneficial effects:

[0055] The present application discloses a high-load micro-service starting method, system, electronic device and storage medium, which completes template compilation, connection pool warm-up and key data structure initialization before service starting through a hierarchical preloading mechanism, effectively reduces resource competition during cold starting, and improves system starting efficiency and subsequent request response speed.

[0056] The verification algorithm optimization reduces the data comparison time complexity to a constant level by establishing a double-layer hash index, and realizes fast matching of large-scale client features in combination with a Trie tree structure, thereby improving the processing efficiency of the verification link and reducing CPU resource consumption.

[0057] Through request verification mechanism optimization, the interceptor is used to replace the reflection call, so that the performance overhead caused by frequent reflection operations is avoided, and the safety and processing efficiency of the system are improved through unified parameter checking and source verification mechanism.

[0058] Through the probe parameter dynamic adjustment mechanism, the detection parameters are adaptively set according to the actual situation in the system starting and running stage, the service state misjudgment is effectively avoided, and the accuracy of service discovery and system reliability are improved.

[0059] Through systematic pressure test verification and parameter optimization, the effectiveness of various improvement measures in the actual high concurrency scene is ensured, so that the system has excellent response performance and stability while maintaining low resource consumption. BRIEF DESCRIPTION OF DRAWINGS

[0060] Other features, objects, and advantages of the application will become more apparent with reference to the following detailed description of non-limiting embodiments when taken in conjunction with the accompanying drawings:

[0061] Figure 1 is a flowchart of a high-load microservice starting method in some embodiments of the application;

[0062] Figure 2 is a flowchart of a high-load microservice starting method in another embodiment of the application;

[0063] Figure 3 is a flowchart of a high-load microservice starting method in another embodiment of the application;

[0064] Figure 4 is a structural schematic diagram of a high-load microservice starting system in some embodiments of the application;

[0065] Figure 5 is a structural schematic diagram of an electronic device in some embodiments of the application;

[0066] In the figure, 710 is a processor; 720 is a memory; 730 is an input device; and 740 is an output device. DETAILED DESCRIPTION

[0067] In order to make the purposes, technical solutions and advantages of the application clearer, the application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only some of the embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the application.

[0068] The terms used in the embodiments of the application are only for the purpose of describing the specific embodiments, and are not intended to limit the application. The singular forms "a", "an" and "the" used in the embodiments of the application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. "Multiple" generally includes at least two.

[0069] It should be understood that the term "and / or" used herein is merely used to describe an associated relationship, that is, there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.

[0070] It should be understood that although the terms first, second, third, etc. can be used in embodiments of the present application to describe, these descriptions should not be limited to these terms. These terms are only used to distinguish the description. For example, without departing from the scope of the embodiments of the present application, the first can also be called the second, and similarly, the second can also be called the first.

[0071] Depending on the context, the word "if" as used herein can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if it is determined" or "if (a stated condition or event) is detected" can be interpreted as "when it is determined" or "in response to determining" or "when (a stated condition or event) is detected" or "in response to detecting (a stated condition or event)".

[0072] It should also be noted that the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusion, so that a product or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such product or device. Without more limitations, the element defined by the sentence "including a" does not exclude the presence of additional identical elements in the product or device including the element.

[0073] In particular, it should be noted that the symbols and / or numbers present in the description, if not marked in the description of the drawings, are not drawing reference numbers.

[0074] Reference Figure 1 A high-load microservice startup method, comprising:

[0075] S101, performing a hierarchical preloading mechanism, including reading a configuration file to obtain static page path information, precompiling a corresponding template, and initializing a connection pool to establish a preset minimum number of idle connections;

[0076] S102, performing a verification algorithm optimization, including converting a verification data set into a hash map structure to establish a double-layer hash index, and constructing a client feature Trie tree by initializing a root node, inserting a child node according to string characters and creating a new node when missing, and marking a node as a word end when a string ends;

[0077] S103, a request verification mechanism optimization is performed to realize request parameter checking and request header source verification, and an error response or an unauthorized response is returned when verification fails;

[0078] S104, a probe parameter dynamic adjustment is performed, including setting an initial delay and a failure threshold of a start-up stage probe, calling a service preheating interface in a readiness check probe, and dynamically adjusting a survival probe detection interval according to running indexes;

[0079] S105, a stress test verification is performed, including configuring container resource parameters and adjusting thread pool size and connection number, simulating a high concurrency scenario to perform input / output intensive and computation intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results.

[0080] Specifically, in the embodiment of the application, a hierarchical preloading mechanism is executed, including reading static page path information from a configuration file, precompiling a template file identified by using a template engine, initializing a connection pool and establishing a preset number of minimum idle connections; a verification algorithm optimization is executed to convert an original verification data set into a hash mapping structure to construct a double-layer hash index, and a client feature Trie tree is constructed by initializing a root node containing no characters, sequentially selecting or creating corresponding child nodes according to character order of a string to be inserted, and marking a corresponding node as a word end position when string processing is completed; a request verification mechanism optimization is executed to realize request interceptor to complete legality checking of request parameters and verification of source information in a request header, and an error response or an unauthorized response is returned when any verification step fails; a probe parameter dynamic adjustment is executed to set an initial delay time and a failure retry threshold of a start-up stage probe, integrate a service preheating interface calling function in a readiness check probe, and dynamically adjust a survival probe detection time interval according to performance indexes collected during system running; a stress test verification is executed to configure container running resource parameters, adjust thread pool size and connection number configuration, simulate a high concurrency scenario to respectively perform input / output intensive tasks and computation intensive tasks, measure system response time and error rate indexes, and iteratively optimize system parameters according to test results.

[0081] For example, the hierarchical preloading mechanism reads the static page path from the htmlPath.ini configuration file located in the config directory, which contains three HTML file paths separated by |||. The template engine precompiles the identified about.html, contact.html, and index.html templates, and the connection pool initialization establishes five minimum idle connections. The verification algorithm optimization converts the verification dataset containing 100,000 records into a hash map structure, where the key is the search term and the value is a Boolean identifier. When building the client feature Trie tree, the root node is initialized, followed by the insertion of the strings "app" and "api". When inserting "app", the a, p, p nodes are created in sequence and the last p node is marked as the end of the word. When inserting "api", the existing a node is shared, and then the p and i nodes are created and the i node is marked as the end of the word. The request verification mechanism checks whether the uniplatform parameter contained in the request parameter is within the allowed value range ["web", "mobile"], and verifies whether the Referer header contains the trusted domain name "cnki.net". If the parameter verification fails, a 400 error code is returned, and if the source verification fails, a 401 error code is returned. The probe parameter dynamic adjustment sets the initial delay of the start phase probe to 60s and the failure threshold to 10 times. The ready probe calls the http: / / localhost:8080 / kns8s / brief / grid / start warm-up interface, and the survival probe adjusts the detection interval from 10s to 15s based on the CPU usage rate. The pressure test configures the container with a 6-core CPU and 6GB of memory, sets the minimum idle thread number of the thread pool to 6, the maximum thread number to 12, and the maximum connection number to 10000. When simulating 1000 concurrent users executing file processing tasks, the system response time decreases from 5.3s to 820ms, the error rate decreases from 18.7% to 0.2%, and the CPU usage rate peak decreases from 100% to 28%.

[0082] In some applications, the hierarchical preloading mechanism is executed, including reading the configuration file to obtain static page path information, precompiling the corresponding templates, and initializing the connection pool to establish a preset minimum idle connection number, including reading the configuration file, obtaining static page path information from a preset path, and dividing the content into multiple independent path items according to the separator; each path item is processed by traversing, checking the path for non-empty, precompiling the corresponding template using the template engine to generate the final content, and recording the preloading log; initializing the link field, link data, table data, and grouping data, simulating the actual request data structure and executing the key logic to complete class loading and cache warm-up; sending an asynchronous HTTP request to a specified URL to simulate user behavior to trigger network communication and resource initialization, so that the template engine and related resources are initialized at startup.

[0083] It can be understood that the static page path information is read from the configuration file of the preset path, the file content is segmented according to the specified delimiter to obtain a plurality of independent path items, each path item is processed in turn, and after confirming that the path is not empty, the corresponding template is precompiled by using a template engine to generate final content, and corresponding preload log information is recorded in the process. The link field, link data, table data and grouping data are initialized in turn, the class loading and cache warming operation are completed by simulating the data structure of the actual request and executing the key processing logic; an asynchronous HTTP request is sent to the specified URL, the network communication and resource initialization process are triggered by simulating the real user behavior, so that the template engine and its related resources complete the whole initialization work in the system startup stage.

[0084] For example, the hierarchical preload mechanism reads static page path information from the htmlPath.ini configuration file under the config directory, which contains 5 independent path items separated by "|||"; each path item is processed in turn, and the non-empty " / templates / home.html" path is precompiled by using the Thymeleaf template engine to generate the final HTML content and record the log information of "preload home.html page"; the initLinkField(), initLink(), initGridData() and initGroup() methods are executed in turn to initialize the link field, literature link data, search table data and grouping data, respectively, simulate the data structure of the actual request and execute the key processing logic; finally, an asynchronous POST request is sent to http: / / localhost:8080 / api / preload to simulate user access behavior, trigger network communication and ensure that the Thymeleaf template engine and related resources complete initialization at startup, and the connection pool establishes 5 minimum idle connections to meet subsequent service requests.

[0085] In some applications, a verification algorithm optimization is performed, including converting a verification data set into a hash map structure to establish a double-layer hash index, and constructing a client feature Trie tree by initializing a root node, inserting child nodes in turn according to string characters and creating new nodes when missing, and marking the node as a word end when the string ends, including converting a verification data set into a hash map structure to realize a constant time complexity comparison operation; initializing a Trie tree root node, which does not contain any characters as a starting point for prefix matching; selecting corresponding child nodes in turn according to string characters, creating new nodes when child nodes are missing, until the string processing is completed; marking the node as a word end after the complete word insertion is completed.

[0086] It can be understood that the original check data set is converted into a hash mapping structure to establish a double-layer hash index, realizing a data comparison operation with constant time complexity; a client feature Trie tree is constructed, and a root node containing no characters is initialized as the starting point of prefix matching; the corresponding child node is selected in turn according to the character order of the to-be-processed string, a new node is created and the corresponding link relationship is established when the target child node is missing, and the character processing process of the entire string is completed; after the complete word insertion operation is completed, the corresponding end node is marked as the end position of the word, and a complete prefix tree matching structure is formed.

[0087] For example, the check algorithm optimization converts an original data set containing 100,000 search terms into a double-layer hash mapping structure, the first layer hash key is the search term type, the second layer hash key is the specific search term, and the value is a Boolean type legality identifier; when constructing the client feature Trie tree, a root node containing no characters is initialized, then the strings "app" and "apple" are inserted in turn, when "app" is inserted, three child nodes a, p, and p are created in turn from the root node, and the isWord is marked as true at the third p node; when "apple" is inserted, the existing a-p-p path is shared, two new child nodes l and e are created, the isWord is marked as true at the e node, and a Trie tree structure containing 6 nodes is formed, supporting efficient prefix matching of client features with a character depth of 5.

[0088] In some applications, the request verification mechanism optimization is performed to realize request parameter checking and request header source verification, and an error response or an unauthorized response is returned when the verification fails, including checking the legality of the request parameter mapping to ensure that the parameters meet the preset specifications; verifying the source information of the request header to check whether the source contains a trusted domain name to confirm the request credibility; returning a specific error code and message when the parameter checking fails to terminate the current request processing process; returning an unauthorized response code and message when the source verification fails to prevent illegal access and maintain system security.

[0089] It can be understood that the legality of the received request parameter mapping is checked to ensure that all parameter values meet the preset specification requirements; the source information in the request header is verified to check whether the source address contains a trusted domain name to confirm the request credibility; a specific error code and a corresponding prompt message are returned when the parameter checking fails, and the current request processing process is immediately terminated; an unauthorized response code and a security prompt message are returned when the source verification fails, effectively preventing illegal access to maintain system security.

[0090] For example, the request verification mechanism checks whether the uniplatform parameter in the request parameter mapping is within the preset value range ["web", "mobile", "desktop"], and simultaneously verifies whether the language parameter is any value in ["zh", "en", "ja"]; in the source verification stage, it checks whether the Referer header contains the trusted domain name "cnki.net"; when the uniplatform parameter value is detected as "unknown", a 400 status code and a "parameter illegal" message are returned; when the Referer header is "http: / / unknown.com", a 401 status code and an "unauthorized access" message are returned, effectively preventing illegal requests and maintaining system security.

[0091] In some applications, probe parameter dynamic adjustment is performed, including setting the initial delay and failure threshold of the startup phase probe, calling the service warm-up interface in the readiness check probe, and dynamically adjusting the detection interval of the live probe according to the running index, including setting the initial delay and failure threshold of the startup phase probe; the service warm-up interface is called in the readiness check probe, and a request is sent through a command line tool to complete resource initialization; the detection interval of the live probe is dynamically adjusted according to the running phase monitoring index to adapt to system load changes; the probe parameters are optimized through real-time data.

[0092] It can be understood that the initial delay time and failure retry threshold of the startup phase probe are set to match the service initialization period; the calling function of the service warm-up interface is integrated in the readiness check probe, a specific format HTTP request is sent through a command line tool to complete the initialization operation of the key resource; the detection time interval of the live probe is dynamically adjusted according to the system monitoring index collected in the running phase, so that it can adapt to system load changes; based on the real-time collected performance data, the probe parameter configuration is continuously optimized to ensure the accuracy and timeliness of service state detection.

[0093] For example, the probe parameter dynamic adjustment sets the initial delay of the readiness probe to 60s and the failure threshold to 10 times; in the readiness check probe, the service warm-up interface is called by executing the command line instruction / bin / sh -c 'curl -X GET http: / / localhost:8080 / kns8s / brief / grid / start -H "Content-Type: application / x-www-form-urlencoded" -H "Referer: http: / / nxgp.dev.cnki.net"'; when the monitoring system detects that the CPU usage rate continuously exceeds 70%, the detection interval of the alive probe is dynamically adjusted from 10s to 15s; according to the performance data of P99 response time collected by Prometheus, which is reduced from 5.3s to 820ms, the initial delay of the readiness probe is optimized from 60s to 45s, forming a continuous parameter tuning mechanism.

[0094] In some applications, stress test verification is performed, including configuring container resource parameters and adjusting thread pool size and connection number, simulating high concurrency scenarios to perform input / output intensive and computation intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results, including configuring container resource parameters, adjusting thread pool minimum idle thread number and maximum thread number, and connection queue length; simulate high concurrency scenarios, respectively perform input / output intensive tasks and computation intensive tasks to cover typical loads; measure system response time, error rate and resource usage, including CPU and memory data; optimize system parameters according to test results.

[0095] It can be understood that the resource parameters required for the container to run are configured, the minimum idle thread number and maximum thread number of the thread pool are adjusted, and the length limit of the connection queue is optimized; simulate high concurrency access scenarios, respectively perform input / output operation intensive tasks and computation processing intensive tasks to cover various typical load situations that the system may face; continuously measure system response time, request error rate and resource usage, including central processing unit and memory usage data, during the test process; according to the test results, analyze the system performance bottleneck, and make targeted optimization and adjustment to various system parameters.

[0096] For example, the pressure test configures the container resource as 6-core CPU and 6GB memory, sets the minimum idle thread number of the thread pool as 6, the maximum thread number as 12, and the connection queue length as 900; simulates 1000 concurrent users to execute the input / output intensive task of file upload and download, and simultaneously simulates 200 concurrent users to execute the computation-intensive task of data encryption operation; the test result shows that the P99 response time of the system is optimized from 5.3s to 820ms, the error rate is reduced from 18.7% to 0.2%, the CPU usage peak is reduced from 100% to 28%, and the memory usage is stabilized at 4.2GB; according to the test data, the maximum thread number of the thread pool is adjusted from 12 to 18, and the connection queue length is adjusted from 900 to 1200, thereby realizing the continuous optimization of the system parameters.

[0097] In some applications, the method further comprises coordinating resource initialization through a hierarchical preloading mechanism, including completing template compilation and connection pool preheating before service startup, establishing a preset minimum idle connection number; preloading all static pages and key data structures through a preheating interface, completing class loading and cache initialization; performing initialization of link fields, link data, table data and grouping data, simulating actual request logic; combining verification algorithm optimization and probe parameter dynamic adjustment to realize resource coordination and system optimization.

[0098] It can be understood that the compilation processing of all business templates and the preheating operation of the connection pool are completed before service startup, a minimum idle connection number meeting preset requirements is established; all static page contents and key data structures are preloaded through a special preheating interface, to ensure that the necessary class loading process and cache initialization work are completed; link field initialization, link data initialization, table data initialization and grouping data initialization are sequentially performed, the correctness of the data structure is verified by simulating the processing logic of actual business requests; the verification algorithm is optimized and improved, and the probe parameter dynamic adjustment mechanism is combined, to realize effective coordination of system internal resources and systematic optimization of overall performance.

[0099] For example, the hierarchical preloading mechanism completes Thymeleaf template compilation before K8S Readiness probe triggering, and the connection pool preheating establishes 5 minimum idle connections; 12 static HTML pages and 3 types of key data structures are preloaded through the call of the / kns8s / brief / grid / start preheating interface, and the loading and cache initialization of 28 core classes are completed; the data processing logic of the actual search request is simulated by sequentially executing the initLinkField() method to initialize the link field, the initLink() method to initialize the literature link data, the initGridData() method to initialize the search table data, and the initGroup() method to initialize the grouping data; in combination with the double-layer hash check algorithm and dynamic probe parameter adjustment, the initial delay of the readiness probe is set to 60s, and the failure threshold is set to 10 times, so that the resource coordination optimization is realized, and the P99 response time of the system is reduced from 5.3s to 820ms.

[0100] The following describes another embodiment of the high-load microservice starting method of the application in combination with Figure 2 and Figure 3

[0101] As shown in Figure 2 and Figure 3 , the flow of this embodiment is as follows:

[0102] The hierarchical preloading mechanism is as follows:

[0103] The template precompilation implementation manner is as follows: the Thymeleaf template compilation is completed before K8S Readiness probe triggering, and the preheating interface is used to preload all static HTML pages, so as to improve the response speed and user experience of the system. The following is a process description:

[0104] ​The system reads the configuration file, specifically the `htmlPath.ini` file, to retrieve HTML file path information. It then splits the file content into multiple independent HTML path entries using the delimiter `|||`. Each HTML file path is processed, and for each path entry, it checks if the path is empty; if so, it skips it. The Thymeleaf template engine is used to process the corresponding HTML template, generating the final HTML content. A log is recorded, displaying the currently preloaded HTML page. Link fields are initialized by calling the `initLinkgetField()` method to preheat link-related field data, ensuring necessary class loading and cache initialization are completed at system startup. Link data is initialized by calling the `initLink()` method to preheat literature link-related data, simulating the data structure of an actual request and executing critical logic. Table data is initialized by calling the `initGridData()` method to preheat the retrieval table data, ensuring the retrieval interface and data adapter classes are initialized at startup. An HTTP POST request is sent by calling the `initHttpPost()` method to send an asynchronous POST request to the specified URL, simulating user behavior and triggering network communication in advance. Initialize group data by calling the `initGroup()` method to warm up the group data and ensure that the group controller class is initialized at startup. Initialize the Thymeleaf template by calling the `initThymealeaf()` method to load and render the Thymeleaf template, ensuring that the template engine and related resources are initialized at startup.

[0105] By using an initialization method, the system preloads commonly used HTML pages, link fields, search data, grouping information, etc., when the application starts, thereby improving the response speed of subsequent requests and overall performance. This process not only optimizes the loading time of front-end pages but also reduces the runtime dynamic generation overhead, making it suitable for performance optimization needs in high-concurrency scenarios.

[0106] Connection pool warm-up: FeignClient establishes a preset minimum number of idle connections.

[0107] Spring

[0108] Cloud

[0109] openfeign: client: config: default: connectTimeout: 5000 # Connection timeout; readTimeout: 10000 # Time from sending a message to receiving a response;

[0110] Verification algorithm optimization:

[0111] Build double-layer hash index: Convert the search term validity check dataset into HashMap structure, and the comparison time complexity is reduced to O(1). Build client feature Trie tree: Through the prefix tree structure to realize the fast matching of 100,000 level clients, the Trie tree construction algorithm is:

[0112] Initialize root node: Create a root node that does not contain any characters; Insert operation: Start from the root node, select the corresponding child node according to the first character of the string. If the child node does not exist, create a new node. Then continue to process the next character until the end of the string. Mark the end: When a complete word is inserted, mark the isword of the node as true, indicating that this is the end of a word.

[0113] Request verification mechanism optimization:

[0114] Replace filter with interceptor: Implement Refer verification through HandlerInterceptor to avoid reflection call interceptor implementation Code example as follows:

[0115] Request header plug default parameter value

[0116] uniplatform platform

[0117] language internationalization language

[0118] version version

[0119] public class RequestParamInterceptor implements HandlerInterceptor {

[0120] @Override

[0121] public boolean preHandle(HttpServletRequest request,HttpServletResponse response, Object handler) throws Exception {

[0122] / / Parameter verification

[0123] if (verifyParamAnnotation(handler)) {

[0124] Map<String, String[]> parameterMap = request.getParameterMap();

[0125] boolean b = checkParam(parameterMap);

[0126] if (b) {

[0127] response.sendError(ErrorPageEnum.Error400.getCode(),ErrorPageEnum.Error400.getMsg());

[0128] return false;

[0129] }

[0130] }

[0131] / / refer verification

[0132] if(verifyReferAnnotation(handler)){

[0133] String refer = request.getHeader("Referer");

[0134] / / If refer is empty, the request returns a 401 error.

[0135] if (StringUtils.isEmpty(refer)||!refer.contains("cnki")) {

[0136] response.sendError(ErrorPageEnum.Error401.getCode(),ErrorPageEnum.Error401.getMsg());

[0137] return false;

[0138] }

[0139] }

[0140] return true;

[0141] }

[0142] }

[0143] Dynamic adjustment of probe parameters:

[0144] Startup phase: Set initialDelaySeconds=60, failureThreshold=10

[0145] Readiness probe: increase automatic invocation of service warm-up interface, / bin / sh -c 'curl -X GET http: / / localhost:8080 / kns8s / brief / grid / start -H "Content-Type: application / x-www-form-urlencoded" -H "Referer: http: / / nxgp.dev.cnki.net" '

[0146] Running phase: dynamically adjust the interval of the liveness probe through Prometheus metrics, initial delay 60s, and execution probe frequency 10s.

[0147] For the method steps disclosed in the above embodiments, the method steps are described as a series of action combinations for the purpose of simple description, but those skilled in the art should know that the embodiments of the present application are not limited by the order of the described actions, because according to the embodiments of the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily necessary for the embodiments of the present application.

[0148] As shown in Figure 4 The present application also provides a high-load micro-service starting system, comprising:

[0149] The hierarchical preloading mechanism execution module 201 is configured to execute the hierarchical preloading mechanism, including reading a configuration file to obtain static page path information, precompiling a corresponding template, and initializing a connection pool to establish a preset minimum number of idle connections;

[0150] The verification algorithm optimization module 202 is configured to execute the verification algorithm optimization, including converting a verification data set into a hash mapping structure to establish a double-layer hash index, and constructing a client feature Trie tree by initializing a root node, inserting a child node according to string characters in turn and creating a new node when missing, and marking a node as a word end when a string ends;

[0151] The request verification mechanism optimization module 203 is configured to execute the request verification mechanism optimization, realizing request parameter verification and request header source verification, and returning an error response or an unauthorized response when verification fails;

[0152] The probe parameter dynamic adjustment module 204 is configured to execute the probe parameter dynamic adjustment, including setting a starting phase probe initial delay and a failure threshold, calling a service warm-up interface in a readiness probe, and dynamically adjusting a liveness probe detection interval according to a running index;

[0153] The pressure test verification module 205 is configured to perform pressure test verification, including configuring container resource parameters and adjusting thread pool size and connection number, simulating high concurrency scenarios to perform input / output intensive and computation intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results.

[0154] It is worth noting that, although only some basic function modules are disclosed in the embodiments of the present application, it does not mean that the composition of the system is limited to the above basic function modules. On the contrary, the meaning expressed by the embodiments is that on the basis of the above basic function modules, those skilled in the art can add one or more function modules to form infinite embodiments or technical solutions in combination with existing technologies. That is, the system is open rather than closed, and the protection scope of the claims of the present application cannot be limited to the disclosed basic function modules. At the same time, for the convenience of description, the above device is described as various units and modules. Of course, when implementing the present application, the functions of the units and modules can be implemented in the same software and / or hardware.

[0155] As shown in Figure 5 The present application also provides an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the high-load micro-service starting method.

[0156] Figure 5 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. As shown in the structure of Figure 5 The electronic device provided in the embodiment of the present application comprises one or more processors 710 and memories 720; the processor 710 in the electronic device can be one or more, Figure 5 In the embodiment, the processor 710 is taken as an example; the memory 720 is used for storing one or more programs; the one or more programs are executed by the one or more processors 710, so that the one or more processors 710 implement the high-load micro-service starting method according to any one of the embodiments of the present application.

[0157] The electronic device can also comprise an input device 730 and an output device 740.

[0158] The processor 710, the memory 720, the input device 730 and the output device 740 in the electronic device can be connected through a bus or other means, Figure 5 In the embodiment, the connection through the bus is taken as an example.

[0159] The memory 720 in the electronic device serves as a computer readable storage medium, and can be used to store one or more programs, which can be software programs, computer executable programs and modules, such as program instructions / modules of the high-load micro-service starting method provided in the embodiments of the present application. The processor 710 performs various function applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 720, that is, implements the high-load micro-service starting method in the above method embodiments.

[0160] The memory 720 can include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required by a function; the data storage area can store data created according to the use of the electronic device, etc. In addition, the memory 720 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state memory device. In some examples, the memory 720 can further include a memory remotely arranged relative to the processor 710, which can be connected to the device through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0161] The input device 730 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the electronic device. The output device 740 can include a display device such as a display screen.

[0162] The present application also provides a computer readable storage medium storing a computer program executable by an electronic device, which causes the electronic device to perform the steps of a high-load micro-service starting method when the computer program is running on the electronic device.

[0163] In particular, a computer storage medium of embodiments of the present application can employ any combination of one or more computer readable medium or media. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include the following: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this embodiment, the computer readable storage medium can be any tangible medium that contains or stores a program used by an instruction execution system, apparatus, or device to function or to be combined with the instruction execution system, apparatus, or device.

[0164] Finally, it should be noted that the above-described embodiments are merely used to illustrate the technical solutions of the present application, rather than limit the technical solutions of the present application; even though the present application has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that modifications can be made to the technical solutions recorded in the above embodiments, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not cause the essence of the corresponding technical solutions to depart from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A high-load microservice starting method, characterized in that, Comprises: Implement hierarchical preloading mechanism, including reading configuration file to get static page path information, precompiling corresponding template, and initializing connection pool to establish preset minimum idle connection number; Implement verification algorithm optimization, including converting verification data set into hash map structure to establish double-layer hash index, and constructing client feature Trie tree by initializing root node, inserting child node according to string character in turn and creating new node when missing, and marking node as word end at the end of string; Implement request verification mechanism optimization, realize request parameter verification and request header source verification, return error response or unauthorized response when verification fails; Implement probe parameter dynamic adjustment, including setting initial delay and failure threshold of start-up phase probe, calling service warm-up interface in readiness check probe, and dynamically adjusting survival probe detection interval according to running index; Perform stress test verification, including configuring container resource parameters and adjusting thread pool size and connection number, simulating high concurrency scenario to execute input / output intensive and computation intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results.

2. The high-load microservice starting method according to claim 1, characterized in that, Implement hierarchical preloading mechanism, including reading configuration file to get static page path information, precompiling corresponding template, and initializing connection pool to establish preset minimum idle connection number, further comprising: Read configuration file, get static page path information from preset path, and split the content into multiple independent path items according to the separator; Traverse and process each path item, check if the path is empty, then use template engine to precompile the corresponding template to generate the final content, and record the preloading log; Initialize link field, link data, table data and grouping data, simulate actual request data structure and execute key logic to complete class loading and cache warm-up; Send asynchronous HTTP request to the specified URL, simulate user behavior to trigger network communication and resource initialization, so that the template engine and related resources complete initialization at startup.

3. The high-load microservice starting method of claim 1, wherein, Implement verification algorithm optimization, including converting verification data set into hash map structure to establish double-layer hash index, and constructing client feature Trie tree by initializing root node, inserting child node according to string character in turn and creating new node when missing, and marking node as word end at the end of string, further comprising: Convert the verification data set into a hash map structure to realize constant time complexity comparison operation; Initialize the root node of the Trie tree, which does not contain any characters, as the starting point of prefix matching; According to the characters of the string, select the corresponding child node in turn, create a new node when the child node is missing, and continue until the string processing is completed; Mark the node as the end of the word after completing the insertion of the complete word.

4. The high-load microservice starting method of claim 1, wherein, Implement request verification mechanism optimization, realize request parameter verification and request header source verification, return error response or unauthorized response when verification fails, further comprising: Verify the legality of the request parameter mapping to ensure that the parameters meet the preset specifications; Verify the request header source information to check if the source contains a trusted domain name to confirm the request credibility; Return a specific error code and message when parameter verification fails, and terminate the current request processing flow; Return unauthorized response code and message when source verification fails, prevent illegal access and maintain system security.

5. The high-load microservice starting method of claim 1, wherein, Perform probe parameter dynamic adjustment, including setting startup phase probe initial delay and failure threshold, calling service warm-up interface in readiness check probe, and dynamically adjusting survival probe detection interval according to running indicators, further including: Setting startup phase probe initial delay and failure threshold; Calling service warm-up interface in readiness check probe, sending requests through command line tool to complete resource initialization; Dynamically adjusting survival probe detection interval according to running phase monitoring indicators to adapt to system load changes; Optimizing probe parameters through real-time data.

6. The high-load microservice starting method of claim 1, wherein, Perform stress test verification, including configuring container resource parameters and adjusting thread pool size and connection number, simulating high concurrency scenarios to execute input / output intensive and computation intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results, further including: Configuring container resource parameters, adjusting thread pool minimum idle thread number and maximum thread number, and connection queue length; Simulate high concurrency scenarios to execute input / output intensive tasks and computation intensive tasks to cover typical loads; Measure system response time, error rate, and resource usage, including CPU and memory data; Optimize system parameters according to test results.

7. The high-load microservice starting method of claim 1, wherein, The method further includes: Coordinate resource initialization through hierarchical preloading mechanism, including: Complete template compilation and connection pool warm-up before service startup, establish preset minimum idle connection number; Preload all static pages and key data structures through warm-up interface, complete class loading and cache initialization; Perform initialization of link fields, link data, table data, and grouping data to simulate actual request logic; Optimize with verification algorithm and probe parameter dynamic adjustment to achieve resource coordination and system optimization.

8. A high-load microservice startup system, characterized in that, Including: Hierarchical preloading mechanism execution module configured to execute hierarchical preloading mechanism, including reading configuration file to obtain static page path information, precompiling corresponding templates, and initializing connection pool to establish preset minimum idle connection number; Verification algorithm optimization module configured to execute verification algorithm optimization, including converting verification data set to hash map structure to establish double-layer hash index, and constructing client feature Trie tree by initializing root node, inserting child nodes according to string characters and creating new nodes when missing, and marking node as word end when string ends; Request verification mechanism optimization module configured to execute request verification mechanism optimization, implement request parameter verification and request header source verification, return error response or unauthorized response when verification fails; Probe parameter dynamic adjustment module configured to execute probe parameter dynamic adjustment, including setting startup phase probe initial delay and failure threshold, calling service warm-up interface in readiness check probe, and dynamically adjusting survival probe detection interval according to running indicators; Stress test verification module configured to execute stress test verification, including configuring container resource parameters and adjusting thread pool size and connection number, simulating high concurrency scenarios to execute input / output intensive and computation intensive tasks, measuring system response time and error rate, and optimizing system parameters according to test results.

9. An electronic device, comprising: Including: A processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program executable by an electronic device, and when the computer program runs on the electronic device, the electronic device executes the steps of the method in any one of claims 1 to 7.