Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present application, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. are used for indicating the orientation or positional relationship based on the orientation or positional relationship shown in the drawings or the orientation or positional relationship which the present invention product is usually put into use, it is only for convenience of describing the present application and simplifying the description, but it is not intended to indicate or imply that the referred device or element must have a specific orientation, be constructed in a specific orientation and be operated, and thus, should not be construed as limiting the present application.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
The method comprises the steps that a network is timely and effectively detected, technicians of most network service providers develop a test script program and deliver the test script program to users, the users run the test script program on a client side and feed back specific test data to the technicians, and after the technicians analyze the test data, a network detection result is obtained, so that the network is optimized or network problems are positioned according to the network detection result.
However, the existing test script can only obtain data of the network quality of the client preliminarily, and cannot clearly obtain test data of the network communication condition between the client 20 and the CDN, so that the detection of the network is relatively blind, and the validity of the detection is greatly reduced.
Meanwhile, the types of the clients are diversified, for example, the clients can be computers, mobile phones, tablets and the like, the participants of the current network environment are in a state of coexistence of multiple types of terminals, and the operating systems of the clients of different types have different degrees of limitation, so that the cost of developing and maintaining test script programs aiming at different platforms and versions is extremely high; meanwhile, because the user of the client is usually a common user and only has little or no network test related knowledge and experience, the communication time consumption cost is very high, on one hand, the test data is not obtained in time, and finally the test data cannot be analyzed in time to detect the network in time, so that the optimization operation is performed on the detection result, and on the other hand, the user experience caused by the method is very poor.
In view of this, embodiments of the present application provide a network detection method, an apparatus, a test host, and a storage medium, which can improve effectiveness and timeliness of network detection.
Referring to fig. 1, fig. 1 shows an application scenario diagram provided by an embodiment of the present application, in fig. 1, a client 20 is communicatively connected to servers 30 in multiple CDN rooms, each server in each CDN room constitutes one CDN, and a test host 10 is also communicatively connected to the client 20 at the same time, in fig. 1, only two servers 30 are exemplarily shown in each CDN room, in an actual application scenario, multiple servers 30 exist in each CDN room, when a user accesses a service website through the client 20 and is abnormal, the user sends a detection request to the test host through the client 20, the client 20 is controlled to send a first dial test request to a preset test website through the servers 30 in the CDN rooms and to send a second dial test request to the service website, the client 20 finally sends a first result fed back by the preset test website in response to the first dial test request and a second result fed back by the service website in response to the second dial test request to the test host 10, the test host can know the network communication condition between the client 20 and the CDN based on the first result, so that the network can be effectively detected according to the first result and the second result in response to the second dial test request, and the timeliness of the detection is ensured because the whole process does not require manual intervention.
It should be noted that when there are multiple CDN rooms, there are multiple corresponding preset test websites, and for any preset test website, the client 20 accesses the preset test website through a server in the CDN room corresponding to the preset test website, so as to obtain a processing condition of a first dial test request between the client 20 and each CDN room.
In addition, as a specific embodiment, the network service provider may provide a detection website for the user, when the user accesses the detection website through the client 20, the user triggers sending of a detection request to the test host 10, and after the test host 10 receives the detection request, the test host 10 automatically performs network detection according to the first result and the second result. Since the client 20 can send the detection request to the test host 10 only by accessing the detection website, there is no requirement for the device type and the operating system type of the client 20, and only a browser capable of accessing a preset website is installed in the client 20, thereby avoiding the problem of high development and maintenance costs caused by developing and maintaining test scripts of different platforms and different versions for different clients.
The test host 10 may be, but is not limited to, a physical host, a physical server, or a virtual machine capable of implementing the same function as the physical host or the physical server.
The client 20 may be, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a desktop computer, etc.
The server 30 is a computer device located in the CDN room in the CDN network, and may be a network communication device, such as a switch, a router, or the like.
It should be noted that the test host 10 may be any one server 30 in any CDN room, or may be a host that is independent of all CDN rooms and is in communication connection with servers in the CDN rooms, and may be deployed correspondingly according to the requirements of an actual scene, and the specific deployment manner is not limited in the present application.
On the basis of fig. 1, a block schematic diagram of the test host 10 in fig. 1 is further provided in the embodiment of the present application, please refer to fig. 2, and fig. 2 shows a block schematic diagram of the test host 10 provided in the embodiment of the present application.
The test host 10 includes a processor 11, a memory 12, a bus 13, and a communication interface 14. The processor 11 and the memory 12 are connected by a bus 13, and the processor 11 is communicatively connected to the client 20 and the server 30 by a communication interface 14.
The processor 11 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 11. The Processor 11 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
The Memory 12 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Alternatively, the memory 12 may be a storage device built in the processor 11, or may be a storage device independent of the processor 11.
The bus 13 may be an ISA bus, a PCI bus, an EISA bus, or the like. Fig. 2 is represented by only one double-headed arrow, but does not represent only one bus or one type of bus.
On the basis of fig. 1 and fig. 2, an embodiment of the present application provides a flowchart of a network detection method applied to the test host 10 in fig. 1 and fig. 2, please refer to fig. 3, and fig. 3 shows a flowchart of a network detection method provided by an embodiment of the present application, where the method includes the following steps:
step S100, receiving a detection request sent by a client, wherein the detection request is sent after the client accesses a service website abnormally.
In this embodiment, the service website is a website that the user actually needs to access, and the user may access the service website by inputting a website address of the service website in the browser software of the client 20. The detection request is a request sent by the client 20 to the test host 10 for triggering network detection, and as a specific embodiment, the request may be implemented by a user accessing a detection website through browser software of the client 20, and the detection website is a website provided for the user and enabling the user to automatically trigger network detection by accessing the detection website. As another specific implementation, the request may also be implemented by a user clicking a button on a preset web page, for example, after the user accesses the service website abnormally, the user automatically jumps to the preset web page, a detection button is displayed on the preset web page, and the user is prompted to click the detection button to trigger network detection, so as to locate the reason for the abnormal access of the service website.
Step S120, based on the detection request, the client is controlled to send a first dial test request to a preset test website through a server in the CDN, and the client is controlled to send a second dial test request to the service website.
In this embodiment, the preset test website is a website for testing a communication condition between the client 20 and the server 30 in the CDN, the first dial test request is a test request data packet sent by the client 20 to the preset test website through the server in the CDN, the client 20 may be in communication connection with multiple CDNs at the same time, at this time, a preset test website may be set for each CDN in advance, and the client 20 is controlled to send the first dial test request to the corresponding preset test website through the server 30 in each CDN, so as to test the communication condition between the client 20 and the server 30 in each CDN.
In this embodiment, the second dial test request is a test request data packet sent by the client 20 to the service website.
Step S130, receiving a first result, sent by the client, of responding to the first dial test request and fed back by the preset test website.
In this embodiment, the first dial test request finally reaches the test host 10 through the server 30 in the CDN, the test host returns response information for the first dial test request, the response information finally returns to the client 20 through the server 30 in the CDN again, and the client 20 generates the first result according to the response information of the first dial test request. The first result is used for characterizing the response condition of the first dial test request, including but not limited to response information such as response state, response delay and the like.
Step S140, receiving a second result of the service website feedback sent by the client and responding to the second dial testing request.
In this embodiment, the second result is used to characterize a response condition of the second dial testing request, and is generated by the client 20 according to the response information of the second dial testing request fed back by the service website, and the second result includes, but is not limited to, response information such as a response state and a response delay.
Step S150, performing network detection according to the first result and the second result.
In this embodiment, since the first result may reflect a communication status between the client 20 and a server in the CDN, and the second result may reflect a communication status between the client 20 and a service website, the network is detected by synthesizing the first result and the second result, and the network state is further determined according to a result of the network detection, so as to detect a probable cause of a network problem, and help a technician narrow an investigation range.
It should be further noted that, in order to facilitate further automatic analysis, the first result and the second result may also be stored in the database, and a technician may access the first result and the second result in the database and analyze them again to obtain an analysis result of the network detection with more guidance, so as to perform targeted optimization on the network according to the analysis result.
The network detection method provided by the embodiment of the application can know the network communication condition between the client 20 and the CDN based on the first result responding to the first dial test request, so that the network can be effectively detected according to the first result and the second result responding to the second dial test request, meanwhile, the whole process does not need manual intervention, the detection timeliness is ensured, more effective guidance is provided for subsequently positioning network problems according to the detection result, and the difficulty of positioning the network problems is reduced.
On the basis of fig. 2, an embodiment of the present application further provides a specific implementation of network detection, please refer to fig. 4, and fig. 4 show a flowchart of another network detection method provided in the embodiment of the present application, and step S150 includes the following sub-steps:
in the substep S1501, if the first state representation is normal in response to the first dial testing request and the second state representation is overtime in response to the second dial testing request, it is determined that the website analysis of the service website is abnormal.
In this embodiment, the first state represents a response state of the first dial testing request, where values of the response state include normal and timeout, and when the value of the first state is normal, it may be considered that a response of the first dial testing request is returned within a preset duration and correct response data is returned, and when the value of the first state is timeout, it may be considered that the response of the first dial testing request is not returned within the preset duration, and at this time, there are at least the following possible situations: (1) the response of the first dial testing request is not returned within the preset time length, but correct response data are finally returned; (2) the response of the first dial testing request is returned within a preset time length, and wrong response data are finally returned; (3) the response of the first dial testing request is not returned within the preset time length, and finally wrong response data are returned; (4) the response of the first dial test request is not returned within the preset time length, and finally, no response data is returned, where the preset time length may be a preset timeout time length, for example, the preset time length is 5000 milliseconds. The second state is similar to the first state and will not be described herein.
In this embodiment, if the response to the first dial test request is normal, it indicates that the communication between the client 20 and the server 30 in the CDN is normal, and it may be determined that there is no problem in the network of the client 20, and meanwhile, if the response to the second dial test request is overtime, it indicates that the website analysis of the service website is abnormal, so that the problem location range may be narrowed to the reason that the website analysis is abnormal, and the specific location causes the website analysis abnormality.
In sub-step S1502, if the first state representation is overtime in response to the first dial test request and the second state representation is overtime in response to the second dial test request, it is determined that the network communication of the client is abnormal.
In this embodiment, since the communication condition of the server 30 of the SDN for network detection can be guaranteed to be good, otherwise, network detection cannot be performed based on the good condition, in this case, if the first dial test request is overtime and the second dial test request is overtime, it is determined that the network communication of the client is abnormal, and the abnormality may be a network interruption of the client, or a network communication abnormality of the client due to a link fluctuation of the network of the client, or a network abnormality of the client due to other reasons, which finally causes an abnormality in accessing a service website by the client, that is, a problem location range is narrowed to the network of the client, and at this time, a reason for the network abnormality of the client needs to be further investigated.
According to the network detection method provided by the embodiment of the application, the first state in the first result and the second state in the second result are compared, so that whether the website analysis of the service website is abnormal or the client accesses the service website due to the network communication abnormality of the client can be timely located, and the possible reason of the abnormality of the service website can be rapidly located.
In this embodiment, the first result further includes a first time delay in addition to the first state, and the second result further includes a second time delay in addition to the second state, in order to determine the abnormality of other situations as much as possible, the embodiment of the present application further provides another specific implementation manner of network detection, please continue to refer to fig. 4, and step S150 further includes the following sub-steps:
in the substep S1503, if the first state representation is normal in response to the first dial testing request and the second state representation is normal in response to the second dial testing request, the network detection is performed according to the first delay and the second delay.
In this embodiment, the first time delay is used to represent a time length between the time when the client 20 initiates the first dial test request and the time when the client 20 receives the response of the first dial test request, as a specific implementation manner, the client 20 records the initiation time at the time when the client 20 initiates the first dial test request, records the response receiving time at the time when the client receives the response of the first dial test request, where the time length between the response time and the initiation time is the first time delay, and the second time delay is similar to the first time delay, and is not described here again.
If the first dial testing request is normal and the second dial testing request is normal, judging other types of abnormalities according to the first time delay and the second time delay, wherein the other types of abnormalities include, but are not limited to, browser abnormalities of a client, response abnormalities of a service website, network delay abnormalities of the client and the like.
As a specific implementation manner, the method for performing network detection according to the first delay and the second delay may be:
firstly, if the first time delay is smaller than a first preset value and the second time delay is smaller than a second preset value, it is determined that the browser of the client is abnormal.
In this embodiment, the first preset value and the second preset value may be set according to actual scene needs, and the first preset value may be greater than, less than, or equal to the second preset value. If the first time delay is smaller than the first preset value and the second time delay is smaller than the second preset value, it means that the network between the client 20 and the server 30 in the SDN is smooth and the network between the client 20 and the service website is smooth, and it is determined that the browser of the client 20 is abnormal.
Secondly, if the first time delay is smaller than the first preset value and the second time delay is larger than or equal to the third preset value, the response of the service website is judged to be abnormal.
In this embodiment, the third preset value may be set according to actual scene needs. If the first time delay is smaller than the first preset value and the second time delay is larger than or equal to the third preset value, it means that the network between the client 20 and the server 30 in the SDN is smooth and the network between the client 20 and the service website is not smooth, and it is determined that the response of the service website is abnormal.
Thirdly, if the first time delay is larger than or equal to a fourth preset value and the second time delay is larger than or equal to a third preset value, the network delay of the client is judged to be abnormal.
In this embodiment, the fourth preset value may be set according to actual scene needs. If the first time delay is greater than or equal to the fourth preset value and the second time delay is greater than or equal to the third preset value, it means that the network between the client 20 and the server 30 in the SDN is not smooth and the network between the client 20 and the service website is not smooth, and it is determined that the network delay of the client is abnormal.
It should be noted that, according to actual needs, the first result and the second result may further include a client IP address, information related to an Internet Service Provider ISP (ISP) used by the client 20, and the like, so as to perform more comprehensive detection on the network according to the information.
According to the network detection method provided by the embodiment of the application, in addition to the detection of the network according to the first state and the second state so as to judge the reason causing the abnormality of the client accessing the service website, the detection of the network is also carried out according to the first time delay and the second time delay so as to judge the reason causing the abnormality of the client accessing the service website, and the type of the positioned abnormality reason is expanded.
On the basis of fig. 3, an embodiment of the present application further provides a first dial test request sending method when there are multiple CDNs, please refer to fig. 5, where fig. 5 shows a flowchart of another network detection method provided in the embodiment of the present application, and step S120 includes the following sub-steps:
and a substep S1201, based on the detection request, controlling the client to send a first dial test request to each preset test website through a server in the corresponding CDN.
In this embodiment, there are multiple CDNs, the test host 10 is in communication connection with the server 30 in each CDN, each CDN corresponds to one preset test website, and the test host controls the client 20 to send a first dial test request to each preset test website. For example, CDNs include: the number 1 CDN, the number 2 CDN and the number 3 CDN correspond to a preset test website which is as follows: com, slave2.test.com, slave3.test.com, the client 20 accesses slave1.test.com through the server 30 in # 1 CDN, slave2.test.com through the server 30 in # 2 CDN, and slave3.test.com through the server 30 in # 3 CDN.
It should be noted that, by clearly obtaining and knowing the response result from the client 20 to the servers in different CDNs, the line can be optimized and adjusted according to the response result and the region where the user is located and the ISP.
In the network detection method provided by the embodiment of the application, when there are a plurality of CDNs, the first dial test request is sent to each preset test website, so that the network communication condition between the client 20 and each CDN can be known according to the first result of responding to each first dial test request, and thus, more reference data can be provided for technicians, so that the technicians can analyze the network more comprehensively.
In order to perform the corresponding steps in the above embodiments and various possible implementations, an implementation of the network detection apparatus 100 is given below. Referring to fig. 6, fig. 6 is a block diagram illustrating a network detection apparatus 100 according to an embodiment of the present disclosure. It should be noted that the basic principle and the generated technical effect of the network detection apparatus 100 provided in the present embodiment are the same as those of the above embodiments, and for the sake of brief description, no reference is made to this embodiment.
The network detection device 100 may be a stored program stored in the memory 12 in fig. 2, the network detection device 100 includes at least one software functional module which may be stored in the memory 12 in fig. 2 in the form of software or firmware (firmware), and the processor 11 in fig. 2 executes the program after receiving the execution instruction to implement the network detection method.
The network detection device 100 includes a request receiving module 110, a dial test module 120, a response receiving module 130, and a detection module 140.
The request receiving module 110 is configured to receive a detection request sent by a client, where the detection request is sent after an exception occurs when the client accesses a service website.
And the dial test module 120 is configured to control, based on the detection request, the client to send a first dial test request to the preset test website through the server in the CDN, and control the client to send a second dial test request to the service website.
As a specific implementation manner, the number of CDNs is multiple, the test host is in communication connection with a server in each CDN, each CDN corresponds to a preset test website, and the dial test module 120 is specifically configured to: and controlling the client to send a first dial test request to each preset test website through a server in the corresponding CDN based on the detection request.
A response receiving module 130 configured to: receiving a first result which is sent by a client and responds to a first dial test request and fed back by a preset test website; and receiving a second result which is sent by the client and responds to the second dial testing request and fed back by the service website.
The detecting module 140 is configured to perform network detection according to the first result and the second result.
As a specific embodiment, the first result includes a first state, the second result includes a second state, and the detection module 140 is specifically configured to: if the first state representation responds to the first dial testing request normally and the second state representation responds to the second dial testing request overtime, judging that the website analysis of the service website is abnormal; and if the first state representation responses to the first dial test request overtime and the second state representation responses to the second dial test request overtime, judging that the network communication of the client is abnormal.
As a specific embodiment, the first result further includes a first time delay, the second result further includes a second time delay, and the detection module 140 is further specifically configured to: and if the first state representation is normal in response to the first dial testing request and the second state representation is normal in response to the second dial testing request, performing network detection according to the first time delay and the second time delay.
As a specific embodiment, when the detecting module 140 performs the step of performing network detection according to the first delay and the second delay, it is specifically configured to: if the first time delay is smaller than a first preset value and the second time delay is smaller than a second preset value, judging that the browser of the client is abnormal; if the first time delay is smaller than the first preset value and the second time delay is larger than or equal to the third preset value, judging that the response of the service website is abnormal; and if the first time delay is greater than or equal to the fourth preset value and the second time delay is greater than or equal to the third preset value, judging that the network delay of the client is abnormal.
Embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the network detection method as described above.
To sum up, the embodiment of the present application provides a network detection method, an apparatus, a test host and a storage medium, which are applied to a test host, where the test host is in communication connection with both a client and a server in a content delivery network CDN, and the method includes: receiving a detection request sent by a client, wherein the detection request is sent based on the abnormity of the client accessing a service website; based on the detection request, the client is controlled to send a first dial test request to a preset test website through a server in the CDN, and the client is controlled to send a second dial test request to a service website; receiving a first result which is sent by a client and responds to a first dial test request and fed back by a preset test website; receiving a second result which is sent by the client and responds to the second dial testing request and fed back by the service website; and performing network detection according to the first result and the second result. Compared with the prior art, the network communication condition between the client 20 and the CDN can be known based on the first result responding to the first dial testing request, so that the network can be effectively detected according to the first result and the second result responding to the second dial testing request, and meanwhile, the timeliness of detection is guaranteed as the whole process does not need manual intervention.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.