Cloud native architecture service concurrency performance optimization method and device, equipment and medium
By reusing service thread resources, concurrent processing and reducing data interaction frequency for complex scenario services of microservice architecture in cloud native architecture, the TPS reduction and system bottleneck problems of microservice architecture in complex scenarios are solved, and efficient service concurrency performance optimization is achieved.
Patent Information
- Application Number
- CN202411469440.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-03-11
AI Technical Summary
In complex scenarios, the microservice architecture has increased the amount of high-frequency inter-service communication and interactive data, resulting in a decline in service TPS indicators, becoming a system bottleneck.
By reusing service thread resource, concurrency processing of service level threads and reducing data interaction frequency in a cloud-native architecture, the reflection mechanism of the factory design pattern and ForkJoinPool and other technologies are used to optimize service concurrency performance.
It improves the communication efficiency of services in complex scenarios of microservice architecture, reduces the risk of microservice system flash breakage, continuously provides high availability and high concurrency service capabilities, and solves the concurrent response efficiency of cloud-native architecture services under the Internet-based scenario-based business integration development model.
Smart Images

Figure CN119597497A_ABST
Abstract
Description
Background Art
[0002] Microservice architecture is a cloud-native architecture approach that includes many small components or services that are loosely coupled and can be deployed separately in a single application. Microservice architecture capabilities are an important technical guarantee for the new generation of digital cloud-native provincial business operation systems to output capabilities and operate capabilities externally, and carry the ability to provide front-end applications with secure, reliable, orchestrated, and governable services. Because the microservice architecture is a loosely coupled architecture, as the complexity of the system and business evolves, the efficiency of the capabilities provided by the combination of multiple atomic microservices in a distributed system has restricted the service TPS indicators under the microservice framework due to the high frequency of inter-service communication and the increase in the amount of interactive data, and to a certain extent has become a system bottleneck.
[0003] Therefore, it is urgent to provide a technical solution to solve the above problems. Summary of the invention
[0004] In order to solve the above technical problems, the present invention provides a method, device, equipment and medium for optimizing the concurrent performance of cloud native architecture services.
[0005] In a first aspect, the present invention provides a method for optimizing concurrent performance of cloud native architecture services, and the technical solution of the method is as follows:
[0006] Determine the combined scenario services to be optimized under the cloud native architecture;
[0007] The service thread resource reuse, service-level thread concurrency processing and data interaction frequency reduction processing are performed on the combined scenario service to be optimized, so as to achieve service concurrency performance optimization of the combined scenario service to be optimized.
[0008] The beneficial effects of a cloud native architecture service concurrent performance optimization method of the present invention are as follows:
[0009] The method of the present invention can improve the communication efficiency of complex scenario services in microservice architecture, thereby minimizing the microservice system fuse triggered by a single service, continuously providing end users with high-availability, high-availability and high-concurrency service capabilities, solving the Internet-based scenario-based business integration development model, and improving the concurrent response efficiency of cloud-native architecture services.
[0010] Based on the above solution, a cloud native architecture service concurrency performance optimization method of the present invention can also be improved as follows.
[0011] In an optional manner, the step of reusing service thread resources for the combined scene service to be optimized includes:
[0012] The reflection mechanism of the factory design pattern is adopted to reuse the service thread resources of the combined scene service to be optimized.
[0013] In an optional manner, the step of performing service-level thread concurrent processing on the combined scene service to be optimized includes:
[0014] Constructing the concurrent thread job of the combined scene service to be optimized through ForkJoinPool;
[0015] Build a thread pool and execute the concurrent thread jobs through invoke reflection;
[0016] Control the thread pool, including stopping receiving external tasks and waiting for settings.
[0017] In an optional manner, the step of reducing the frequency of data interaction for the combined scenario service to be optimized includes:
[0018] Based on the cache mechanism and low coupling rules, the frequency of data interaction is reduced for the combined scenario service to be optimized.
[0019] In a second aspect, the present invention provides a device for optimizing concurrent performance of cloud native architecture services, and the technical solution of the device is as follows:
[0020] Includes: determination module and optimization module;
[0021] The determination module is used to: determine the combined scenario services to be optimized under the cloud native architecture;
[0022] The optimization module is used to: perform service thread resource reuse, service-level thread concurrency processing and data interaction frequency reduction processing on the combined scenario service to be optimized, so as to achieve service concurrency performance optimization of the combined scenario service to be optimized.
[0023] The beneficial effects of a cloud native architecture service concurrent performance optimization device of the present invention are as follows:
[0024] The device of the present invention can improve the communication efficiency of complex scenario services in the microservice architecture, thereby minimizing the microservice system fuse triggered by a single service, and continuously provide end users with high-availability, high-availability and high-concurrency service capabilities, solving the Internet-based scenario business integration development model and improving the concurrent response efficiency of cloud-native architecture services.
[0025] Based on the above scheme, a cloud native architecture service concurrent performance optimization device of the present invention can also be improved as follows.
[0026] In an optional manner, the step of reusing service thread resources for the combined scenario service to be optimized in the optimization module includes:
[0027] The reflection mechanism of the factory design pattern is adopted to reuse the service thread resources of the combined scene service to be optimized.
[0028] In an optional manner, the step of performing service-level thread concurrent processing on the combined scenario service to be optimized in the optimization module includes:
[0029] Constructing the concurrent thread job of the combined scene service to be optimized through ForkJoinPool;
[0030] Build a thread pool and execute the concurrent thread jobs through invoke reflection;
[0031] Control the thread pool, including stopping receiving external tasks and waiting for settings.
[0032] In an optional manner, the step of reducing the frequency of data interaction of the combined scenario service to be optimized in the optimization module includes:
[0033] Based on the cache mechanism and low coupling rules, the frequency of data interaction is reduced for the combined scenario service to be optimized.
[0034] In a third aspect, a technical solution of an electronic device of the present invention is as follows:
[0035] It includes a memory, a processor, and a program stored in the memory and running on the processor. When the processor executes the program, the steps of the cloud native architecture service concurrency performance optimization method of the present invention are implemented.
[0036] In a fourth aspect, the present invention provides a computer-readable storage medium having the following technical solution:
[0037] Instructions are stored in the computer-readable storage medium. When the computer-readable storage medium reads the instructions, the computer-readable storage medium executes the steps of the cloud-native architecture service concurrency performance optimization method of the present invention.
[0038] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:
[0040] Figure 1A flowchart of an embodiment of a method for optimizing concurrent performance of cloud native architecture services according to the present invention;
[0041] Figure 2 The following is a flowchart of a typical scenario;
[0042] Figure 3 Schematic diagram of the principle of concurrent performance optimization method for cloud native architecture services;
[0043] Figure 4 A schematic diagram of the structure of an embodiment of a cloud native architecture service concurrent performance optimization device of the present invention;
[0044] Figure 5 The figure is a schematic structural diagram of an embodiment of an electronic device of the present invention. DETAILED DESCRIPTION
[0045] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0046] Figure 1 A flow chart of an embodiment of a method for concurrent performance optimization of cloud-native architecture services provided by the present invention is shown, and the method for concurrent performance optimization of cloud-native architecture services can be executed by electronic devices such as terminal devices or servers. The terminal device can be any fixed or mobile terminal such as user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, vehicle-mounted device, wearable device, etc. The server can be a single server or a server cluster composed of multiple servers. Any electronic device can implement the method for concurrent performance optimization of cloud-native architecture services by means of a processor calling computer-readable instructions stored in a memory. As Figure 1 As shown, the following steps are included:
[0047] S1. Determine the combined scenario services to be optimized under the cloud native architecture.
[0048] Among them, the cloud-native architecture includes a microservice architecture, and the combined scenario service to be optimized is a complex combined scenario service that needs to be optimized in this embodiment.
[0049] It should be noted that, taking telecom operators as an example, the combined scenario services to be optimized correspond to interactive scenarios and typical scenarios. Specifically:
[0050] 1) Interaction scenarios. When the salesperson provides users with query, business processing, function management, and operation and maintenance services by logging into the CRM front desk or mobile app, since the business system involves the integration and development of multiple businesses, it is necessary to provide CHBN integrated scenario service capabilities based on various atomic microservices when users interact through the front-end APP. As the business integration scenarios become more complex, the number of atomic microservices, the number of service verification rules, and the interactive data show a certain order of magnitude growth, resulting in a decrease in the TPS of the container scenario combination service, a high memory, and a continuous increase in the number of database connections.
[0051] 2) Typical scenarios. In the home broadband integration scenario, the salesperson logs into the system through the PC or APP 4A, authenticates the work number, and obtains the user authorization certificate to query the customer information, and then enters the home customer area to handle the establishment of a home integration for the user. Establishing a home integration involves the new or reuse of the home main card, the new or reuse of G network members, the new opening of broadband and fixed-line phones, etc. At the same time, each integration link contains multiple independent business scenarios. The overall implementation involves more than 40 combined service capabilities, atomic services, etc., and the interaction frequency is more than 100 times. The service performance of this type of scenario has affected the user experience and system hardware resource consumption to a certain extent. The specific scenario process is as follows: Figure 2 shown.
[0052] S2. Perform service thread resource reuse, service-level thread concurrency processing, and data interaction frequency reduction processing on the combined scenario service to be optimized, so as to optimize the service concurrency performance of the combined scenario service to be optimized.
[0053] In S2, specifically:
[0054] 1) The step of reusing service thread resources for the combined scene service to be optimized includes:
[0055] The reflection mechanism of the factory design pattern is adopted to reuse the service thread resources of the combined scene service to be optimized.
[0056] Among them, the combined scenario services to be optimized exist in the scenario of combined service capability reuse in the same microservice application. The combined scenario services to be optimized adopt the reflection mechanism of the factory design pattern to reduce jvm thread expenditure, database connection pool, interaction efficiency, etc., initially load services and methods into the jvm, parse the service name and obtain methods when requested, and implement interface interaction through the reflection method invoke, thereby realizing service thread resource reuse and reducing the number of threads.
[0057] 2) The step of performing service-level thread concurrent processing on the combined scene service to be optimized comprises:
[0058] Through ForkJoinPool, a concurrent thread job of the combined scene service to be optimized is constructed.
[0059] Build a thread pool and execute the concurrent thread jobs through invoke reflection.
[0060] Control the thread pool, including stopping receiving external tasks and waiting for settings.
[0061] Among them, the service capabilities of the combined scenarios to be optimized involve multiple microservice verification calls. Such verification classification has a certain degree of independence, especially in low-data coupling business scenarios such as business rule verification and commodity rule verification. The service response efficiency is improved through service concurrency, which can be achieved through the following steps:
[0062] ① Create concurrent thread jobs for the combined scenario service to be optimized through ForkJoinPool, form a job list based on independent verification types, and preliminarily formulate 10 concurrent thread jobs based on the combined scenario service to be optimized: pubFork.task(inPubForkList,10,1,new TransPhoneCheckTaskJL()).
[0063] ②Create a thread pool and execute concurrent thread jobs through invoke reflection:
[0064] ForkJoinPool forkJoinPool=new ForkJoinPool(threadNum);
[0065] List <object>ret=forkJoinPool.invoke(new PubForkTask(testList,count,pubForkTask));
[0066] ③ Manage and control the thread pool, including stopping receiving external tasks and waiting settings. Set the thread pool to shutdown, stop receiving external submit tasks, and wait for the tasks and jobs being executed to complete; use awaitTermination to control the waiting time, set the timeout to 600ms, and release the thread after all tasks are completed or timed out.
[0067] 3) The step of reducing the frequency of data interaction for the combined scenario service to be optimized comprises:
[0068] Based on the cache mechanism and low coupling rules, the frequency of data interaction is reduced for the combined scenario service to be optimized.
[0069] Among them, for the highly cohesive scenarios on the server side of the combined scenario services to be optimized, high-frequency access data is introduced into the cache, and the response efficiency of the interaction itself is improved through the cache, and typical scenario verification rules, basic configuration data, etc. The rule verification service uses service encapsulation to verify the rule operations in parallel, and feeds back the verification results to the client at one time to reduce the number of interactions between services.
[0070] Among them, for the highly coupled data scenarios of the combined scenario services to be optimized, the service data messages are large and the high-frequency transactions should avoid the use of the microservice call mode as much as possible to reduce the interaction thread expenses and the cost of the interaction data messages between services. The direct introduction of the dependency package mode is used for internal interaction in the JVM.
[0071] The technical solution scenario combination service (combined scenario service to be optimized) of this embodiment is the main line to achieve the goals of high capability cohesion and low data coupling under the cloud native architecture, while separating data layer data access from data storage to improve data access capabilities. This embodiment introduces a concurrent thread mechanism to improve service-level TPS by regularizing the sinking of core capabilities, while increasing the reuse capacity of rule microservices. This embodiment reduces JVM memory expenses, thread occupancy between services, and fuse risks by reducing high-frequency and large data packet access, thereby improving data interaction processing capabilities. This embodiment reduces microservice thread resource expenses and improves the overall access capabilities of microservice applications through the engineering design pattern reflection mechanism. Taking telecom operators as an example, after adopting the technical solution of this example, the main tariff change relationship verification is improved from 2.78s to about 800ms, which improves the TPS of core services such as network-wide qualification verification, marketing, and home customers as a whole.
[0072] It should be noted that if Figure 3 As shown:
[0073] ① Steps 1.1 to 1.3: The application pod adopts the factory design pattern, and the reflection mechanism improves capability reuse and internal pod interaction while reducing JVM thread expenses.
[0074] ② Links 2.1 to 4.1: Reduce the interaction between microservices and entities, and reduce high-frequency big data message interactions, and upgrade the API capabilities of the data access layer to the atomic service layer.
[0075] ③ Link 3.1: After the microservice is lightly loaded, the rule capability is decentralized, and the TPS of the verification service is improved through the parallel access capability of the low-coupling rule service.
[0076] ④ Steps 4.3 and 4.4: Improve data access capabilities and introduce a cache mechanism to improve data query access capabilities.
[0077] The technical solution of this embodiment can improve the communication efficiency of complex scenario services in the microservice architecture, thereby minimizing the microservice system circuit breaking triggered by a single service, continuously providing end users with high-availability, high-availability and high-concurrency service capabilities, solving the Internet-based scenario-based business integration development model, and improving the concurrent response efficiency of cloud-native architecture services.
[0078] Figure 4 FIG. 2 is a schematic diagram showing a structure of an embodiment of a cloud native architecture service concurrent performance optimization device 200 provided by the present invention. Figure 4 As shown, the device 200 includes: a determination module 210 and an optimization module 220;
[0079] The determination module 210 is used to: determine the combined scenario service to be optimized under the cloud native architecture;
[0080] The optimization module 220 is used to: perform service thread resource reuse, service-level thread concurrency processing and data interaction frequency reduction processing on the combined scenario service to be optimized, so as to optimize the service concurrency performance of the combined scenario service to be optimized.
[0081] In an optional manner, the step of reusing service thread resources for the combined scenario service to be optimized in the optimization module 220 includes:
[0082] The reflection mechanism of the factory design pattern is adopted to reuse the service thread resources of the combined scene service to be optimized.
[0083] In an optional manner, the step of performing service-level thread concurrent processing on the combined scenario service to be optimized in the optimization module 220 includes:
[0084] Constructing the concurrent thread job of the combined scene service to be optimized through ForkJoinPool;
[0085] Build a thread pool and execute the concurrent thread jobs through invoke reflection;
[0086] Control the thread pool, including stopping receiving external tasks and waiting for settings.
[0087] In an optional manner, the step of reducing the data interaction frequency of the combined scenario service to be optimized in the optimization module 220 includes:
[0088] Based on the cache mechanism and low coupling rules, the frequency of data interaction is reduced for the combined scenario service to be optimized.
[0089] The technical solution of this embodiment can improve the communication efficiency of complex scenario services in the microservice architecture, thereby minimizing the microservice system circuit breaking triggered by a single service, continuously providing end users with high-availability, high-availability and high-concurrency service capabilities, solving the Internet-based scenario-based business integration development model, and improving the concurrent response efficiency of cloud-native architecture services.
[0090] The above-mentioned parameters and steps for each module to implement corresponding functions in the cloud native architecture service concurrent performance optimization device 200 of this embodiment can refer to the parameters and steps in the embodiment of the cloud native architecture service concurrent performance optimization method above, and will not be repeated here.
[0091] like Figure 5 As shown, an electronic device 300 of an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any of the above-mentioned cloud native architecture service concurrency performance optimization methods, specifically:
[0092] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements any of the cloud native architecture service concurrent performance optimization methods provided in the above embodiments. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the electronic device 300 may also include other components for implementing device functions, which will not be repeated here.
[0093] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that the computer implements any of the above-mentioned cloud native architecture service concurrency performance optimization methods.
[0094] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0095] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes any of the above-mentioned cloud native architecture service concurrent performance optimization methods.
[0096] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.
[0097] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.
[0098] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.
[0099] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.< / object>
Claims
1. A method for optimizing concurrent performance of cloud native architecture services, characterized in that: include: Determine the combined scenario services to be optimized under the cloud native architecture; The service thread resource reuse, service-level thread concurrency processing and data interaction frequency reduction processing are performed on the combined scenario service to be optimized, so as to achieve service concurrency performance optimization of the combined scenario service to be optimized.
2. The method for optimizing concurrent performance of cloud native architecture services according to claim 1, characterized in that: The step of reusing service thread resources for the combined scene service to be optimized includes: The reflection mechanism of the factory design pattern is adopted to reuse the service thread resources of the combined scene service to be optimized.
3. The method for optimizing concurrent performance of cloud native architecture services according to claim 1, characterized in that: The step of performing service-level thread concurrent processing on the combined scene service to be optimized includes: Constructing the concurrent thread job of the combined scene service to be optimized through ForkJoinPool; Build a thread pool and execute the concurrent thread jobs through invoke reflection; Control the thread pool, including stopping receiving external tasks and waiting for settings.
4. The method for optimizing concurrent performance of cloud native architecture services according to claim 1, characterized in that: The step of reducing the frequency of data interaction for the combined scenario service to be optimized includes: Based on the cache mechanism and low coupling rules, the frequency of data interaction is reduced for the combined scenario service to be optimized.
5. A device for optimizing concurrent performance of cloud native architecture services, characterized in that: include: Determine modules and optimize modules; The determination module is used to: determine the combined scenario services to be optimized under the cloud native architecture; The optimization module is used to: perform service thread resource reuse, service-level thread concurrency processing and data interaction frequency reduction processing on the combined scenario service to be optimized, so as to achieve service concurrency performance optimization of the combined scenario service to be optimized.
6. The cloud native architecture service concurrent performance optimization device according to claim 5, characterized in that: The step of reusing service thread resources for the combined scene service to be optimized in the optimization module includes: The reflection mechanism of the factory design pattern is adopted to reuse the service thread resources of the combined scene service to be optimized.
7. The cloud native architecture service concurrent performance optimization device according to claim 5, characterized in that: The step of performing service-level thread concurrent processing on the combined scene service to be optimized in the optimization module includes: Constructing the concurrent thread job of the combined scene service to be optimized through ForkJoinPool; Build a thread pool and execute the concurrent thread jobs through invoke reflection; Control the thread pool, including stopping receiving external tasks and waiting for settings.
8. The cloud native architecture service concurrent performance optimization device according to claim 5, characterized in that: The step of reducing the frequency of data interaction of the combined scenario service to be optimized in the optimization module includes: Based on the cache mechanism and low coupling rules, the frequency of data interaction is reduced for the combined scenario service to be optimized.
9. An electronic device, characterized in that: The electronic device includes a processor, the processor is coupled to a memory, at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the cloud native architecture service concurrency performance optimization method as described in any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that: At least one computer program is stored in the computer-readable storage medium, and the at least one computer program is loaded and executed by the processor so that the computer-readable storage medium implements the cloud-native architecture service concurrency performance optimization method as described in any one of claims 1 to 4.