Summary of the invention
In view of the above problems, it is proposed that the embodiment of the present invention is to provide one to overcome the problems referred to above or at least in part
Solve detection method and the detection device of corresponding a kind of server of a kind of server of the problems referred to above, with authentication server institute
The message pushed the most successfully pushes all clients being connected with this server, thus ensures server stable operation.
In order to solve the problems referred to above, the embodiment of the invention discloses the detection method of a kind of server, including: pre-build
Length between server with each client is connected;
Detect the described long target port connecting correspondence, determine the port number of correspondence;
By described target port to described client push characteristic message;
Foundation determines the client terminal quantity being properly received described characteristic message to the detection of described target port;
Judge the stability of described server according to described port number and described client terminal quantity, generate corresponding detection
Result.
Optionally, the length set up between server with each client is connected, including:
By execution order, start local target port service;
Service based on described target port, create the length between described server and client according to the concurrent quantity of input
Connecting, wherein, described long connection has target port one to one.
Optionally, detect the described long target port connecting correspondence, determine the port number of correspondence, including:
Add up the first sum of the target port that described server provides, using described first sum as described port number
Amount;Or,
Detect each client and whether there is described target port, and add up that to have the client of described target port corresponding
Second sum, using described second sum as described port number.
Optionally, foundation determines the client terminal quantity being properly received described characteristic message to the detection of described target port,
Including:
Detect the data form of the message that each target port receives and the target data format match preset;
When described data form and the target data format match preset, determine that the client of correspondence is properly received described
Characteristic message;
The client being properly received described characteristic message is added up, determines described client terminal quantity.
Optionally, the described stability judging described server according to described port number and described client terminal quantity, bag
Include:
Calculate the business of described number clients and described port number, determine the propelling movement success rate of server;
Judge whether described propelling movement success rate reaches default target propelling movement rate;
When described propelling movement success rate reaches target propelling movement rate, it is determined that described server is stable;And pushing into
When power reaches target propelling movement rate, it is determined that described server fluctuation of service.
Optionally, also include: when described data form is with the target data format mismatching preset, determine the visitor of correspondence
Family end receives the failure of described characteristic message;The client receiving described characteristic message failed is added up, determines and push unsuccessfully
Quantity;
Wherein, the described stability judging described server according to described port number and described client terminal quantity, including:
Verify described that push unsuccessfully quantity and described client terminal quantity and whether reach described port number;If described propelling movement unsuccessfully counts
Amount and described client terminal quantity and the most described port number, it is determined that the loss quantity that described characteristic message is corresponding, and
Judge described server fluctuation of service.
Optionally, also include: judge whether described port number reaches described concurrent quantity;Reach at described port number
During described concurrent quantity, generate the testing result of described server successful connection;Or, the most described at described port number
During concurrent quantity, generate the testing result of described server connection failure.
Optionally, also include: use the per second concurrent quantity of described concurrent quantity and input, determine correspondence concurrent time
Between;
Wherein, when described port number is not up to described concurrent quantity, generate the detection of described server connection failure
As a result, including: when described port number is not up to described concurrent quantity, it is judged that whether current time at described concurrent time model
In enclosing;If current time is in the range of described concurrent time, then continue executing with the length created between described server and client
The step connected;Otherwise, perform to generate the step of the testing result of described server connection failure.
Optionally, after the length created between described server and client is connected, also include: record described long connection
Corresponding establishment number of times;
Wherein, when described port number is not up to described concurrent quantity, generate the detection of described server connection failure
As a result, including: when described port number is not up to described concurrent quantity, it is judged that whether described establishment number of times reaches preset time
Number threshold value;When creating number of times and not arriving frequency threshold value, continue executing with the length creating between described server and client and be connected
Step;When creating sub-quantity and reaching described frequency threshold value, perform the testing result of the described server connection failure of generation
Step.
The embodiment of the invention also discloses the detection device of a kind of server, including:
Connection establishment module, for pre-building that the length between server with each client is connected;
Port number determines module, for detecting the described long target port connecting correspondence, determines the port number of correspondence;
Message pushing module, is used for by described target port to described client push characteristic message;
Client terminal quantity determines module, is properly received described characteristic message according to determining the detection of described target port
Client terminal quantity;
Judgement of stability module, for judging the steady of described server according to described port number and described client terminal quantity
Qualitative, generate corresponding testing result.
Optionally, described connection establishment module, including:
Miniport service promoter module, for by execution order, starting local target port service;
Connect and create submodule, for servicing based on described target port, create described clothes according to the concurrent quantity of input
Length between business device and client is connected, and wherein, described long connection has target port one to one.
Optionally, described port number determines module, specifically for adding up the of the target port that described server provides
One sum, using described first sum as described port number;Or, detect whether each client has described target port,
And add up and there is the second sum that the client of described target port is corresponding, using described second sum as described port number.
Optionally, described client terminal quantity determines module, including:
Pattern matched submodule, for detecting the data form of the message that each target port receives and the mesh preset
Mark pattern matched;
First determines submodule, for, during when described data form and the target data format match preset, determining correspondence
Client be properly received described characteristic message;
First statistics submodule, for adding up the client being properly received described characteristic message, determines described visitor
Family terminal number amount.
Optionally, described judgement of stability module, including:
Calculating sub module, for calculating the business of described number clients and described port number, determines the propelling movement success of server
Rate;
Judge submodule, for judging whether described propelling movement success rate reaches default target propelling movement rate;And in described propelling movement
When success rate reaches target propelling movement rate, it is determined that described server is stable;And reach target propelling movement rate pushing success rate
Time, it is determined that described server fluctuation of service.
Optionally, also include:
Push and unsuccessfully determine module, for when described data form is with the target data format mismatching preset, determining
Corresponding client receives the failure of described characteristic message;
Push unsuccessfully quantity and determine module, the client receiving described characteristic message failed is added up, determines propelling movement
Failure quantity;
Wherein, described judgement of stability module, including:
Checking submodule, for verifying described that pushes unsuccessfully quantity and described client terminal quantity and whether reaching described end
Mouth quantity;
Loss determines submodule, for pushing unsuccessfully quantity and described client terminal quantity and the most described port described
During quantity, determine the loss quantity that described characteristic message is corresponding, and judge described server fluctuation of service.
Optionally, also include:
Concurrent judge module, is used for judging whether described port number reaches described concurrent quantity;
Connect testing result generation module, for when described port number reaches described concurrent quantity, generate described service
The testing result of device successful connection;Or, when described port number is not up to described concurrent quantity, generates described server and connect
Failed testing result.
Optionally, also include:
Concurrent time determines module, for using the per second concurrent quantity of described concurrent quantity and input, determines correspondence
Concurrent time;
Time sentences module, for when described port number is not up to described concurrent quantity, it is judged that whether current time is in institute
In the range of stating concurrent time;If current time is in the range of described concurrent time, then triggers described connection establishment module and continue to hold
Row creates the long step being connected between described server and client;Otherwise, described connection testing result generation module is triggered
Perform to generate the step of the testing result of described server connection failure.
Optionally, also include:
Create number of times logging modle, for recording the described long establishment number of times connecting correspondence;
Create number of times judge module, for when described port number is not up to described concurrent quantity, it is judged that described establishment time
Whether number reaches preset frequency threshold value;When creating number of times and not arriving frequency threshold value, trigger described connection establishment module and continue
Perform the long step being connected creating between described server and client;When creating number of times and reaching described frequency threshold value, touch
Send out connection testing result generation module described and perform to generate the step of the testing result of described server connection failure.
The embodiment of the present invention includes advantages below:
First, the embodiment of the present invention by connecting corresponding target port detect long, determine server actual with
Client is set up and long is connected corresponding port number, and is properly received the client that characteristic message that this server pushed is corresponding
Terminal number amount, such that it is able to according to this port number and the stability of client terminal quantity Analysis server, as by judging this client
Whether terminal number amount reaches port number is carried out the message that authentication server pushed and the most successfully pushes the institute being connected with this server
There is a client, thus solve in existing server test scheme the message that pushed of authentication server the most successfully to push
The problem of all clients being connected with this server.
Secondly, the present invention implements according to port number and the stability of client terminal quantity Analysis server, and to generate
Corresponding testing result, thus meet the testing requirement of server so that technical staff can determine this clothes based on testing result
The ruuning situation of business device, in order to technical staff is optimized process to this server, it is ensured that server stable operation, Jin Erke
To improve stability and the reliability of server.
Detailed description of the invention
Understandable for enabling the above-mentioned purpose of the present invention, feature and advantage to become apparent from, real with concrete below in conjunction with the accompanying drawings
The present invention is further detailed explanation to execute mode.
One of core idea of the embodiment of the present invention is, by detecting the long target port connecting correspondence, really
Determine the port number that the actual connection long with client foundation of server is corresponding, and be properly received the feature that this server is pushed
The client terminal quantity that message is corresponding, such that it is able to according to this port number and the stability of client terminal quantity Analysis server, as
By judge this client terminal quantity whether reach port number come the message that authentication server pushed the most successfully push with should
All clients that server connects, thus solve in existing server test scheme cannot disappearing of being pushed of authentication server
The problem that breath the most successfully pushes all clients being connected with this server.
With reference to Fig. 1, it is shown that the flow chart of steps of the detection method embodiment of a kind of server of the present invention, the most permissible
Comprise the steps:
Step 102, pre-builds that the length between server with each client is connected.
Concrete, server, to client push message then needs to set up long connection with client in advance to actively.Example
As, test platform can start local target port service by order executive mode, such that it is able to based on this target port
Service-creation server and being connected with long between client.After setting up long connection, server is having message needs transmission visitor
During the end of family, client can be transmitted the message to, such that it is able to avoid frequently communicating with short connection by the link that this length connects
Socket (Socket) problem caused, can avoid owing to Socket establishment causes asking of the wasting of resources frequently simultaneously
Topic.
It should be noted that long connection may refer to connect at one to continuously transmit multiple packet, such as service
Set up between device with client and maintain a TCP to be connected, chaining the business that can transmit various reality based on this TCP.
Step 104, detects the described long target port connecting correspondence, determines the port number of correspondence.
After each client sets up long connection with server, server can provide this length to connect correspondence to this client
Target port, in order to can carry out data transmission based on this target port.Therefore, the present embodiment is built with client at server
After vertical long connection, the quantity of the target port of establishment can be determined, i.e. by the target port that long connection is corresponding be detected
Determine the port number that target port is corresponding.Wherein, this port number may be used for characterizing server reality and client foundation
Length connects corresponding connection quantity, and may be used for characterizing the number that the actual client that connect long with server foundation is corresponding
Amount.
Step 106, by described target port to described client push characteristic message.
After setting up long connection with client, server can be by target port to client push message, as passed through
Target port is actively to connected all client push characteristic message, and this feature message can include required for server
The information pushed.
Step 108, foundation determines the client terminal quantity being properly received described characteristic message to the detection of described target port.
The embodiment of the present invention at server after client push characteristic message, can be by each target port be connect
The message received detects, and determines whether the client that this target port is corresponding can be successfully received the spy that server is pushed
Levy message.Such as, by the checking message that received of target port whether by the characteristic message pushed, such that it is able in target
When message received by port is characterized message, determine that the client of correspondence can receive the message that server is pushed,
The i.e. successful client push message corresponding to this target port of server;When the message received by target port is not feature
During message, it may be determined that corresponding client receives this feature message failure, i.e. server to client corresponding to this target port
End PUSH message failure.Count for the client being successfully received characteristic message, may thereby determine that and actually receive
To the client terminal quantity that the client of characteristic message is corresponding.
Step 110, judges the stability of described server according to described port number and described client terminal quantity, and it is right to generate
The testing result answered.
The present embodiment can connect corresponding port number based on the length that server reality be set up and analyze this server
Stability, and generate correspondence testing result.Wherein, this testing result can include the ginseng that each performance indications of server are corresponding
Number information, specifically may include that port number, client terminal quantity, target port name, such as port 8000 etc..Such as, when successfully connecing
When receiving the port number that client terminal quantity corresponding to recommendation message reaches the actual long connection correspondence set up, it may be determined that service
Device successfully to all client push message being connected with it, and then can may determine that this server stable operation;Or,
Use client terminal quantity and the propelling movement success rate of port number calculation server, calculate number clients with as described in port number
Business, and using calculated business as the propelling movement success rate of server;Judge whether this propelling movement success rate reaches default mesh
Mark propelling movement rate, thus when pushing the target propelling movement rate that success rate reaches default, it is possible to determine that this server stable operation;Pushing away
Send the target propelling movement rate that success rate is not up to preset, it is possible to determine that described server fluctuation of service.This target propelling movement rate is permissible
Properties of product according to server require to determine, this is not specifically limited by the embodiment of the present invention.
The embodiment of the present invention can detect by the long target port connecting correspondence, determines server reality and visitor
Family end is set up and long is connected corresponding port number, and is properly received the client that characteristic message that this server pushed is corresponding
Quantity, and according to this port number and the stability of client terminal quantity Analysis server, as by judging that this client terminal quantity is
No reach port number, it may be determined that whether server can be successfully to all client push message being connected with it, i.e.
The message that authentication server is pushed the most successfully pushes all clients being connected with this server, solves existing test
Existing server test scheme the authentication server message that pushed cannot the most successfully push and be connected with this server
The problem of all clients.
Additionally, implementation basis port number of the present invention and the stability of client terminal quantity Analysis server, and generate correspondence
Testing result, thus meet the testing requirement of server so that technical staff can determine this server based on testing result
Ruuning situation, in order to technical staff is optimized process to this server, it is ensured that server stable operation, and then can carry
The stability of high server and reliability.
With reference to Fig. 2, it is shown that the flow chart of steps of the detection method embodiment of the another kind of server of the present invention, specifically may be used
To comprise the steps:
Step 202, by execution order, starts local target port service.
As a concrete example of the present invention, such as test platform can start this locality by the way of order performs
Target port services, to be connected based on long between this target port service-creation server and client.Such as, test platform exists
When the order that user issues being detected, perform this order, thus start 8000 miniport service of this locality, to be taken by 8000 ports
Business is set up long connection, i.e. triggers and sets up the long program connected.Wherein, 8000 is port numbers, may be used for identifying long connection correspondence
Miniport service.
Step 204, services based on described target port, creates described server and client according to the concurrent quantity of input
Between long connection.
In the embodiment of the present invention, test platform, can be according to user's input after starting local target port service
The length that concurrent quantity or the concurrent quantity pre-set create between server and client is connected.Wherein, each client
With long connection the set up between server, there is target port one to one;Concurrent quantity can be used to indicate that server with
Client sets up the long concurrent sum connecting correspondence.
In the concrete application that the present invention implements, test event is mainly based on real time propelling movement message, task, in control
In system, manager needs the real time data in current collection client in the heart, needs client response at once.At authentication server
The performance that services of propelling movement (gopush) and during stability, the test platform such as such as " locust " (Locustio) can be by such as
The computer programming languages such as Python write client (Client) program, as by writing Websocket_
Client.py program realizes growing push server gopush_server connection, and by sending heartbeat packet to guarantee chain
The effectiveness connect.Wherein, long establishment program Webscoket_client.py connected can be by loading according to Websocket
Third party's class libraries that agreement is provided, such that it is able to call the Websocket.Create_connection side of third party's class libraries
Method instantiation ws so that client can be passed through While (true) after setting up long connection with server (Server) and wait
The PUSH message of upstream, it is possible to receive PUSH message with result=ws.recv ().It should be noted that Locust is one
Individual distributed terminator testing tool easy to use, is mainly used to website is carried out Load pressure test;Locust can use
Python writes the code of modelling customer behavior, such that it is able to avoid configuring loaded down with trivial details problem, and distributed expandable, Ke Yizhi
Hold millions of users.
Specifically, test platform can start 8000 local miniport service by command line mode, as run
(Run) when, 8000 miniport service running order to start this locality are performed, to call long connection by 8000 miniport service
Establishment program Webscoket_client.py;And input the Internet at simulant-client pressing machine place in a browser
Agreement (Internet Protocol, IP) address such as URL (Uniform Resource Locator, URL):
8089, and need to set up the long the most total and per second number of concurrent connecting correspondence, such that it is able to according to the concurrent sum of input
Concurrent test, i.e. instantiation Webscoket_client.py program is carried out, it is achieved that height creates clothes concomitantly with number of concurrent per second
Length between business device and client is connected.Such as, if desired testing service device and 10,000 clients set up long connection, then user
Can input concurrent quantity at test platform is 10,000 and concurrent quantity per second is 1000, so that test platform is according to per second
The establishment speed of concurrent quantity 1000 is set up 10,000 long connections, i.e. this server and 10000 clients and is set up long connection.
Step 206, detects the described long target port connecting correspondence, determines the port number of correspondence.
In a preferred embodiment of the invention, detect the described long target port connecting correspondence, determine the end of correspondence
Mouth quantity, including: add up the first sum of the target port that described server provides, using described first sum as described port
Quantity;Or, detect whether each client has described target port, and add up the client correspondence with described target port
Second sum, using described second sum as described port number.
Specifically, the sum of the target port that test platform can be provided by statistical server, determine this service
The actual long port sum connecting correspondence set up of device;Can also be by each client be carried out Port detecting, with detection
Whether each client has a target port, and detecting that a certain client counts when having this target port,
Such that it is able to count, there is the client sum that the client of this target port is corresponding, using this client sum as server
The actual long port sum connecting correspondence set up.Such as, in conjunction with above-mentioned example, if detecting, server provides 9999
8000 serve ports, then may determine that this server and 9999 clients establish long connection.
Therefore, the present invention implements the concurrent quantity that can also need to set up by judging this port number whether to reach, and comes
Determine that server is actual and set up long situation about connecting.Optionally, the detection method of this server also includes: judge described port number
Whether amount reaches described concurrent quantity, thus when described port number reaches described concurrent quantity, as being successfully established service
After long connection between device with the required all clients being connected, generate the testing result of server successful connection;And,
When described port number is not up to described concurrent quantity, as the long connection between server with the required client being connected is deposited
When failed, generate the testing result of described server connection failure.
Optionally, the embodiment of the present invention can also use the per second concurrent quantity of this concurrent quantity and input, determines correspondence
Concurrent time;Thus when port number is not up to described concurrent quantity, it can be determined that current time whether described concurrently
In time range, if current time is in the range of described concurrent time, then continue executing with establishment described server and client it
Between the long step connected, i.e. jump back to step 204 and perform;Otherwise, perform to generate the detection knot of described server connection failure
The step of fruit.With the per second concurrent quantity of input, the present embodiment determines that permission server creates long connection by concurrent quantity corresponding
Concurrent time, i.e. the concurrency performance of server can be detected, thus improve the accuracy of detection, it is ensured that server is steady
Qualitative and reliability.
In a preferred embodiment of the invention, it is also possible to be connected in the length created between described server and client
Afterwards, record current server sets up the long establishment number of times connecting correspondence;Thus port number is when being not up to described concurrent quantity,
May determine that whether current establishment number of times reaches preset frequency threshold value;And then frequency threshold value can not arrived creating number of times
Time, continue executing with the long step being connected creating between described server and client, i.e. jump back to step 204 and perform;And,
When creating sub-quantity and reaching frequency threshold value, perform to generate the step of the testing result of this server connection failure.The present embodiment
By the frequency threshold value pre-set, such that it is able to limiting server creates the long number of times connected, it is to avoid constantly execution creates long
The step that connects and cause the problem of detection time length, thus improve detection efficiency.
Step 208, after client push characteristic message, is properly received according to determining the detection of described target port
The client terminal quantity of described characteristic message.
Optionally, the embodiment of the present invention at server after client push characteristic message, can by detection destination end
The data form of the message received by Kou whether with the pattern matched of characteristic message, whether determine the client of correspondence
Receive the characteristic message that server is pushed.
In a preferred embodiment of the invention, it is properly received described spy according to the detection of described target port is determined
Levy the client terminal quantity of message, specifically may include that the data form detecting the message that each target port receives and preset
Target data format match;When the data form of the message that target port receives is with the target data format match preset,
May determine that the client of correspondence is successfully received characteristic message, and then can be by the client being properly received this feature message
End is added up, and determines client terminal quantity;The data form of the message received when target port and the target data lattice preset
When formula is not mated, it may be determined that corresponding client receives the failure of described characteristic message, and then can be by receiving this feature
The client of message failure is added up, and determines and pushes unsuccessfully quantity.
Such as, if the data form pre-setting the server message to client push is all the data of a kind of lightweight
DIF, such as JavaScript object representation (JavaScript Object Notation, JSON) data form, then surveys
Whether examination platform can be that JSON goes here and there by the message received by detection target port, determines the client that this target port is corresponding
Whether end can receive the characteristic message that server is pushed.When detecting that target port corresponding to a certain client is received
To message be JSON string time, can based on this client generate one receive push successfully correspondence mark, as identify PASS;
When detecting that the message received by the target port that a certain client is corresponding is not JSON string or for time empty, can be based on this
Client generates one and receives the mark pushing unsuccessfully correspondence, as identified False, and then can be by the number of statistics mark PASS
Amount determines and is properly received the client terminal quantity that characteristic message is corresponding, determines this propelling movement of reception by the quantity of statistics mark False
Quantity corresponding to the failed client of characteristic message, i.e. determine and push unsuccessfully quantity.
Step 210, judges the stability of described server according to described port number and described client terminal quantity, and it is right to generate
The testing result answered.
The embodiment of the present invention can use port number to determine the actual long quantity connected set up of server, such that it is able to
Need when determining this server push characteristic message this feature message is sent to how many clients, the end i.e. determined simultaneously
Mouth quantity;And detected client terminal quantity determines that how many clients are successfully received the spy of propelling movement after can using propelling movement
Levy message, and use the propelling movement failure quantity detected to determine that a how many client receives this feature message failure, Jin Erke
To use the stability of these detection data analytics server, and generate the testing result of correspondence.This testing result is recorded
Data can include port number, client terminal quantity, propelling movement failure quantity, push success rate, push mortality, concurrent quantity,
Any of which such as concurrent time, concurrent quantity per second or several parameter information, this is not restricted by the embodiment of the present invention.
In a preferred embodiment of the invention, described clothes are judged according to described port number and described client terminal quantity
The stability of business device, may include that checking is described that pushes unsuccessfully quantity and described client terminal quantity and whether reaches described end
Mouth quantity;Unsuccessfully quantity and described client terminal quantity and the most described port number is pushed, it is determined that described spy if described
Levy the loss quantity that message is corresponding, and judge described server fluctuation of service.
Concrete, the embodiment of the present invention can by calculate pushes unsuccessfully quantity and described client terminal quantity and, sentence
Whether the message that disconnected server is pushed exists loss;When push unsuccessfully quantity and described client terminal quantity and less than port number
During amount, it may be determined that the characteristic message of this server push exists Loss, use port number to deduct and push unsuccessfully quantity
With described client terminal quantity and, the quantity that this feature information drop-out is corresponding can be obtained, i.e. determine that described characteristic message is corresponding
Loss quantity, and may determine that this server fluctuation of service, need it is optimized, to improve the steady of this server
Qualitative and reliability, it is to avoid the problem that quantity is lost.When push unsuccessfully quantity and described client terminal quantity and equal to port number
Amount, can the characteristic message of this server push not lose, and then can determine this server by pushing success rate
Stability, as determined this server stable operation when pushing success rate and reaching target propelling movement rate.
The embodiment of the present application, after being analyzed the stability of server, generates the testing result of correspondence, with convenient
Technical staff affects the factor of this server stable operation based on this Analysis of test results, such that it is able to facilitate technical staff for
This server is optimized, and improves the optimization efficiency of server, it is ensured that server stable operation.
It should be noted that for embodiment of the method, in order to be briefly described, therefore it is all expressed as a series of action group
Closing, but those skilled in the art should know, the embodiment of the present invention is not limited by described sequence of movement, because depending on
According to the embodiment of the present invention, some step can use other orders or carry out simultaneously.Secondly, those skilled in the art also should
Knowing, embodiment described in this description belongs to preferred embodiment, and the involved action not necessarily present invention implements
Necessary to example.
With reference to Fig. 3, it is shown that the structured flowchart of the detection device embodiment of a kind of server of the present invention, specifically can wrap
Include such as lower module:
Connection establishment module 302, for pre-building that the length between server with each client is connected;
Port number determines module 304, for detecting the described long target port connecting correspondence, determines the port number of correspondence
Amount;
Message pushing module 306, is used for by described target port to described client push characteristic message;
Client terminal quantity determines to the detection of described target port, module 308, foundation determine that being properly received described feature disappears
The client terminal quantity of breath;
Judgement of stability module 310, for judging described server according to described port number and described client terminal quantity
Stability, generate corresponding testing result.
With reference to Fig. 4, it is shown that the structured flowchart of the detection device embodiment of the another kind of server of the present invention.
In a preferred embodiment of the invention, connection establishment module 302, can include following submodule:
Miniport service promoter module 3021, for by execution order, starting local target port service;
Connect and create submodule 3023, for servicing based on described target port, create institute according to the concurrent quantity of input
The length stated between server with client is connected, and wherein, described long connection has target port one to one.
Optionally, the port number that the present invention implements determines module 304, and specifically may be used for adding up described server provides
Target port first sum, using described first sum as described port number;Or, it is used for whether detecting each client
There is described target port, and add up there is the second sum that the client of described target port is corresponding, will be described second total
As described port number.
In a preferred embodiment of the invention, described client terminal quantity determines module 308, can include following submodule
Block:
Pattern matched submodule 3081, for detecting the data form of the message that each target port receives with default
Target data format match;
First determines submodule 3083, for, during when described data form and the target data format match preset, determining
Corresponding client is properly received described characteristic message;
First statistics submodule 3085, for adding up the client being properly received described characteristic message, determines institute
State client terminal quantity.
In a preferred embodiment of the invention, described judgement of stability module 310, can include following submodule:
Calculating sub module 3101, for calculating the business of described number clients and described port number, determines the propelling movement of server
Success rate;
Judge submodule 3103, for judging whether described propelling movement success rate reaches default target propelling movement rate;And described
When propelling movement success rate reaches target propelling movement rate, it is determined that described server is stable;And reach target push away pushing success rate
When sending rate, it is determined that described server fluctuation of service.
In a preferred embodiment of the invention, the detection device of this server can also include pushing and unsuccessfully determines mould
Block 312 and push unsuccessfully quantity and determine module 314.
In the present embodiment, this propelling movement unsuccessfully determines mould 312, may be used in described data form and the target data preset
During format mismatching, determine that the client of correspondence receives the failure of described characteristic message.Push unsuccessfully quantity and determine module 314, right
The client receiving described characteristic message failed is added up, and determines and pushes unsuccessfully quantity.
Wherein, described judgement of stability module 310, it is also possible to include following submodule:
Checking submodule 3105, for verifying described that pushes unsuccessfully quantity and described client terminal quantity and whether reaching institute
State port number;
Loss determines submodule 3107, for described that pushes unsuccessfully quantity and described client terminal quantity and described in being not up to
During port number, determine the loss quantity that described characteristic message is corresponding, and judge described server fluctuation of service.
In a preferred embodiment of the invention, the detection device of this server can also include such as lower module:
Concurrent judge module 316, is used for judging whether described port number reaches described concurrent quantity;
Connect testing result generation module 318, for when described port number reaches described concurrent quantity, generate described clothes
The testing result of business device successful connection;Or, when described port number is not up to described concurrent quantity, generate described server even
Connect the testing result of failure.
In a preferred embodiment of the invention, the detection device of this server can also include such as lower module:
Concurrent time determines module 320, for using the per second concurrent quantity of described concurrent quantity and input, determines correspondence
Concurrent time;
Time sentences module 322, for when described port number is not up to described concurrent quantity, it is judged that whether current time exists
In the range of described concurrent time;If current time is in the range of described concurrent time, then triggers described connection establishment module 302 and continue
The continuous long step being connected performing to create between described server and client;Otherwise, trigger described connection testing result to generate
Module 318 performs to generate the step of the testing result of described server connection failure.
Create number of times logging modle 324, for recording the described long establishment number of times connecting correspondence;
Create number of times judge module 326, for when described port number is not up to described concurrent quantity, it is judged that described establishment
Whether number of times reaches preset frequency threshold value;When creating number of times and not arriving frequency threshold value, trigger described connection establishment module 302
Continue executing with the long step being connected creating between described server and client;Described frequency threshold value is reached when creating number of times
Time, trigger described connection testing result generation module 318 and perform to generate the step of the testing result of described server connection failure.
For device embodiment, due to itself and embodiment of the method basic simlarity, so describe is fairly simple, relevant
Part sees the part of embodiment of the method and illustrates.
Each embodiment in this specification all uses the mode gone forward one by one to describe, what each embodiment stressed is with
The difference of other embodiments, between each embodiment, identical similar part sees mutually.
Those skilled in the art are it should be appreciated that the embodiment of the embodiment of the present invention can be provided as method, device or calculate
Machine program product.Therefore, the embodiment of the present invention can use complete hardware embodiment, complete software implementation or combine software and
The form of the embodiment of hardware aspect.And, the embodiment of the present invention can use one or more wherein include computer can
With in the computer-usable storage medium (including but not limited to disk memory, CD-ROM, optical memory etc.) of program code
The form of the computer program implemented.
The embodiment of the present invention is with reference to method, terminal unit (system) and computer program according to embodiments of the present invention
The flow chart of product and/or block diagram describe.It should be understood that can be by computer program instructions flowchart and/or block diagram
In each flow process and/or the flow process in square frame and flow chart and/or block diagram and/or the combination of square frame.These can be provided
Computer program instructions sets to general purpose computer, special-purpose computer, Embedded Processor or other programmable data processing terminals
Standby processor is to produce a machine so that held by the processor of computer or other programmable data processing terminal equipment
The instruction of row produces for realizing in one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame
The device of the function specified.
These computer program instructions may be alternatively stored in and can guide computer or other programmable data processing terminal equipment
In the computer-readable memory worked in a specific way so that the instruction being stored in this computer-readable memory produces bag
Including the manufacture of command device, this command device realizes in one flow process of flow chart or multiple flow process and/or one side of block diagram
The function specified in frame or multiple square frame.
These computer program instructions also can be loaded on computer or other programmable data processing terminal equipment so that
On computer or other programmable terminal equipment, execution sequence of operations step is to produce computer implemented process, thus
The instruction performed on computer or other programmable terminal equipment provides for realizing in one flow process of flow chart or multiple flow process
And/or the step of the function specified in one square frame of block diagram or multiple square frame.
Although having been described for the preferred embodiment of the embodiment of the present invention, but those skilled in the art once knowing base
This creativeness concept, then can make other change and amendment to these embodiments.So, claims are intended to be construed to
The all changes including preferred embodiment and falling into range of embodiment of the invention and amendment.
Finally, in addition it is also necessary to explanation, in this article, the relational terms of such as first and second or the like be used merely to by
One entity or operation separate with another entity or operating space, and not necessarily require or imply these entities or operation
Between exist any this reality relation or order.And, term " includes ", " comprising " or its any other variant meaning
Containing comprising of nonexcludability, so that include that the process of a series of key element, method, article or terminal unit not only wrap
Include those key elements, but also include other key elements being not expressly set out, or also include for this process, method, article
Or the key element that terminal unit is intrinsic.In the case of there is no more restriction, by wanting that statement " including ... " limits
Element, it is not excluded that there is also other identical element in including the process of described key element, method, article or terminal unit.
Detection method and the detection device of a kind of server to a kind of server provided by the present invention, is carried out above
Being discussed in detail, principle and the embodiment of the present invention are set forth by specific case used herein, above example
Method and the core concept thereof being only intended to help to understand the present invention is described;Simultaneously for one of ordinary skill in the art, depend on
According to the thought of the present invention, the most all will change, in sum, this specification content
Should not be construed as limitation of the present invention.
The embodiment of the invention discloses A1, the detection method of a kind of server, including:
Pre-build that the length between server with each client is connected;
Detect the described long target port connecting correspondence, determine the port number of correspondence;
By described target port to described client push characteristic message;
Foundation determines the client terminal quantity being properly received described characteristic message to the detection of described target port;
Judge the stability of described server according to described port number and described client terminal quantity, generate corresponding detection
Result.
A2, according to the method described in claim A1, that sets up between server with each client long is connected, including:
By execution order, start local target port service;
Service based on described target port, create the length between described server and client according to the concurrent quantity of input
Connecting, wherein, described long connection has target port one to one.
A3, according to the method described in claim A1, detect and described long connect corresponding target port, determine the end of correspondence
Mouth quantity, including:
Add up the first sum of the target port that described server provides, using described first sum as described port number
Amount;Or,
Detect each client and whether there is described target port, and add up that to have the client of described target port corresponding
Second sum, using described second sum as described port number.
A4, according to the arbitrary described method of claim A1 to A3, determine successfully according to the detection of described target port
Receive the client terminal quantity of described characteristic message, including:
Detect the data form of the message that each target port receives and the target data format match preset;
When described data form and the target data format match preset, determine that the client of correspondence is properly received described
Characteristic message;
The client being properly received described characteristic message is added up, determines described client terminal quantity.
A5, according to the arbitrary described method of claim A1 to A3, described according to described port number with described client
Quantity judges the stability of described server, including:
Calculate the business of described number clients and described port number, determine the propelling movement success rate of server;
Judge whether described propelling movement success rate reaches default target propelling movement rate;
When described propelling movement success rate reaches target propelling movement rate, it is determined that described server is stable;And pushing into
When power reaches target propelling movement rate, it is determined that described server fluctuation of service.
A6, according to the method described in claim A4, also include:
When described data form is with the target data format mismatching preset, determine that the client of correspondence receives described spy
Levy message failure;
The client receiving described characteristic message failed is added up, determines and push unsuccessfully quantity;
Wherein, the described stability judging described server according to described port number and described client terminal quantity, including:
Verify described that push unsuccessfully quantity and described client terminal quantity and whether reach described port number;
Unsuccessfully quantity and described client terminal quantity and the most described port number is pushed, it is determined that described spy if described
Levy the loss quantity that message is corresponding, and judge described server fluctuation of service.
A7, according to the method described in claim A2, also include:
Judge whether described port number reaches described concurrent quantity;
When described port number reaches described concurrent quantity, generate the testing result of described server successful connection;Or
Person,
When described port number is not up to described concurrent quantity, generate the testing result of described server connection failure.
A8, according to the method described in claim A7, also include:
Use the per second concurrent quantity of described concurrent quantity and input, determine the concurrent time of correspondence;
Wherein, when described port number is not up to described concurrent quantity, generate the detection of described server connection failure
As a result, including:
When described port number is not up to described concurrent quantity, it is judged that whether current time is in described concurrent time scope
In;
If current time is in the range of described concurrent time, then continue executing with between the described server of establishment and client
The long step connected;Otherwise, perform to generate the step of the testing result of described server connection failure.
A9, according to the method described in claim A7, create between described server and client long be connected after,
Also include:
Record the described long establishment number of times connecting correspondence;
Wherein, when described port number is not up to described concurrent quantity, generate the detection of described server connection failure
As a result, including:
When described port number is not up to described concurrent quantity, it is judged that whether described establishment number of times reaches preset number of times
Threshold value;
When creating number of times and not arriving frequency threshold value, continue executing with the length creating between described server and client and be connected
Step;
When creating sub-quantity and reaching described frequency threshold value, perform the testing result of the described server connection failure of generation
Step.
The embodiment of the invention also discloses the detection device of B10, a kind of server, including:
Connection establishment module, for pre-building that the length between server with each client is connected;
Port number determines module, for detecting the described long target port connecting correspondence, determines the port number of correspondence;
Message pushing module, is used for by described target port to described client push characteristic message;
Client terminal quantity determines module, is properly received described characteristic message according to determining the detection of described target port
Client terminal quantity;
Judgement of stability module, for judging the steady of described server according to described port number and described client terminal quantity
Qualitative, generate corresponding testing result.
B11, according to the device described in claim B10, described connection establishment module, including:
Miniport service promoter module, for by execution order, starting local target port service;
Connect and create submodule, for servicing based on described target port, create described clothes according to the concurrent quantity of input
Length between business device and client is connected, and wherein, described long connection has target port one to one.
B12, according to the device described in claim B10, described port number determines module, specifically for add up described clothes
First sum of the target port that business device provides, using described first sum as described port number;Or, detect each client
Whether there is described target port, and add up and there is the second sum that the client of described target port is corresponding, by described second
Sum is as described port number.
B13, according to the arbitrary described device of claim B10 to B12, described client terminal quantity determines module, including:
Pattern matched submodule, for detecting the data form of the message that each target port receives and the mesh preset
Mark pattern matched;
First determines submodule, for, during when described data form and the target data format match preset, determining correspondence
Client be properly received described characteristic message;
First statistics submodule, for adding up the client being properly received described characteristic message, determines described visitor
Family terminal number amount.
B14, according to the arbitrary described device of claim B10 to B12, described judgement of stability module, including:
Calculating sub module, for calculating the business of described number clients and described port number, determines the propelling movement success of server
Rate;
Judge submodule, for judging whether described propelling movement success rate reaches default target propelling movement rate;And in described propelling movement
When success rate reaches target propelling movement rate, it is determined that described server is stable;And reach target propelling movement rate pushing success rate
Time, it is determined that described server fluctuation of service.
B15, according to the device described in claim B13, also include:
Push and unsuccessfully determine module, for when described data form is with the target data format mismatching preset, determining
Corresponding client receives the failure of described characteristic message;
Push unsuccessfully quantity and determine module, the client receiving described characteristic message failed is added up, determines propelling movement
Failure quantity;
Wherein, described judgement of stability module, including:
Checking submodule, for verifying described that pushes unsuccessfully quantity and described client terminal quantity and whether reaching described end
Mouth quantity;
Loss determines submodule, for pushing unsuccessfully quantity and described client terminal quantity and the most described port described
During quantity, determine the loss quantity that described characteristic message is corresponding, and judge described server fluctuation of service.
B16, according to the device described in claim B15, also include:
Concurrent judge module, is used for judging whether described port number reaches described concurrent quantity;
Connect testing result generation module, for when described port number reaches described concurrent quantity, generate described service
The testing result of device successful connection;Or, when described port number is not up to described concurrent quantity, generates described server and connect
Failed testing result.
B17, according to the device described in claim B16, also include:
Concurrent time determines module, for using the per second concurrent quantity of described concurrent quantity and input, determines correspondence
Concurrent time;
Time sentences module, for when described port number is not up to described concurrent quantity, it is judged that whether current time is in institute
In the range of stating concurrent time;If current time is in the range of described concurrent time, then triggers described connection establishment module and continue to hold
Row creates the long step being connected between described server and client;Otherwise, described connection testing result generation module is triggered
Perform to generate the step of the testing result of described server connection failure.
B18, according to the device described in claim B16, also include:
Create number of times logging modle, for recording the described long establishment number of times connecting correspondence;
Create number of times judge module, for when described port number is not up to described concurrent quantity, it is judged that described establishment time
Whether number reaches preset frequency threshold value;When creating number of times and not arriving frequency threshold value, trigger described connection establishment module and continue
Perform the long step being connected creating between described server and client;When creating number of times and reaching described frequency threshold value, touch
Send out connection testing result generation module described and perform to generate the step of the testing result of described server connection failure.