CN113190425B - Resource switching method and device - Google Patents

Resource switching method and device Download PDF

Info

Publication number
CN113190425B
CN113190425B CN202110467629.7A CN202110467629A CN113190425B CN 113190425 B CN113190425 B CN 113190425B CN 202110467629 A CN202110467629 A CN 202110467629A CN 113190425 B CN113190425 B CN 113190425B
Authority
CN
China
Prior art keywords
server
application
performance test
started
duty ratio
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110467629.7A
Other languages
Chinese (zh)
Other versions
CN113190425A (en
Inventor
孙晓野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202110467629.7A priority Critical patent/CN113190425B/en
Publication of CN113190425A publication Critical patent/CN113190425A/en
Application granted granted Critical
Publication of CN113190425B publication Critical patent/CN113190425B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/2236Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test CPU or processors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2289Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing by configuration test

Abstract

The application provides a resource switching method and a device, wherein the method comprises the following steps: when determining to perform performance test on the application, acquiring a server duty ratio; wherein the server duty cycle is the ratio of the total number of servers used for performance testing to the total number of servers started for the application; determining a server for performance testing according to the server duty ratio and a server started for the application; and notifying the determined server for performance test to close the online thread opened for the application, loading configuration information for performance test, and refreshing the context. The method can reduce the performance test cost and improve the performance test efficiency.

Description

Resource switching method and device
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method and an apparatus for switching resources.
Background
Performance testing is increasingly important for rapidly iterating application systems. The life cycle of the performance test is changed from temporary to conventional.
The current performance test implementation stage comprises: the method comprises the steps of initial online application, demand transformation, application server and network environment change. When performance test is needed, additional resources such as a server and the like are required to be applied to ensure the performance test and the environment isolation of online service, and the operation of the online service is not influenced.
In the process of implementing the present application, the inventors found that the cost of implementing the performance test scheme is relatively high.
Disclosure of Invention
In view of this, the present application provides a method and apparatus for switching resources, which can reduce the cost of performance test and improve the efficiency of performance test.
In order to solve the technical problems, the technical scheme of the application is realized as follows:
in one embodiment, a method for switching resources is provided, the method comprising:
when determining to perform performance test on the application, acquiring a server duty ratio; wherein the server duty cycle is the ratio of the total number of servers used for performance testing to the total number of servers started for the application;
determining a server for performance testing according to the server duty ratio and a server started for the application;
and notifying the determined server for performance test to close the online thread opened for the application, loading configuration information for performance test, and refreshing the context.
In another embodiment, there is provided a resource switching apparatus including: the device comprises a first determining unit, an acquiring unit, a second determining unit and a notifying unit;
the first determining unit is used for determining whether performance test is carried out on the application or not;
the acquisition unit is used for acquiring the server duty ratio when the first determination unit determines that the performance test is performed on the application; wherein the server duty cycle is the ratio of the total number of servers used for performance testing to the total number of servers started for the application;
the second determining unit is used for determining a server for performance testing according to the server duty ratio acquired by the acquiring unit and the server started by the application;
the notification unit is configured to notify the server for performance test determined by the second determination unit to close an online thread opened for the application, load configuration information for performance test, and refresh a context.
In another embodiment, an electronic device is provided that includes a memory, a processor, and a computer program stored on the memory and executable on the processor that when executed implements the steps of the resource switching method.
In another embodiment, a computer readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the resource switching method.
As can be seen from the above technical solutions, when the server is performing online service in the above embodiments, if performance test is required, the server performing online service is directly switched to the server performing performance test according to the server duty ratio to perform performance test. According to the scheme, the performance test can be realized on the premise that the online service is not affected and the server is not additionally applied, the test cost can be reduced, the server which is in online service does not need to be restarted, and the test efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a schematic diagram of a resource switching system according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an interface for configuration information configuration in an embodiment of the present application;
FIG. 3 is a schematic diagram of a resource switching process according to a first embodiment of the present application;
FIG. 4 is a schematic diagram of a resource switching flow in a second embodiment of the present application;
FIG. 5 is a schematic diagram of a resource switching flow in a third embodiment of the present application;
FIG. 6 is a schematic diagram of a resource switching flow in a fourth embodiment of the present application;
FIG. 7 is a schematic diagram showing a server duty cycle in an embodiment of the present application;
FIG. 8 is a schematic diagram of a resource switching device according to an embodiment of the present application;
fig. 9 is a schematic diagram of an entity structure of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented, for example, in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those elements but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The technical scheme of the application is described in detail below by specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
The embodiment of the application provides a resource switching method which is applied to a resource switching system. A plurality of servers and registries are included in the system.
Referring to fig. 1, fig. 1 is a schematic diagram of a resource switching system in an embodiment of the present application. In fig. 1, for example, 4 servers are taken as an example, and in a specific implementation, the resource switching system may be a system corresponding to one application or a system corresponding to a plurality of applications. The servers corresponding to the plurality of applications can be physically the same or different, that is, one physical server can be configured for one application or can be configured for a plurality of applications, and when the servers are configured for a plurality of applications, the servers can be subjected to function virtual isolation.
A java-agent is deployed for each server for implementing the relevant configuration of the dynamically loaded application (configuration information for performance testing, and configuration information for online services), and resource switching.
And each server is distributed, and the performance test resources are shared through the zookeeper deployed on each server, so that the repeated use of the performance test resources is reduced.
The distributed architecture is adopted for the servers deployed for each application, when the application scene is switched, threads corresponding to the current running scene are directly closed, and threads corresponding to the switched running scene are started.
When an application service is started on a server, acquiring an application name started by the server and an IP address of the server, and registering the application name and the IP address of the server in a registration center; the server may be obtained directly from the registry when it is desired to determine the server to launch for the application or to determine which server to switch.
In a specific implementation, for each application, the application server will apply to the database for performance testing and the database for online service; a cache for performing performance testing and a cache for performing on-line services, and an external service for performing performance testing and an external service for performing on-line services, and the like.
In the embodiment of the application, the configuration information for performance test can be configured through the visual interface. Referring to fig. 2, fig. 2 is an interface schematic diagram for configuring configuration information in an embodiment of the present application. FIG. 2 is an example, with the contents of the settings including database address, radis address, remote rpc alias, and server duty cycle for performance testing. But the specific implementation is not limited to the setting of the above information.
Common resource information can be configured on the server and provided for each application to perform performance test, and the common resources can be divided into two types: one may be used simultaneously; another is that different applications may be used at different times.
The server duty cycle is the ratio of the total number of servers used to perform the performance test to the total number of servers started for the application. In order not to affect normal on-line services, the configured server duty cycle needs to be limited, e.g. the server duty cycle is not greater than a preset threshold, e.g. 50%.
In specific implementation, the configuration information for the online service can be configured according to the existing implementation, and also can be realized in a similar manner to the configuration information of the performance test, namely, the visual configuration of the configuration information is performed.
The configuration information for performance test and the configuration information of online service are stored in the registry, when each server starts the application, the configuration information corresponding to the application can be directly obtained from the registry and stored locally, or the configuration information corresponding to the online service can be obtained when the online service is determined, and the configuration information corresponding to the performance test is obtained when the performance test is determined.
In a specific implementation, one server is designated as a main server in the servers corresponding to one application, or the main server is determined by competition of the servers, and the main server determines which server is used for performing performance test and which is used for performing online service according to the server duty ratio. The main server is one of the servers, and is used for loading configuration information for performance test and refreshing the context for performance test when the main server is used for performance test, and is used for loading configuration information for online service when the main server is used for online service and refreshing the context for online service.
The following describes in detail a process of implementing resource switching as a primary server with reference to the accompanying drawings.
Example 1
When the application service is started, it is necessary to determine whether to perform performance test.
Referring to fig. 3, fig. 3 is a schematic diagram of a resource switching flow in a first embodiment of the present application. The method comprises the following specific steps:
step 301, when the application service is started, if it is determined that performance test is performed, the server duty ratio is obtained.
When an application service is started, determining whether performance test is performed, and if so, acquiring the server duty ratio; otherwise, the online service is directly started, namely the online service is directly started to enter the production environment.
When the application service is started, whether the main thread in the application service is started or not can be dynamically judged through the Java-1.6+ JVMTI interface, and if the main thread is started, the main thread is associated to the corresponding main thread.
And judging whether to configure a starting performance test by accessing the zookeeper, and performing the performance test.
The server duty cycle is the ratio of the total number of servers used to perform performance testing to the total number of servers started for the application.
Step 302, determining a server for performing performance testing and a server for performing online service according to the server duty ratio and a server started for the application.
The server for application startup is typically a server for online service when performance test is not performed, and may be regarded as a configured server for online service.
If the total number of servers started for the application is 10 and the server ratio is 1/5, the number of servers used for performance test is determined to be 2 and the total number of servers used for online service is determined to be 8.
Specific implementation of selecting which 2 servers among the 10 servers are used for performance testing is not limited in the embodiment of the present application, for example, random selection, for example, selection according to the number size of the servers, etc.
Step 303, notifying the determined server for online service to load configuration information for online service, and refreshing the context.
And loading configuration information for the online service and refreshing the context when the non-main server knows that the non-main server is the server for online service.
Online services may be performed after refreshing the context.
Step 304, notifying the determined server for performance testing to load configuration information for performance testing, and refreshing the context.
The non-main server or the main server loads configuration information for performance test and refreshes the context when knowing that the non-main server or the main server is the server for performance test.
Performance testing may be performed after refreshing the context.
The execution of step 303 and step 304 is not sequential, and may be performed simultaneously.
Each server can load configuration information from a configuration center when being started, can acquire the configuration information when the configuration information corresponding to the online service and the configuration information corresponding to the performance test exist, can be stored locally, and can also load the configuration information when the configuration information is needed.
The notification of the servers in step 304 and step 303 may be implemented by message notification, or by data change in the zookeeper, so that each server knows itself to perform service.
In this embodiment, when an application service is started, it is determined according to relevant configuration that if online service and performance test are performed simultaneously, servers are divided according to the server duty ratio in the configuration information of the performance test, and corresponding services are started on corresponding servers. The method does not need to apply for a server additionally, and can directly use partial online service servers to perform performance test on the premise of not influencing online service, thereby greatly reducing test cost.
Example two
If online service is currently performed and performance test is not performed, a processing procedure during performance test is required.
Referring to fig. 4, fig. 4 is a schematic diagram of a resource switching flow in a second embodiment of the present application. The method comprises the following specific steps:
step 401, when determining to perform performance testing for an application, obtaining a server duty cycle.
Wherein the server duty cycle is the ratio of the total number of servers used to perform performance testing to the total number of servers started for the application.
When the online service is currently performed and configuration information for performance test is received, data in the zookeeper changes, the performance test is determined to be required, and the server duty ratio in the configuration information is acquired.
Step 402, determining a server for performance testing according to the server duty ratio and the server started for the application.
If the server ratio is 1/3 and the number of started servers is 6, determining that the number of servers used for performance test is 2, selecting 2 servers from the 6 servers, wherein the selection mode can be random selection or selection according to the size of the server numbers, for example, arranging the numbers of the servers from large to small, selecting two servers corresponding to the first two numbers, or arranging the numbers of the servers from small to large, and selecting two servers corresponding to the first two numbers.
Step 403, notifying the determined server for performance test to close the online thread opened for the application, loading the configuration information for performance test, and refreshing the context.
And acquiring a server which is switched from the online service to the performance test, closing an online thread opened for the application, loading configuration information for the performance test, refreshing a context, and performing the performance test.
When the server is in online service, if performance test is needed, the server in online service is directly switched to the server in performance test according to the server duty ratio to perform performance test. According to the scheme, the performance test can be realized on the premise that the online service is not affected and the server is not additionally applied, the test cost can be reduced, the server is not required to be restarted, and the test efficiency is improved.
Example III
Currently, online service and performance testing requires a process flow when the server duty cycle is changed.
Referring to fig. 5, fig. 5 is a schematic diagram of a resource switching flow in a third embodiment of the present application. The method comprises the following specific steps:
step 501, when determining that the server duty ratio corresponding to the application is updated, acquiring the updated server duty ratio.
And when the server duty ratio is determined to be updated through the change of the data in the zookeeper, acquiring the updated server duty ratio to determine which servers need to be switched.
Step 502, if it is determined that the server to be switched is the server currently used for performing the performance test according to the updated server duty ratio and the server started for the application, the server to be switched is notified to close the performance test thread started for the application, the configuration information for the online service is loaded, and the context is refreshed. The present flow is ended.
If the current server ratio is 3/5 and the updated server ratio is 2/5, for example, 10 servers in total, then 6 of the servers that are performing performance tests need to be selected to be 2 for online service.
May be selected randomly or according to a number.
And when the server which is determined to be required to be switched or the server itself is required to be subjected to environment switching, closing a performance test thread which is opened for the application, loading configuration information for online service, refreshing a context, and carrying out online service.
Step 503, if the server to be switched is determined to be the server currently used for online service according to the updated server duty ratio and the server started for the application, the server to be switched is notified to close the online service thread started for the application, the configuration information for performance test is loaded, and the context is refreshed.
If the current server ratio is 2/5 and the updated server ratio is 3/5, for a total of 10 servers, then 2 out of 6 servers that are on-line service need to be selected for performance testing.
May be selected randomly or according to a number.
And when the server which is determined to be required to be switched or the server itself is required to be subjected to environment switching, closing an online service thread which is opened for the application, loading configuration information for performance testing, refreshing a context, and performing the performance testing.
In this embodiment, when the number of servers for performance test and online service needs to be adjusted due to a certain requirement, the direct adjustment can be realized by updating the server duty ratio without restarting the servers. According to the scheme, the server does not need to be restarted, the adjustment of the application environment of the server can be realized, and the performance test efficiency is improved on the premise that the online service is not affected.
Example IV
Performance testing is underway and is terminated.
Referring to fig. 6, fig. 6 is a schematic diagram of a resource switching flow in a fourth embodiment of the present application. The method comprises the following specific steps:
and step 601, when determining to end the performance test on the application, notifying a server for performance test to close a performance test thread opened for the application.
And when the data in the zookeeper is determined to change and the server duty ratio is updated to 0, determining to end the performance test.
Step 602, determining whether to use the server for closing the performance test thread for online service according to the configured switching rule.
In a specific implementation, the switching rule may be whether the servers that end the performance test are switched to be used for performing the online service according to a proportion, for example, if the proportion is 100%, all the servers are switched to be used for performing the online service, for example, if the proportion is 0%, and then the servers are not used for performing the online service.
When the servers for performance test end performance test, the embodiment of the application determines how many servers are switched to online service according to the configured switching rules, so that flexible use of resources can be realized.
Example five
And acquiring configuration information for starting the operation of the server currently, and the server duty ratio, and outputting the configuration information through a visual interface.
Referring to fig. 7, fig. 7 is a schematic diagram showing a server duty ratio in an embodiment of the application. The server duty cycle for application a is shown in fig. 7, where it can be seen that the server duty cycle is 1/4, where for application a,1/4 of the servers are used for performance testing and 3/4 of the servers are used for on-line service, and it can also be seen from fig. 7 that on-line service and performance testing are currently performed simultaneously.
Fig. 7 shows an example of display information, and the specific implementation is not limited to the above-mentioned display information, and configuration information corresponding to a performance test, configuration information corresponding to an online service, and the like may be displayed.
Based on the same inventive concept, the embodiment of the application also provides a resource switching device. Referring to fig. 8, fig. 8 is a schematic structural diagram of a resource switching device according to an embodiment of the present application. The device comprises: a first determination unit 801, an acquisition unit 802, a second determination unit 803, and a notification unit 804;
a first determining unit 801 for determining whether performance testing is performed for an application;
an acquisition unit 802 for acquiring a server duty ratio when the first determination unit 801 determines that performance test is performed for an application; wherein the server duty cycle is the ratio of the total number of servers used for performance testing to the total number of servers started for the application;
a second determining unit 803 configured to determine a server for performing performance test for a server started by the application according to the server duty ratio acquired by the acquiring unit 802;
a notification unit 804, configured to notify the server for performance test determined by the second determination unit 803 to close the online thread opened for the application, load configuration information for performance test, and refresh the context.
Preferably, the method comprises the steps of,
a first determining unit 801, configured to further determine whether a server duty ratio corresponding to the application is updated;
an obtaining unit 802, configured to obtain an updated server duty ratio when the first determining unit 801 determines that the server duty ratio corresponding to the application is updated;
a second determining unit 803, configured to determine, according to the updated server duty ratio acquired by the acquiring unit 802, a server that needs to be switched for a server that is started by the application;
a notification unit 804, further configured to, if the second determining unit 803 determines that the server to be switched is the server currently used for performing the performance test according to the updated server duty ratio and the server started for the application, notify the server to be switched to close the performance test thread started for the application, load configuration information for online service, and refresh the context; if the second determining unit 803 determines that the server to be switched is the server currently used for online service according to the updated server duty ratio and the server started for the application, the server to be switched is notified to close the online service thread started for the application, load the configuration information for performance test, and refresh the context.
Preferably, the method comprises the steps of,
a second determining unit 803, configured to further determine whether to end the performance test performed on the application; after the notification unit 804 notifies the server for performing performance test to close the performance test thread opened for the application, determining whether to use the server for closing the performance test thread for performing online service according to the configured switching rule;
a notification unit 804, configured to, when the second determination unit 803 determines that the performance test performed on the application is ended, further notify the server for performing the performance test to close the performance test thread opened for the application.
Preferably, the method comprises the steps of,
a first determining unit 801, configured to determine whether to perform a performance test when the application service is started;
an obtaining unit 802, configured to obtain a server duty ratio if the determining unit determines that the performance test is performed;
a second determining unit 803 further configured to determine a server for performing a performance test and a server for performing an online service according to the server duty ratio acquired by the acquiring unit 802 and the server started for the application;
a notification unit 804, configured to further notify the server for online service determined by the second determination unit 803 to load configuration information for online service, and refresh a context; the server for performance test determined by the second determination unit 803 is notified to load configuration information for performance test and refresh the context.
Preferably, the method comprises the steps of,
an obtaining unit 802, configured to obtain, when an application service is started on a server, an application name started by the server and an IP address of the server, and register the application name and the IP address of the server in a registry; and when the server started for the application is acquired, acquiring the IP address of the server corresponding to the application from a registry to acquire the server started for the application.
Preferably, the apparatus further comprises: a configuration unit;
the configuration unit is used for configuring configuration information for performance test through the visual configuration interface.
Preferably, the apparatus further comprises: an output unit;
an obtaining unit 802, configured to further obtain configuration information and a server duty ratio that are used to start the operation of the server currently;
the output unit is configured to output the configuration information and the server duty ratio acquired by the acquiring unit 802 through a visual interface.
The units of the above embodiments may be integrated or may be separately deployed; can be combined into one unit or further split into a plurality of sub-units.
In another embodiment, there is also provided an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the resource switching method when executing the program.
In another embodiment, a computer readable storage medium having stored thereon computer instructions which when executed by a processor may implement steps in the resource switching method is also provided.
Fig. 9 is a schematic diagram of an entity structure of an electronic device according to an embodiment of the present application. As shown in fig. 9, the electronic device may include: processor (Processor) 910, communication interface (Communications Interface) 920, memory (Memory) 930, and communication bus 940, wherein Processor 910, communication interface 920, and Memory 930 communicate with each other via communication bus 940. The processor 910 may call logic instructions in the memory 930 to perform the following method:
when determining to perform performance test on the application, acquiring a server duty ratio; wherein the server duty cycle is the ratio of the total number of servers used for performance testing to the total number of servers started for the application;
determining a server for performance testing according to the server duty ratio and a server started for the application;
and notifying the determined server for performance test to close the online thread opened for the application, loading configuration information for performance test, and refreshing the context.
Further, the logic instructions in the memory 930 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present application without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
The foregoing description of the preferred embodiments of the application is not intended to be limiting, but rather to enable any modification, equivalent replacement, improvement or the like to be made within the spirit and principles of the application.

Claims (10)

1. A method for switching resources, the method comprising:
when determining to perform performance test on the application, acquiring a server duty ratio; wherein the server duty cycle is the ratio of the total number of servers used for performance testing to the total number of servers started for the application;
determining a server for performance testing according to the server duty ratio and a server started for the application;
and notifying the determined server for performance test to close the online thread opened for the application, loading configuration information for performance test, and refreshing the context.
2. The method according to claim 1, wherein the method further comprises:
when the server duty ratio corresponding to the application is determined to be updated, acquiring the updated server duty ratio;
if the server to be switched is determined to be the current server for performance test according to the updated server duty ratio and the server started by the application, the server to be switched is informed to close the performance test thread started by the application, the configuration information for the online service is loaded, and the context is refreshed;
if the server to be switched is determined to be the server currently used for online service according to the updated server duty ratio and the server started by the application, the server to be switched is informed to close the online service thread started by the application, the configuration information for performance test is loaded, and the context is refreshed.
3. The method according to claim 1, wherein the method further comprises:
when determining to end performance testing of the application, notifying a server for performance testing to close a performance testing thread opened for the application;
and determining whether a server for closing the performance test thread is used for online service according to the configured switching rule.
4. The method according to claim 1, wherein the method further comprises:
when the application service is started, if the performance test is determined to be performed, the server duty ratio is obtained;
determining a server for performing performance testing and a server for performing online service according to the server duty ratio and a server started for the application;
notifying the determined server for online service to load configuration information for online service and refreshing the context;
and notifying the determined server for performance test to load configuration information for performance test, and refreshing the context.
5. The method according to any one of claims 1-4, wherein the method further comprises:
when an application service is started on a server, acquiring an application name started by the server and an IP address of the server, and registering the application name and the IP address of the server in a registration center;
obtaining a server started for the application, including:
and acquiring the IP address of the server corresponding to the application from a registry to acquire the server started for the application.
6. The method according to any one of claims 1-4, wherein the method further comprises:
configuration information for performance testing is configured through a visual configuration interface.
7. The method according to any one of claims 1-4, wherein the method further comprises:
and acquiring configuration information and a server duty ratio of the current starting server operation, and outputting the configuration information and the server duty ratio through a visual interface.
8. A resource switching apparatus, the apparatus comprising: the device comprises a first determining unit, an acquiring unit, a second determining unit and a notifying unit;
the first determining unit is used for determining whether performance test is carried out on the application or not;
the acquisition unit is used for acquiring the server duty ratio when the first determination unit determines that the performance test is performed on the application; wherein the server duty cycle is the ratio of the total number of servers used for performance testing to the total number of servers started for the application;
the second determining unit is used for determining a server for performance testing according to the server duty ratio acquired by the acquiring unit and the server started by the application;
the notification unit is configured to notify the server for performance test determined by the second determination unit to close an online thread opened for the application, load configuration information for performance test, and refresh a context.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1-7 when the program is executed by the processor.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method of any of claims 1-7.
CN202110467629.7A 2021-04-28 2021-04-28 Resource switching method and device Active CN113190425B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110467629.7A CN113190425B (en) 2021-04-28 2021-04-28 Resource switching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110467629.7A CN113190425B (en) 2021-04-28 2021-04-28 Resource switching method and device

Publications (2)

Publication Number Publication Date
CN113190425A CN113190425A (en) 2021-07-30
CN113190425B true CN113190425B (en) 2023-09-22

Family

ID=76979922

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110467629.7A Active CN113190425B (en) 2021-04-28 2021-04-28 Resource switching method and device

Country Status (1)

Country Link
CN (1) CN113190425B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005031736A (en) * 2003-07-07 2005-02-03 Hitachi Information Systems Ltd Server load distribution device and method, and client/server system
CN103401731A (en) * 2013-07-31 2013-11-20 迈普通信技术股份有限公司 Method and system for switching between manual testing environment and automatic testing environment
CN106777144A (en) * 2016-12-19 2017-05-31 武汉斗鱼网络科技有限公司 A kind of server switching method and device
CN107861863A (en) * 2017-08-24 2018-03-30 平安普惠企业管理有限公司 Running environment switching method, equipment and computer-readable recording medium
WO2018090977A1 (en) * 2016-11-17 2018-05-24 贵州白山云科技有限公司 Device switching method and device switching apparatus
CN109828927A (en) * 2019-01-31 2019-05-31 北京三快在线科技有限公司 A kind of method, apparatus of integration testing, equipment and storage medium
CN110430082A (en) * 2019-08-15 2019-11-08 浙江万朋教育科技股份有限公司 A method of management testing service device and application program
WO2020024405A1 (en) * 2018-08-03 2020-02-06 平安科技(深圳)有限公司 Test method, device, server and storage medium based on distributed coordination
CN112162891A (en) * 2020-10-14 2021-01-01 腾讯科技(深圳)有限公司 Performance test method in server cluster and related equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005031736A (en) * 2003-07-07 2005-02-03 Hitachi Information Systems Ltd Server load distribution device and method, and client/server system
CN103401731A (en) * 2013-07-31 2013-11-20 迈普通信技术股份有限公司 Method and system for switching between manual testing environment and automatic testing environment
WO2018090977A1 (en) * 2016-11-17 2018-05-24 贵州白山云科技有限公司 Device switching method and device switching apparatus
CN106777144A (en) * 2016-12-19 2017-05-31 武汉斗鱼网络科技有限公司 A kind of server switching method and device
CN107861863A (en) * 2017-08-24 2018-03-30 平安普惠企业管理有限公司 Running environment switching method, equipment and computer-readable recording medium
WO2020024405A1 (en) * 2018-08-03 2020-02-06 平安科技(深圳)有限公司 Test method, device, server and storage medium based on distributed coordination
CN109828927A (en) * 2019-01-31 2019-05-31 北京三快在线科技有限公司 A kind of method, apparatus of integration testing, equipment and storage medium
CN110430082A (en) * 2019-08-15 2019-11-08 浙江万朋教育科技股份有限公司 A method of management testing service device and application program
CN112162891A (en) * 2020-10-14 2021-01-01 腾讯科技(深圳)有限公司 Performance test method in server cluster and related equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Hydra:高能效的异构服务器融合方法;钱璐;曹强;;计算机研究与发展(S1);全文 *

Also Published As

Publication number Publication date
CN113190425A (en) 2021-07-30

Similar Documents

Publication Publication Date Title
CN101196912B (en) Method and apparatus for application state synchronization
CN112087325A (en) Gray scale publishing method, device, equipment and readable storage medium
EP3211527A1 (en) Multi-screen sharing based application management method and device, and storage medium
CN110784409B (en) Spring Cloud-based micro-service gray level publishing method
CN106209943A (en) The system of selection of communication node and device
CN109639818B (en) Service discovery method and device under cloud environment, server and storage medium
CN112015578B (en) Wind control system and method based on pre-synchronous processing and post-asynchronous processing
CN106789308A (en) The GIS service device and its control method of a kind of micro services framework automatically retractable
CN112988281A (en) Application starting method and device
CN116455951A (en) Calling method for realizing RPC isolation of multi-tenant service based on dynamic rules
CN113190425B (en) Resource switching method and device
CN108536541B (en) Process engine object processing method and device
CN111400051A (en) Resource scheduling method, device and system
CN110187890B (en) Project deployment method, electronic equipment and storage medium
CN110851166A (en) User-unaware application program updating method and device and computer equipment
CN116346728A (en) Low code platform current limiting method and device
CN114296865B (en) Scheduling method and device for virtual machine threads, electronic equipment and storage medium
CN113259146B (en) Micro-service access control method and device and micro-service system
CN108683612B (en) Message acquisition method and device
CN115145722A (en) System and method for switching micro-service architecture and single architecture
CN111079390B (en) Method and device for determining selection state of check box list
KR100798916B1 (en) Method and system for handling the network events in application server using open API based web services
CN113094074A (en) Service cluster updating method and device
US10417041B2 (en) Moving a software application in a system cluster
CN109842689B (en) Method and device for selecting server access

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant