Method, device and electronic device for determining boot time
By setting the first instance in the cloud resource network, obtaining the startup time of the target instance and the startup time of the service port, the problem of testing multiple cloud resource instances in the prior art to consume a large amount of elastic IP resources for booting is solved, and efficient testing efficiency and accuracy are achieved.
Patent Information
- Application Number
- CN202110689095.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-21
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2041-06-21
AI Technical Summary
The prior art requires a large amount of elastic IP resources to be occupied when testing multiple cloud resource instances to boot, resulting in inefficient testing.
By setting a first instance in the cloud resource network, the boot time of the target instance and the boot time of the specified service port are obtained by using the instance, and the information is transmitted to the first device to calculate the boot time of the target instance. This method only requires that the first instance consumes IP resources when communicating with the first device, and does not require binding of an elastic IP address for each target instance.
It improves the time-consuming test efficiency of the instance startup, avoids the inefficiency caused by limited elastic IP resources, and improves the accuracy of the test results.
Smart Images

Figure CN115580556B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of instance startup test, and in particular to a method, device and electronic device for determining startup time consumption. Background Art
[0002] Cloud resource instances such as cloud servers and virtual machines usually need to be powered on before they can be used normally. It takes a while for a cloud resource instance to be powered on and can be used normally. This period of time can be understood as the boot time of the cloud resource instance. The boot time of a cloud resource instance can often reflect the performance of the cloud resource platform. In related technologies, in order to accurately test the boot time of a cloud resource instance, an elastic IP (Internet Protocol, a protocol for interconnecting networks) address can be bound to the cloud resource instance; a test script is run on a public network device, and the test script accesses the cloud resource instance through the elastic IP address, thereby obtaining the boot time of the cloud resource instance and the time when the service in the instance runs normally, and then obtaining the boot time of the cloud resource instance. In this method, if it is necessary to test the boot time of multiple cloud resource instances at the same time, each cloud resource instance needs to be bound to an elastic IP address, which requires a large amount of elastic IP resources. When the elastic IP resources are limited, the test efficiency of the instance boot time is affected. Summary of the invention
[0003] In view of this, an object of the present invention is to provide a method, device and electronic device for determining boot time, so as to improve the test efficiency of instance boot time.
[0004] In a first aspect, an embodiment of the present invention provides a method for determining boot time, which is applied to a first device; the first device is communicatively connected to a first instance in a cloud resource network; the method comprises: obtaining, through the first instance, the boot time of a target instance in the cloud resource network and the start time of a specified service port in the target instance; based on the start time of the specified service port and the boot time of the target instance, determining the boot time of the target instance.
[0005] Furthermore, the first device is set in a public network outside the cloud resource network; the first instance is set with a public IP address; the first device is communicated with the first instance through the public IP address; the step of obtaining the power-on time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance through the first instance includes: receiving the power-on time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance sent by the first instance through the public IP address.
[0006] Furthermore, the public IP address includes an elastic public IP address; the first device establishes an SSH communication connection with the first instance through the elastic public IP address.
[0007] Furthermore, based on the startup time of the specified service port and the startup time of the target instance, the step of determining the startup time of the target instance includes: calculating the time difference between the startup time of the specified service port and the startup time of the target instance; and determining the time difference as the startup time of the target instance.
[0008] Furthermore, the target instance includes multiple ones; the method also includes: calculating an average value of the boot time of the multiple target instances.
[0009] In the second aspect, an embodiment of the present invention also provides a method for determining the boot time, which is applied to a second device; a first instance in a cloud resource network is running on the second device; the first instance is communicatively connected to the first device; the method comprises: in response to receiving a test instruction from the first device, obtaining the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance; sending the start time of the specified service port and the boot time of the target instance to the first device, so as to determine the boot time of the target instance through the first device based on the start time of the specified service port and the boot time of the target instance.
[0010] Furthermore, in response to receiving a test instruction from the first device, before the step of obtaining the power-on time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance, the method also includes: setting a public IP address for the first instance; wherein the first device is set in a public network outside the cloud resource network; the first instance is communicated with the first device via the public IP address.
[0011] Furthermore, the public IP address includes an elastic public IP address; the first instance establishes an SSH communication connection with the first device through the elastic public IP address.
[0012] Furthermore, the first instance and the target instance are both set with an intranet address in the cloud resource network; the step of obtaining the power-on time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance includes: obtaining the power-on time of the target instance and the startup time of the specified service port in the target instance through the intranet address of the target instance.
[0013] Furthermore, the intranet address of the first instance and the intranet address of the target instance belong to the same subnet segment.
[0014] In the third aspect, an embodiment of the present invention also provides a device for determining the boot time, which is arranged in a first device; the first device is communicatively connected to a first instance in a cloud resource network; the device includes: a first acquisition module, used to obtain the boot time of a target instance in the cloud resource network and the start time of a specified service port in the target instance through the first instance; a determination module, used to determine the boot time of the target instance based on the start time of the specified service port and the boot time of the target instance.
[0015] In the fourth aspect, an embodiment of the present invention also provides a device for determining the boot time, which is arranged on a second device; a first instance in a cloud resource network is running on the second device; the first instance is communicatively connected to the first device; the device includes: a second acquisition module, which is used to obtain the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance in response to receiving a test instruction from the first device; a sending module, which is used to send the start time of the specified service port and the boot time of the target instance to the first device, so as to determine the boot time of the target instance through the first device based on the start time of the specified service port and the boot time of the target instance.
[0016] In a fifth aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for determining the boot time of any one of the first aspect or the second aspect.
[0017] In a sixth aspect, an embodiment of the present invention further provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for determining the boot time of any one of the first aspect or the second aspect.
[0018] The embodiments of the present invention bring the following beneficial effects:
[0019] The present invention provides a method, device and electronic device for determining boot time. Through a first instance that is connected to a first device in communication, the boot time of a target instance in a cloud resource network and the startup time of a specified service port in the target instance are obtained; based on the startup time of the specified service port and the boot time of the target instance, the boot time of the target instance is determined. This method sets a first instance in the cloud resource network, obtains the boot time of an instance inside the cloud resource network and parameters such as the startup time of a specified service port in the instance through the first instance, transmits these parameters to the first device, and then obtains the boot time of the instance in the cloud resource network; in the above method, only the first instance needs to occupy IP resources when communicating with the first device. When it is necessary to obtain the boot time of multiple instances in the cloud resource network, it is not necessary to occupy a large amount of IP resources. The test of instance boot time is no longer limited by IP resources, which improves the test efficiency.
[0020] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0021] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 A schematic diagram of an application scenario of a method for determining boot time consumption provided by an embodiment of the present invention;
[0024] Figure 2 A flowchart of a method for determining boot time consumption provided by an embodiment of the present invention;
[0025] Figure 3 A flowchart of another method for determining boot time consumption provided by an embodiment of the present invention;
[0026] Figure 4 A schematic diagram of an application scenario of another method for determining boot time consumption provided by an embodiment of the present invention;
[0027] Figure 5A schematic diagram of the structure of a device for determining boot time consumption provided by an embodiment of the present invention;
[0028] Figure 6 A schematic diagram of the structure of another device for determining boot time consumption provided by an embodiment of the present invention;
[0029] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0031] Cloud resource instances such as cloud servers and virtual machines usually need to be powered on before they can be used normally. It takes some time for a cloud resource instance to be powered on and used normally. This period of time can be understood as the boot time of the cloud resource instance. The boot time of a cloud resource instance can often reflect the performance of the cloud resource platform. In related technologies, whether the instance is successfully started can be determined by judging the status of the instance. If you want to determine the actual boot time, there are usually several solutions:
[0032] Solution 1: Manually use VNC (Virtual Network Console) to enter the cloud server instance to check the boot status. Although this method can accurately determine whether the boot is successful, it will cause a large deviation in the boot time of the test for batch boots due to the slow speed of manual viewing. This method is generally only applicable to testing the boot time of a single machine.
[0033] Solution 2: Use PING (Packet Internet Groper) to send ICMP (Internet Control Message Protocol) to the cloud server instance to check the boot status and obtain the boot time. In this method, when the cloud service instance does not enter the operating system, the EIP (Elastic IP Address) may have been created and bound. In this case, the PING can still be successful. In addition, if the operating system is entered normally under ideal conditions and no abnormal situation occurs in the middle, when the PING fails, it is necessary to wait for a certain timeout period (usually more than one second) to determine that the PING is unsuccessful. However, the PING may actually be successful after the timeout period. Therefore, the boot time determined by this method will have a large error to a certain extent.
[0034] Solution 3: Bind an elastic IP address to an instance in the cloud resource network, run a test script on a public network device, and use the elastic IP address to access the cloud resource instance to obtain the startup time of the cloud resource instance and the time when the service in the instance is running normally, and then obtain the startup time of the cloud resource instance, such as checking whether the SSH (SecureSHell) port (also known as port 22) in the instance is open; if you need to test the startup time of multiple cloud resource instances at the same time, each cloud resource instance needs to be bound to an elastic IP address, which requires a large amount of elastic IP resources. When elastic IP resources are limited, the efficiency of testing the instance startup time is affected.
[0035] Based on this, a method and an electronic device for determining boot time provided by an embodiment of the present invention can be applied to electronic devices such as computers and servers.
[0036] To facilitate understanding of this embodiment, a method for determining the boot time consumption disclosed in an embodiment of the present invention is described in detail. Figure 1 The application scenario diagram of the method for determining the boot time shown includes a public network and a first device in the public network. The first device can be a physical electronic device such as a terminal or a server, or a virtual device such as a virtual machine running on a physical device; it also includes a cloud resource network and a first instance in the cloud resource network. The cloud resource network can be understood as an intranet; wherein the first instance connects multiple target instances in the cloud resource network.
[0037] like Figure 2A flowchart of a method for determining boot time is shown, the method is applied to a first device; the first device is in communication connection with a first instance in a cloud resource network; wherein the first device can be a physical electronic device such as a terminal or a server, or a virtual device such as a virtual machine running on a physical device. The first device can be provided with a management platform for the first instance and the target instance in the cloud resource network. The method comprises the following steps:
[0038] Step S202, obtaining the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance through the first instance;
[0039] The first instance may be created in advance in the cloud resource network; for example, it may be created in advance through a custom image, or it may be created in other existing ways. A component with a network scanning function may be installed in the first instance, such as Nmap (Network Mapper, originally a network scanning and sniffing toolkit under Linux), which is used to scan the startup status of the target instance in the cloud resource network, and the opening status of the specified service port in the target instance; the target instance may be one or more; the target instance may be a cloud server instance; the startup time may be understood as the time when the target instance is created; the startup time of the specified service port may be understood as the time when the creation of the target instance is completed. When the specified service port is in the open state, it means that the target instance is successfully started, for example, the specified service port may be an SSH port, etc. In actual implementation, a first instance can be created in the cloud resource network in advance so that the first instance can communicate with the public network device; then the script in the first device is run to automatically communicate with the first instance, and through the components in the first instance, the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance are cyclically scanned or monitored in real time. If scanned or monitored, the time is recorded and returned to the first device.
[0040] Step S204, determining the boot time of the target instance based on the startup time of the designated service port and the boot time of the target instance.
[0041] The startup time of the above-mentioned specified service port usually indicates the time when the target instance is successfully started; since there may be one or more target instances, the startup time of each target instance can be determined by calculating the time difference between the startup time of the specified service port and the startup time of the target instance.
[0042] The present invention provides a method for determining the boot time, which obtains the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance through a first instance that is connected to the first device in communication; the boot time of the target instance is determined based on the start time of the specified service port and the boot time of the target instance. This method sets a first instance in the cloud resource network, obtains the boot time of the instance inside the cloud resource network and the start time of the specified service port in the instance through the first instance, transmits these parameters to the first device, and then obtains the boot time of the instance in the cloud resource network; in the above method, only the first instance needs to occupy IP resources when communicating with the first device. When it is necessary to obtain the boot time of multiple instances in the cloud resource network, it is not necessary to occupy a large amount of IP resources. The test of the instance boot time is no longer limited by IP resources, which improves the test efficiency.
[0043] An embodiment of the present invention also provides another method for determining the boot time. This embodiment is implemented on the basis of the above embodiment. This embodiment focuses on describing the specific implementation process of the steps of obtaining the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance through the first instance; and the specific implementation process of determining the boot time of the target instance based on the start time of the specified service port and the boot time of the target instance.
[0044] The first device is set in a public network outside the cloud resource network; the first instance is set with a public IP address; the first device is connected to the first instance through the public IP address. This embodiment specifically includes the following steps:
[0045] Step 301, receiving the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance sent by the first instance through the public IP address;
[0046] The public IP address can also be called a wide area network IP address. Specifically, the first device communicates with the first instance through the public IP address, sends the test instruction to the first instance, and then obtains the power-on time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance through the first instance. The first instance sends the acquired power-on time and startup time to the first device through the public IP address. The first device receives the power-on time and startup time through the public IP address.
[0047] A possible implementation method: the public IP address includes an elastic public IP address; the first device establishes an SSH communication connection with the first instance through the elastic public IP address.
[0048] The above elastic public IP addresses can provide independent public IP resources, including public IP addresses and public network export bandwidth services. They can be flexibly bound and unbound with resources such as elastic cloud servers, bare metal servers, virtual IPs, elastic load balancing, and NAT (Network Address Translation) gateways. They have a variety of flexible billing methods to meet the needs of various business scenarios. Usually, an elastic public IP can only be bound to one cloud resource for use.
[0049] Specifically, the first device can connect to the first instance through the elastic public network IP address using SSH to achieve communication connection with the first instance, and send a test instruction to the first instance through the first device. At this time, the script in the first device starts to run, scans the startup status of the target instance in the cloud resource network, and records the startup time; at the same time, use the Nmap installed in the first instance to scan whether the specified service port under the first instance network is started. If the specified service port in the target instance is scanned to be in the startup state, the startup time is recorded. SSH is a security protocol based on the application layer. This connection method is more reliable and can provide a security protocol for remote login sessions and other network services; the use of the SSH protocol can effectively prevent information leakage during remote management.
[0050] Step 302, calculating the time difference between the startup time of the designated service port and the startup time of the target instance; and determining the time difference as the startup time of the target instance.
[0051] When there is only one target instance, after the first device receives the startup time of the designated service port and the startup time of the target instance, the startup time and the time difference between the startup time and the startup time can be calculated, and the time difference is determined as the startup time of the target instance. If there are multiple target instances, the startup time of each target instance is first calculated, and then the actual required value is determined from the multiple startup times according to the needs of the actual scenario, for example, the average, maximum, minimum, median, etc. of the startup times of multiple target instances are calculated.
[0052] In addition, the target instance includes multiple targets; the method further includes: calculating the average boot time of the multiple target instances. When the actual scenario requires the boot time of multiple target instances, the average boot time of the multiple target instances can be calculated.
[0053] In the above method, a first instance can be created in the cloud resource network in advance, and by binding the first instance with an elastic public IP address, a communication connection is established with a first device on the public network, so that the first device can obtain the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance through the first instance, and then obtain the boot time of the target instance; and it is ensured that the first instance and the target instance are in the same network; in this method, it is only necessary to bind an elastic public IP address to the first instance to obtain the boot time of one or more target instances under the network of the first instance, without occupying a large amount of elastic IP resources, thereby improving the test efficiency of the instance boot time.
[0054] In addition, compared with the manual testing method, the test efficiency is improved and the accuracy of the test results is improved; compared with the PING testing method, the survey timeout setting is avoided, the test efficiency is improved and the accuracy of the test results is improved.
[0055] like Figure 3 As shown, an embodiment of the present invention further provides another method for determining boot time consumption, which is applied to a second device, which may be a physical electronic device such as a terminal or a server, or a virtual device such as a virtual machine running on a physical device; a first instance in a cloud resource network is running on the second device; the first instance is communicatively connected with the first device; the method comprises the following steps:
[0056] Step S402, in response to receiving the test instruction of the first device, obtaining the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance;
[0057] Specifically, before the test begins, the first instance in the cloud resource network is turned on, and then the first device sends a test instruction to the first instance. After the first instance receives the test instruction sent by the first device, the component with network scanning function installed in the first instance is used to obtain the power-on time of the target instance in the cloud resource network and the start time of the specified service port in the target instance.
[0058] Step S404, sending the startup time of the designated service port and the startup time of the target instance to the first device, so as to determine the startup time of the target instance based on the startup time of the designated service port and the startup time of the target instance through the first device.
[0059] Specifically, after the first instance obtains the power-on time of the target instance and the startup time of the designated service port, the power-on time and the startup time are sent to the first device; wherein the target instance has a unique identifier; when there are multiple target instances, the first device can determine the power-on time and the startup time of each target instance according to the unique identifier of the target instance, and then calculate the startup time of each target instance. Specifically, the difference between the startup time of the designated service port and the power-on time of the target instance can be calculated to determine the startup time of the target instance.
[0060] The present invention provides a method for determining boot time. In response to receiving a test instruction from a first device, the boot time of a target instance in a cloud resource network and the boot time of a specified service port in the target instance are obtained; the boot time of the specified service port and the boot time of the target instance are sent to the first device, so as to determine the boot time of the target instance through the first device based on the boot time of the specified service port and the boot time of the target instance. This method only requires setting a first instance in the cloud resource network to obtain the boot time of the target instance in the cloud resource network, thereby improving the test efficiency of the instance boot time.
[0061] The embodiment of the present invention also provides another method for determining the boot time. This embodiment is implemented on the basis of the above embodiment. This embodiment focuses on describing the specific implementation process of the steps before the step of obtaining the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance in response to receiving the test instruction of the first device, and the specific implementation process of the step of obtaining the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance; specifically includes the following steps:
[0062] Step 501, setting a public IP address for a first instance; wherein the first device is set in a public network outside the cloud resource network; the first instance is connected to the first device through the public IP address;
[0063] Specifically, before conducting the boot time test, first create a first instance in the cloud resource network, and the first instance can be created by a custom image; wherein a public IP address is set in the first instance; in addition, a toolkit for scanning the network status, such as Nmap, can also be installed in the first instance.
[0064] The public IP address includes an elastic public IP address; the first instance establishes an SSH communication connection with the first device through the elastic public IP address.
[0065] Step 502, in response to receiving the test instruction of the first device, obtaining the boot time of the target instance and the start time of the specified service port in the target instance through the intranet address of the target instance;
[0066] Wherein, the first instance and the target instance are both set with an intranet address within the cloud resource network;
[0067] In order to enable the first instance to communicate with the target instance, an intranet address in the cloud resource network can be set in both the first instance and the target instance. Specifically, after receiving the test instruction, the first instance can obtain the boot time of the target instance and the start time of the specified service port in the target instance through the intranet address of the target instance. The data structure for obtaining the boot time of the target instance and the start time of the specified service port in the target instance by the first instance can be:
[0068]
[0069]
[0070] The IP address of the target instance is the public network address of the target instance; 'start_time' is the startup time of the target instance; 'end_time' is the startup time of the specified service port in the target instance. The above data format is json. The data format of the value of the 'record' parameter is a list, in which the information of each target instance required will be arranged in this list.
[0071] In addition, when there are multiple target instances, in order to make the calculated multiple boot times correspond to the target instances, an intranet address in the cloud resource network can be set in each target instance, and the intranet address can also be a private IP address; wherein the intranet address in the cloud resource network set in each target instance corresponds to the unique identifier of the target instance; specifically, after the target instance is powered on, a public network address can be automatically assigned to each target instance, and each public network address is different. In this way, if an abnormality occurs during the test, for example, the boot time of the test is abnormal, and the boot time value is large, it may be necessary to find out which specific target instance has a problem. If the target instance does not set a public network address, and it does not correspond to the unique identifier of the target instance, an internal search is required, and the search process is cumbersome. Therefore, the public network address of the target instance can be matched with the unique identifier of the target instance in advance to facilitate subsequent re-development.
[0072] Step 503, sending the startup time of the designated service port and the startup time of the target instance to the first device, so as to determine the startup time of the target instance based on the startup time of the designated service port and the startup time of the target instance through the first device.
[0073] For further information, see Figure 4Another application scenario diagram of a method for determining boot time is shown; including a public network, a first device in the public network; a cloud resource network, a first instance in the cloud resource network, the cloud resource network includes multiple subnets, each subnet includes a first instance and multiple target instances. The first instance of each subnet is connected to the first device in the public network. The above cloud resource network can be understood as an intranet; wherein the first instance can communicate with multiple target instances in the cloud resource network.
[0074] The intranet address of the first instance and the intranet address of the target instance belong to the same subnet segment.
[0075] In order to enable the first instance to communicate with the target instance through the intranet address in the cloud resource network, the intranet address of the first instance and the intranet address of the target instance are set to belong to the same subnet segment; specifically, when multiple target instances are started in batches under the same subnet, for example, when 10 target instances are started, the first instance and each target instance can be set with a public network address, and the public network address can correspond to the unique identifier of the target instance, and the startup time of each target instance and the startup time of the designated service port of the target instance can be recorded through the first instance. When all target instances are started, the specific startup time is calculated according to actual needs. Since the intranet address of the first instance and the intranet address of the target instance belong to the same subnet segment, multiple subnets can be set in the cloud resource network, and a first instance can be set in each subnet. At the same time, the first instances in multiple subnets are used to test the startup time of multiple target instances in each subnet. Each subnet does not affect each other, which further improves the test efficiency of the instance startup time.
[0076] In the above method, a first instance can be created in the cloud resource network in advance, a public IP address can be set for the first instance, and it can communicate and connect with the first device on the public network; the power-on time of the target instance in the cloud resource network and the start time of the specified service port in the target instance are obtained through the first instance, and then the power-on time of the target instance is obtained; and the intranet address set for the first instance and the intranet address set for the target instance belong to the same subnet segment, ensuring that the first instance and the target instance are in the same network; in this method, you only need to bind an elastic public IP address to the first instance to obtain the power-on time of one or more target instances under the network of the first instance, without occupying a large amount of elastic IP resources, thereby improving the test efficiency of the instance power-on time.
[0077] In addition, compared with the manual testing method, the test efficiency of the instance startup time is improved, and the accuracy of the test results is improved; compared with the PING testing method, the survey timeout setting is avoided, the test efficiency is improved, and the accuracy of the test results is improved.
[0078] Corresponding to the above method embodiment, this embodiment provides a device for determining boot time, which is arranged in a first device; the first device is communicatively connected with a first instance in a cloud resource network; Figure 5 As shown, the device comprises:
[0079] A first acquisition module 51 is used to acquire the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance through the first instance;
[0080] The determination module 52 is used to determine the startup time of the target instance based on the startup time of the designated service port and the startup time of the target instance.
[0081] The present invention provides a device for determining boot time, which obtains the boot time of a target instance in a cloud resource network and the startup time of a specified service port in the target instance through a first instance that is connected to a first device in communication; and determines the boot time of the target instance based on the startup time of the specified service port and the boot time of the target instance. This method sets a first instance in the cloud resource network, obtains the boot time of an instance inside the cloud resource network and the startup time of a specified service port in the instance through the first instance, transmits these parameters to the first device, and then obtains the boot time of the instance in the cloud resource network; in the above method, only the first instance needs to occupy IP resources when communicating with the first device. When it is necessary to obtain the boot time of multiple instances in the cloud resource network, it is not necessary to occupy a large amount of IP resources. The test of instance boot time is no longer limited by IP resources, which improves the test efficiency.
[0082] Furthermore, the above-mentioned first device is set in a public network outside the cloud resource network; the above-mentioned first instance is set with a public IP address; the above-mentioned first device is communicated with the first instance through the public IP address; the above-mentioned first acquisition module is also used to: receive the power-on time of the target instance in the cloud resource network sent by the first instance through the public IP address, and the startup time of the specified service port in the target instance.
[0083] Furthermore, the public IP address includes an elastic public IP address; the first device establishes an SSH communication connection with the first instance through the elastic public IP address.
[0084] Furthermore, the determination module is also used to: calculate the time difference between the startup time of the designated service port and the startup time of the target instance; and determine the time difference as the startup time of the target instance.
[0085] Furthermore, the target instance includes multiple targets; the device is also used to calculate an average boot time of the multiple target instances.
[0086] The device for determining the boot time provided in the embodiment of the present invention has the same technical features as the method for determining the boot time provided in the above embodiment, and therefore can solve the same technical problems and achieve the same technical effects.
[0087] Corresponding to the above method embodiment, this embodiment further provides a device for determining boot time, which is arranged on a second device; a first instance in a cloud resource network is running on the second device; the first instance is in communication connection with the first device; Figure 6 As shown, the device comprises:
[0088] A second acquisition module 61 is used to obtain the boot time of the target instance in the cloud resource network and the start time of the specified service port in the target instance in response to receiving the test instruction of the first device;
[0089] The sending module 62 is used to send the startup time of the specified service port and the startup time of the target instance to the first device, so as to determine the startup time of the target instance through the first device based on the startup time of the specified service port and the startup time of the target instance.
[0090] The present invention provides a device for determining boot time, which, in response to receiving a test instruction from a first device, obtains the boot time of a target instance in a cloud resource network and the startup time of a specified service port in the target instance; sends the startup time of the specified service port and the boot time of the target instance to the first device, so as to determine the boot time of the target instance through the first device based on the startup time of the specified service port and the boot time of the target instance. This method only requires setting a first instance in the cloud resource network to obtain the boot time of the target instance in the cloud resource network, thereby improving the test efficiency of the instance boot time.
[0091] Furthermore, the above-mentioned device also includes a setting module, which is used to set a public IP address for the first instance; wherein the first device is set in a public network outside the cloud resource network; the first instance is communicated with the first device via the public IP address.
[0092] Furthermore, the public IP address includes an elastic public IP address; the first instance establishes an SSH communication connection with the first device through the elastic public IP address.
[0093] Furthermore, the first instance and the target instance are both provided with an intranet address within the cloud resource network; the second acquisition module is also used to obtain the boot time of the target instance and the startup time of the specified service port in the target instance through the intranet address of the target instance.
[0094] Furthermore, the intranet address of the first instance and the intranet address of the target instance belong to the same subnet segment.
[0095] The device for determining the boot time provided in the embodiment of the present invention has the same technical features as the method for determining the boot time provided in the above embodiment, and therefore can solve the same technical problems and achieve the same technical effects.
[0096] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for determining the boot time consumption.
[0097] See also Figure 7 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above-mentioned method for determining the boot time consumption.
[0098] Further, Figure 7 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0099] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0100] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.
[0101] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned method for determining the boot time consumption.
[0102] The computer program product of the method, device and electronic device for determining the boot time provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.
[0103] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0104] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0105] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0106] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0107] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for determining boot time, characterized in that: The method is applied to a first device; the first device is communicatively connected to a first instance in a cloud resource network; the first device is arranged in a public network outside the cloud resource network; The first instance is provided with a public IP address; The first device is connected to the first instance through the public IP address; the method includes: Obtaining, through the first instance, the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance; wherein the first instance installs a component with a network scanning function, and the component is used to scan the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance; Based on the startup time of the designated service port and the startup time of the target instance, the startup time of the target instance is determined.
2. The method according to claim 1, characterized in that The step of obtaining the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance through the first instance includes: The first instance receives, through the public IP address, the boot time of the target instance in the cloud resource network and the start time of the designated service port in the target instance.
3. The method according to claim 2, characterized in that The public IP address includes an elastic public IP address; the first device establishes an SSH communication connection with the first instance through the elastic public IP address.
4. The method according to claim 1, characterized in that The step of determining the startup time of the target instance based on the startup time of the designated service port and the startup time of the target instance includes: The startup time of the designated service port and the time difference between the startup time of the target instance are calculated; and the time difference is determined as the startup time consumption of the target instance.
5. The method according to claim 4, characterized in that The target instances include multiple ones; the method further includes: calculating an average boot time of the multiple target instances.
6. A method for determining boot time, characterized in that: The method is applied to a second device; a first instance in a cloud resource network is running on the second device; the first instance is connected to the first device in communication; wherein the first instance is installed with a component having a network scanning function, the component being used to scan the boot time of a target instance in the cloud resource network and the start time of a specified service port in the target instance; the first device is set in a public network outside the cloud resource network; the first instance is set with a public IP address; the first device is connected to the first instance in communication via the public IP address; the method comprises: In response to receiving a test instruction from the first device, obtaining a startup time of a target instance in the cloud resource network and a startup time of a specified service port in the target instance; The startup time of the designated service port and the startup time of the target instance are sent to the first device, so as to determine the startup time of the target instance based on the startup time of the designated service port and the startup time of the target instance through the first device.
7. The method according to claim 6, characterized in that In response to receiving the test instruction of the first device, before the step of obtaining the power-on time of the target instance in the cloud resource network and the start time of the specified service port in the target instance, the method further includes: A public IP address is set for the first instance; wherein the first device is set in a public network outside the cloud resource network; and the first instance is communicatively connected to the first device via the public IP address.
8. The method according to claim 7, characterized in that The public IP address includes an elastic public IP address; the first instance establishes an SSH communication connection with the first device through the elastic public IP address.
9. The method according to claim 6, characterized in that The first instance and the target instance are both provided with an intranet address within the cloud resource network; The step of obtaining the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance includes: The boot time of the target instance and the start time of the specified service port in the target instance are obtained through the intranet address of the target instance.
10. The method according to claim 9, characterized in that The intranet address of the first instance and the intranet address of the target instance belong to the same subnet segment.
11. A device for determining boot time, characterized in that: The apparatus is arranged on a first device; the first device is communicatively connected to a first instance in a cloud resource network; the first device is arranged in a public network outside the cloud resource network; The first instance is provided with a public IP address; The first device is connected to the first instance through the public IP address; the apparatus comprises: A first acquisition module, used to acquire, through the first instance, the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance; wherein the first instance installs a component with a network scanning function, and the component is used to scan the boot time of the target instance in the cloud resource network and the startup time of the specified service port in the target instance; The determination module is used to determine the startup time of the target instance based on the startup time of the designated service port and the startup time of the target instance.
12. A device for determining boot time, characterized in that: The device is arranged on a second device; a first instance in a cloud resource network is run on the second device; the first instance is connected to the first device in communication; wherein the first instance is installed with a component having a network scanning function, the component being used to scan the boot time of a target instance in the cloud resource network and the start time of a specified service port in the target instance; the first device is arranged in a public network outside the cloud resource network; the first instance is provided with a public IP address; the first device is connected to the first instance in communication via the public IP address; the device comprises: A second acquisition module, configured to acquire, in response to receiving a test instruction from the first device, a startup time of a target instance in the cloud resource network and a startup time of a specified service port in the target instance; A sending module is used to send the startup time of the designated service port and the startup time of the target instance to the first device, so as to determine the startup time of the target instance based on the startup time of the designated service port and the startup time of the target instance through the first device.
13. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for determining the boot time as described in any one of claims 1 to 5 or claims 6 to 10.
14. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor to implement the method for determining the boot time as described in any one of claims 1 to 5 or claims 6 to 10.
Citation Information
Patent Citations
Cloud computing system, load balancing system, load balancing method and device
CN103905473A
Network equipment starting time testing method and testing control bench
CN106100939A
Cloud platform service cluster, creating method and device
CN108737468A