Registry Critical Resource Testing Method and Device

By generating unique values and using k8s capacity expansion to simulate massive Dubbo services, and combining with the Dubbo microservice framework for critical resource testing of the registry center, the problem of inability to effectively simulate high availability and performance capacity in the existing technology is solved, and efficient testing of the registry center is achieved.

CN114625662BActive Publication Date: 2025-08-01INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210295685.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-24
Publication Date
2025-08-01
Estimated Expiration
2042-03-24

AI Technical Summary

Technical Problem

When testing critical resources of the registry center, the prior art cannot effectively simulate high availability and performance capacity, especially the transaction impact in the abnormal situation of the registry center, and it is difficult to reach the test scale of massive services.

Method used

By generating the unique value of the service, using k8s for horizontal expansion, simulate the generation of preset services of the order of magnitude, and combining with the Dubbo microservice framework for registration and subscription, collect transaction exception information in real time to realize critical resource testing of the registration center.

Benefits of technology

The scenario of a 100,000-level Dubbo service and a million-level node was successfully simulated, and the transaction abnormalities were grasped in real time, providing a solid basis for the performance and high availability testing of the registration center, avoiding transaction risks caused by the instability of the registration center.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114625662B_ABST
    Figure CN114625662B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for testing critical resources of a registration center, which relates to the financial field. The method includes: generating a unique value of the current service in response to a service request to be subscribed or registered sent to the registration center; determining a service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm; horizontally expanding the determined service set to generate services of a preset order of magnitude; registering or subscribing the generated services of the preset order of magnitude to the service center for critical resource testing. The present invention can simulate scenarios of hundreds of thousands or millions of service nodes, and can grasp the abnormal conditions of current transactions in real time. It well solves the difficulties of insufficient means for testing critical resources of the registration center and poor grasp of real-time transaction conditions, and provides a solid test basis for the optimization of the registration center.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to testing technology, and more specifically, to a method and device for testing critical resources of a registry center. Background Art

[0002] Currently, there are two testing methods for a large number of services in the registry center. One is to use the client of the registry center to register and subscribe to a large number of nodes in the registry center, such as zkclient. The second method is to use the microservice framework Dubbo to start real service providers and consumers.

[0003] When using the registry center client to create nodes in the registry center, even if hundreds of thousands or even millions of nodes can be registered within the same Java process, it is inconsistent with the real usage scenario. When testing the high availability of the registry center, it is impossible to perceive the impact of the registry center's exception on transactions. When using the Dubbo framework to register real service providers and consumers, the number of services registered within the same process is limited, far from reaching the performance capacity limit of the registry center, and it is also difficult to simulate tens of thousands of different Dubbo services using the same program. Summary of the Invention

[0004] To overcome at least one defect in the testing of critical resources of the registry center in the prior art, the present invention provides a method for testing critical resources of a registry center, including:

[0005] Generating a unique value of the current service in response to a service request to be subscribed or registered sent to the registry center;

[0006] Determining a service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm;

[0007] Horizontally expanding the determined service set to generate services of a preset order of magnitude;

[0008] Registering or subscribing the generated services of a preset order of magnitude to the service center for testing critical resources.

[0009] In an embodiment of the present invention, the horizontally expanding the determined service set to generate services of a preset order of magnitude includes:

[0010] Horizontally expanding the determined service set by using k8s to generate services of a preset order of magnitude.

[0011] In an embodiment of the present invention, the generating a unique value of the current service in response to a service request to be subscribed or registered sent to the registry center includes:

[0012] Determining the offset of the current service request in response to the service request sent to the registry center, and using the determined offset as the unique value of the current service.

[0013] In an embodiment of the present invention, the determining the service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm includes:

[0014] Obtaining the offset of the current service program as the unique value of the current service;

[0015] Determining the service set corresponding to the current service request according to the pre - established correspondence between the service unique value and the service registration version number.

[0016] Meanwhile, the present invention also provides a registration center critical resource testing device, including:

[0017] A unique value determining module, configured to generate the unique value of the current service in response to a service request to be subscribed or registered sent to the registration center;

[0018] A service determining module, configured to determine the service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm;

[0019] An expansion module, configured to horizontally expand the determined service set to generate services of a preset quantity level;

[0020] A service processing module, configured to register or subscribe the generated services of the preset quantity level to the service center for critical resource testing.

[0021] In an embodiment of the present invention, the expansion module uses k8s to horizontally expand the determined service set to generate services of a preset quantity level.

[0022] In an embodiment of the present invention, the service determining module includes:

[0023] An offset obtaining unit, configured to obtain the offset of the current service program as the unique value of the current service;

[0024] A set generating unit, configured to determine the service set corresponding to the current service request according to the pre - established correspondence between the service unique value and the service registration version number.

[0025] Meanwhile, the present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the above - mentioned method is implemented.

[0026] Meanwhile, the present invention also provides a computer - readable storage medium, where a computer program for executing the above - mentioned method is stored.

[0027] The present invention provides a method and device for testing critical resources of a registry center. By responding to service requests to be subscribed or registered sent to the registry center, a unique value of the current service is generated; according to the unique value of the current service and a preset service algorithm, a service set corresponding to the current service request is determined; the determined service set is horizontally expanded to generate services of a preset order of magnitude; the generated services of the preset order of magnitude are registered or subscribed to the service center for testing critical resources, which can simulate a scenario of 100,000-level Dubbo services and 1 million-level service nodes, and can grasp the abnormal situation of the current transaction in real time. It well solves the difficulties of insufficient means for testing critical resources of the registry center and poor mastery of the real-time situation of transactions, and provides a solid test basis for the optimization of the registry center.

[0028] In order to make the above and other objects, features and advantages of the present invention more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, makes a detailed description as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0030] Figure 1 It is a flowchart of the method for testing critical resources of the registry center provided by the present invention;

[0031] Figure 2 It is a schematic diagram of the Dubbo microservice system and the registry center in the embodiment of the present invention;

[0032] Figure 3 It is a schematic diagram of the embodiment of the present invention;

[0033] Figure 4 It is a block diagram of the device for testing critical resources of the registry center provided by the present invention;

[0034] Figure 5 It is a schematic diagram of the electronic device provided in the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0035] The following will combine the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0036] As container orchestration technology continues to develop, the distributed microservices architecture has gradually grown. As a basic function in the distributed system, the service discovery plays an important role in the registry. However, there are many uncertainties in the operation of distributed systems. For example, the registry may experience downtime, disk read / write anomalies may occur, there are limits to service push, etc. Subsequently, the risk of transaction failure may follow. To avoid transaction risks caused by the instability of the registry, the testing team often needs to simulate scenarios equivalent to or even exceeding the production service level in the test environment and verify the performance capacity and high availability of the registry based on this environment.

[0037] In view of this, it is particularly important to propose a method for testing critical resources of the registry that simulates a large number of Dubbo services. As Figure 1 shown, the method for testing critical resources of the registry provided by the present invention includes:

[0038] Step S101, generating a unique value for the current service in response to a service request to be subscribed or registered sent to the registry;

[0039] Step S102, determining a service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm;

[0040] Step S103, horizontally expanding the determined service set to generate services of a preset quantity level;

[0041] Step S104, registering or subscribing the generated services of a preset quantity level to the service center for critical resource testing.

[0042] As Figure 2 shown, it is a schematic diagram of the Dubbo microservices architecture and the registry in an embodiment of the present invention.

[0043] By default, Dubbo providers or consumers will write their own information into the registry after startup. After the consumer obtains the provider's information from the registry, it directly initiates a call to the provider. When the provider goes offline, the consumer will also receive the pushed information and update the list of provider addresses in the cache. When there is an internal anomaly in the registry, it may cause the provider to go offline in the registry, and the consumer receives an empty push, ultimately resulting in a transaction failure. Therefore, sufficient guarantee work should be done on the performance and high availability of the registry.

[0044] As Figure 3 shown, it is a schematic diagram for implementing the testing of critical resources of the registry that simulates a large number of Dubbo services in an embodiment of the present invention, mainly including 3 main component modules. The specific structure diagram and functions include:

[0045] 1) Service offset acquirer. Through a service offset acquisition program, it provides a simple REST interface to respond to requests from providers and consumers. It is necessary to ensure that the value returned for each request is unique, and the returned value represents the offset of the current service. The value of the offset determines the target service that the current process needs to register or subscribe to.

[0046] In the embodiment of the present invention, determining the service set corresponding to the current service request according to the unique value of the current service and the preset service algorithm includes:

[0047] Obtain the offset of the current service program as the unique value of the current service;

[0048] Determine the service set corresponding to the current service request according to the pre-established correspondence between the service unique value and the service registration version number.

[0049] For example: Provider 1 obtains the return value 1 and registers the service with version number 1, Provider 2 obtains the return value 2 and registers the service with version number 2, and Consumer 1 obtains the return value 1 and subscribes to the service with version number 1. Multiple services can be registered or subscribed to according to the situation within the same process. For example, Provider 1 obtains the offset 1 and registers the services with version numbers 1 - 10, and Provider 2 obtains the offset 2 and registers the services with version numbers 11 - 20.

[0050] 2) Service provider and service consumer, providing business logic programs. Based on the service registration and subscription functions of the Dubbo service framework, the provider completes the registration and implementation of the service, and the consumer makes continuous service calls. Make an image based on the program, and make full use of the characteristics of horizontal expansion of k8s, using k8s as the test running environment.

[0051] 3) Exception collector, providing an exception information collection program for service calls, providing a REST interface for service consumers to call. When an exception is captured during the consumer's call to the provider, the exception information is sent to the collection program, acting as the entry point for observing the transaction situation in the entire test.

[0052] In the embodiment of the present invention, a method for testing the critical resources of the registration center of a massive service microservice is simulated, and its specific working process is as follows:

[0053] After the service provider and the consumer are started, they immediately request the interface in the service offset acquirer in the registry, calculate the service set that needs to be registered or subscribed currently according to the returned offset by a preset unified algorithm, and perform the registration or subscription operation of the service according to the calculated service set. For example, the provider that gets the offset 1 registers four services A, B, C, and D, and the consumer that gets the offset 1 also subscribes to these four services ABCD. The service provider that gets the offset 2 registers four services E, F, G, and H. In the embodiment of the present invention, the algorithm for obtaining the offset can be implemented by using any offset algorithm in the current existing technology, and will not be elaborated here.

[0054] In this embodiment, the registry performs the service registration or subscription process based on the Dubbo api method. The Dubbo api method is more flexible than the xml and registration methods, can be flexibly configured through code, and performs dynamic registration and subscription services according to the calculated service set. After the service consumer subscribes, it continuously calls the service provider.

[0055] During the continuous call of the consumer, it captures the exception information and immediately sends it to the module exception collector. After sending the exception information, it continues to call, and so on.

[0056] After the core module service offset acquirer is executed, it will only register or subscribe to a small number of services. Finally, it performs horizontal expansion through the capabilities of k8s. Different replicas will obtain different offsets to perform registration and subscription operations on different services, and finally achieve a test scenario simulating one hundred thousand-level services and one million-level nodes.

[0057] The embodiment of the present invention provides a method for testing the critical resources of a registry for simulating a large number of Dubbo microservices. By independently developing multiple functional modules such as a service offset acquirer, a service registration and subscription device, and a transaction exception collector, it simulates a scenario of one hundred thousand-level Dubbo services and one million-level service nodes, and can grasp the abnormal situation of the current transaction in real time. It well solves the difficulties of insufficient testing means for the critical resources of the registry and poor mastery of the real-time situation of transactions, and provides a solid test basis for the optimization of the registry.

[0058] The present invention avoids transaction risks caused by the instability of the registry. Usually, the testing team needs to simulate a scenario equivalent to or even exceeding the production service level in the test environment, and verify the performance capacity and high availability of the registry on this basis.

[0059] Meanwhile, as Figure 4 shown, the present invention also provides a device for testing the critical resources of a registry, including:

[0060] The unique value determination module 401 is configured to generate a unique value of the current service in response to a service request to be subscribed or registered sent to the registration center;

[0061] The service determination module 402 is configured to determine a service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm;

[0062] The expansion module 403 is configured to horizontally expand the determined service set to generate services of a preset order of magnitude;

[0063] The service processing module 404 is configured to register or subscribe the generated services of a preset order of magnitude to the service center for critical resource testing.

[0064] For those skilled in the art, the implementation manner of the registration center critical resource testing device provided by the present invention can be clearly known through the description of the foregoing embodiments, and will not be elaborated herein.

[0065] It should be noted that the registration center critical resource testing method and device of the present disclosure can be used for critical resource testing of the registration center in the financial field, and can also be used for critical resource testing of the registration center in any field other than the financial field. The application fields of the registration center critical resource testing method and device of the present disclosure are not limited.

[0066] This embodiment also provides an electronic device, which can be a desktop computer, a tablet computer, a mobile terminal, etc. This embodiment is not limited thereto. In this embodiment, the electronic device can refer to the embodiments of the foregoing method and device, and the content thereof is incorporated herein, and the repeated parts will not be elaborated.

[0067] Figure 5 It is a schematic block diagram of the system composition of the electronic device 600 according to an embodiment of the present invention. As Figure 5 shown, the electronic device 600 may include a central processing unit 100 and a memory 140; the memory 140 is coupled to the central processing unit 100. It should be noted that this figure is exemplary; other types of structures can also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0068] In one embodiment, the registration center critical resource testing function may be integrated into the central processing unit 100. Among them, the central processing unit 100 may be configured to perform the following controls: generating a unique value of the current service request in response to a service request to be subscribed or registered sent to the registration center;

[0069] determining a service set corresponding to the current service request according to the unique value of the current service request and a preset service algorithm;

[0070] horizontally expanding the determined service set to generate services of a preset order of magnitude;

[0071] Register or subscribe the generated preset order of services to the service center for critical resource testing.

[0072] As Figure 5 shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processor 130, a display 160, and a power supply 170. It should be noted that the electronic device 600 does not necessarily have to include Figure 5 all the components shown in Figure 5 ; in addition, the electronic device 600 may further include

[0073] As Figure 5 shown, the central processing unit 100, sometimes also referred to as a controller or operation control, may include a microprocessor or other processor device and / or logic device. The central processing unit 100 receives inputs and controls the operations of the various components of the electronic device 600.

[0074] Among them, the memory 140, for example, may be one or more of a buffer, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices. The above information related to failures can be stored, and in addition, programs for executing relevant information can also be stored. And the central processing unit 100 can execute the programs stored in the memory 140 to implement information storage or processing, etc.

[0075] The input unit 120 provides inputs to the central processing unit 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to supply power to the electronic device 600. The display 160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.

[0076] The memory 140 may be a solid-state memory, for example, a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be such a memory that stores information even when powered off, can be selectively erased and has more data. Examples of such a memory are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, and the application / function storage unit 142 is used to store application programs and function programs or the processes for operating the electronic device 600 through the central processing unit 100.

[0077] The memory 140 may further include a data storage unit 143 for storing data such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for the communication functions of the electronic device and / or for performing other functions of the electronic device (such as a messaging application, an address book application, etc.).

[0078] The communication module 110 is a transmitter / receiver that transmits and receives signals via the antenna 111. The communication module 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.

[0079] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module, and / or a wireless local area network module, etc. The communication module 110 is also coupled to the speaker 131 and the microphone 132 via the audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby implementing general telecommunication functions. The audio processor 130 may include any suitable buffers, decoders, amplifiers, etc. Additionally, the audio processor 130 is also coupled to the central processor 100, so that recording can be performed on the local device through the microphone 132, and the sound stored on the local device can be played through the speaker 131.

[0080] An embodiment of the present invention also provides a computer-readable program, wherein when the program is executed in an electronic device, the program causes the computer to execute the registration center critical resource test method as described in the above embodiment in the electronic device.

[0081] An embodiment of the present invention also provides a storage medium storing a computer-readable program, wherein the computer-readable program causes the computer to execute the registration center critical resource test described in the above embodiment in an electronic device.

[0082] The preferred embodiments of the present invention have been described above with reference to the accompanying drawings. Many features and advantages of these embodiments are clear from this detailed description, so the appended claims are intended to cover all such features and advantages of these embodiments that fall within their true spirit and scope. In addition, since many modifications and changes are readily conceivable by those skilled in the art, the embodiments of the present invention are not to be limited to the exact structures and operations illustrated and described, but may cover all suitable modifications and equivalents falling within their scope.

[0083] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.

[0084] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0085] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means realizes the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0086] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0087] Specific embodiments are applied in the present invention to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A method for testing critical resources of a registry center, characterized in that, The method described above includes: Generating a unique value of the current service in response to a service request to be subscribed or registered sent to the registration center; Determining a service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm, including: obtaining the offset of the current service program as the unique value of the current service; determining the service set corresponding to the current service request according to the pre-established correspondence between the service unique value and the service registration version number; Performing horizontal expansion on the determined service set to generate services of a preset order of magnitude, including: using k8s to perform horizontal expansion on the determined service set to generate services of a preset order of magnitude; wherein, the preset order of magnitude is equal to or exceeds the production service magnitude; Registering or subscribing the generated services of the preset order of magnitude to the registration center for critical resource testing.

2. The critical resource testing method of the registry according to claim 1, wherein The generating a unique value of the current service in response to a service request to be subscribed or registered sent to the registration center includes: Determining the offset of the current service request in response to the service request sent to the registration center, and using the determined offset as the unique value of the current service.

3. A registry critical resource testing device, characterized in that The device described above includes: A unique value determination module, configured to generate a unique value of the current service in response to a service request to be subscribed or registered sent to the registration center; A service determination module, configured to determine a service set corresponding to the current service request according to the unique value of the current service and a preset service algorithm; wherein, the service determination module includes: an offset acquisition unit, configured to obtain the offset of the current service program as the unique value of the current service; a set generation unit, configured to determine the service set corresponding to the current service request according to the pre-established correspondence between the service unique value and the service registration version number; An expansion module, configured to perform horizontal expansion on the determined service set to generate services of a preset order of magnitude; wherein, the preset order of magnitude is equal to or exceeds the production service magnitude, and the expansion module uses k8s to perform horizontal expansion on the determined service set to generate services of a preset order of magnitude; A service processing module, configured to register or subscribe the generated services of the preset order of magnitude to the registration center for critical resource testing.

4. The registration center critical resource testing device according to claim 3, characterized in that, The unique value determination module determines the offset of the current service request in response to the service request sent to the registration center, and uses the determined offset as the unique value of the current service.

5. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method described in claim 1 or 2.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program for executing the method described in claim 1 or 2.

Citation Information

Patent Citations

  • Test method and related product

    CN109542796A