Background technique
Increasingly developed with Internet technology, service content provided by internet is also more and more, for being applied to
For the communication of the mediaphone MMTel of webpage real time communication WebRTC system, it usually needs multiple servers are set and are come together
When service is provided, i.e. progress server cluster processing avoids single server can not be simultaneously to be multiple to carry out load balancing
User provides the case where service in time, to improve service quality.
Load balancing is by providing a load balancer LB (Load in the front end of each server at present
Balancer), user's connection request is assigned on each server.Specifically include two methods, a kind of method is client
It is connected to load balancer, and is requested after obtaining server ip address, load balancer is according to load balance scheduling algorithms selection
One server, and this server ip address is returned into client;Client is connected to according to the server ip address of return
Corresponding server, initiating business request.But this method needs to connect just can be carried out business processing, treatment effeciency twice
It is lower, and since client need to be firstly connected to load balancer, so that load balancer becomes the bottleneck of system, once it is not
Service can be provided, whole system is all in unusable state.
Another method is that client is connected to load balancer, and initiating business request.Load balancer is according to load
Equalized scheduling algorithm selects a server, and service request is transmitted to the server.After the completion of server process, by result
Load balancer is returned to, load balancer returns result to client again.Equally, load balancer becomes in this method
The performance bottleneck of system, and all requests and response require to forward by it.Once load balancer cannot provide clothes
Business, whole system is all in unusable state.
Summary of the invention
In order to overcome the deficiencies in the prior art, the embodiment of the invention provides a kind of mediaphone MMTel's
Communication cluster method and device.
In order to solve the above-mentioned technical problem, the embodiment of the present invention adopts the following technical scheme that
One aspect according to an embodiment of the present invention provides the communication cluster method of mediaphone MMTel a kind of, answers
For webpage real time communication WebRTC system, which comprises send asking for distribution server to load balancer LB
It asks;The response message that the LB is returned for the request is received, the server of LB distribution is carried in the response message
IP address records the IP address of the server carried in the response message;According to the IP address of the server recorded, connection
To corresponding server, initiating business request.
Wherein, described send to load balancer LB for the request of distribution server includes: to be used for multiple LB transmission
The request of distribution server, the multiple LB are deployed in the route computer room of different operators;It is described to receive the LB for institute
The response message that request returns is stated, the IP address of the server of LB distribution is carried in the response message, records the response
The IP address of the server carried in message includes: the response message for receiving the multiple LB and returning for the request, record
The IP address of entrained server in the response message returned at first.
Wherein, the method also includes: to LB send for distribution server request after, if not having within a preset time
When obtaining response, then according to the IP address of local pre-set escape server, to the IP address of the escape server
Corresponding escape server initiating business request.
Wherein, the method also includes: to LB send for distribution server request after, do not have within a preset time
When obtaining response, if local pre-set escape server ip address is sky, by the IP address of the server of previous record
The IP address of escape server is saved as, and initiates business to the corresponding server of the IP address of the escape server after preservation and asks
It asks.
Other side according to an embodiment of the present invention additionally provides the communication cluster dress of mediaphone MMTel a kind of
It sets, is applied to webpage real time communication WebRTC system, described device includes: the first sending module, is used for load balancer LB
Send the request for being used for distribution server;Receiving module, the response message returned for receiving the LB for the request, institute
The IP address that the server of LB distribution is carried in response message is stated, with recording the IP of the server carried in the response message
Location;Second sending module is connected to corresponding server for the IP address according to the server recorded, and initiation business is asked
It asks.
Wherein, first sending module includes: the first transmission unit, is used for distribution server for sending to multiple LB
Request, the multiple LB is deployed in the route computer room of different operators;The receiving module includes: receiving unit, is used for
The response message that the multiple LB is returned for the request is received, service entrained in the response message returned at first is recorded
The IP address of device.
Wherein, described device further include: the first Service Processing Module, for sending asking for distribution server to LB
After asking, if do not obtain response within a preset time, according to the IP address of local pre-set escape server, to institute
State the corresponding escape server initiating business request of IP address of escape server.
Wherein, described device further include: the second Service Processing Module, for sending asking for distribution server to LB
After asking, when not obtaining response within a preset time, if the IP address of local pre-set escape server is sky, will before
The IP address of the server of secondary record save as escape server IP address, and to after preservation escape server IP address
Corresponding server initiating business request.
The embodiment of the present invention the utility model has the advantages that the method for the embodiment of the present invention can be avoided effectively to load balancer LB's
Depend on unduly, avoid it is just inoperable after LB breaks down happen, making LB is no longer system bottleneck, is improved simultaneously
The distribution capability of load balancing.
Specific embodiment
To keep the technical problem to be solved in the present invention, technical solution and advantage clearer, below in conjunction with attached drawing and tool
Body embodiment is described in detail.
As shown in Figure 1, the flow chart of the communication cluster method for the mediaphone MMTel of the embodiment of the present invention, the party
Method is applied to webpage real time communication WebRTC system, and referring to Fig.1, this method comprises the following steps:
Step 101, the request for being used for distribution server is sent to load balancer LB.
Step 102, the response message that the LB is returned for the request is received, carries LB points in the response message
The IP address for the server matched records the IP address of the server carried in the response message.
Specifically, LB receive client web app transmission the distribution server request after, according to load balancing
Algorithm selects a server, and this server ip address is returned to web app.
Step 103, according to the IP address of the server recorded, corresponding server, initiating business request are connected to.
In an embodiment of the present invention, it can effectively avoid web app from depending on LB unduly, avoid breaking down in LB
Just inoperable afterwards to happen, making LB is no longer system bottleneck, while improving the distribution capability of load balancing.
Further, the step 101 of the above embodiment of the present invention specifically includes: sending to multiple LB and is used for distribution server
Request, the multiple LB is deployed in the route computer room of different operators.It should be noted that in embodiments of the present invention,
It is all deployed with load balancing service in each operator, and can be the route machine that one or more LB are distributed in A operator
Room, one or more LB distribute the route computer room in B operator, particular number setting can according to the specific bearing capacity of operator and
Number of users carries out corresponding configuration, in embodiments of the present invention with no restrictions.
Further, the step 102 of the above embodiment of the present invention specifically includes: receiving the multiple LB for the request
The response message of return records the IP address of server entrained in the response message returned at first.It should be understood that
Web app when sending the request for being used for distribution server to multiple LB for being deployed in different operators route computer room, if
It is that the response message that the LB in A operator is returned is most fast, then shows the network speed of the access of network locating for web app A operator
Degree is fast, and the network speed for accessing B operator is slow, entrained in the response message that the record of web app selection at this time returns at first
The IP address of the IP address of server, the corresponding server selects the server for being deployed in A operator to mention as follow-up service
Donor.
Further, the method for the embodiment of the present invention further include: after sending the request for distribution server to LB, if
When not obtaining response within a preset time, then according to the IP address of local pre-set escape server, to the escape
The corresponding escape server initiating business request of the IP address of server.It should be understood that the pre-set function is web
App has preset the IP address of escape server when publication, and the request for being used for distribution server is being sent to LB
When not obtaining response in preset time afterwards, escaping function is enabled, i.e., to the corresponding escape of IP address of the escape server
Server initiating business request.To effectively avoid depending on LB unduly, avoid just inoperable after LB breaks down
It happens, making LB is no longer system bottleneck, while improving the distribution capability of load balancing.
Further, the method for the embodiment of the present invention further include: after sending the request for distribution server to LB,
When not obtaining response in preset time, if the IP address of local pre-set escape server is sky, by previous record
Server IP address save as escape server IP address, and to after preservation escape server IP address it is corresponding
Server initiating business request.The mode of server can be just found to change the guide for the LB that places one's entire reliance upon.
For better implementation above-mentioned purpose, as shown in Fig. 2, the embodiment of the invention provides a kind of mediaphones
The communication cluster device of MMTel, the device are applied to webpage real time communication WebRTC system, and described device 20 includes: the first hair
Send module 21, receiving module 22 and the second sending module 23, wherein
First sending module 21, for sending the request for being used for distribution server to load balancer LB;
Receiving module 22 is directed to the response message that the request returns for receiving the LB, takes in the response message
The IP address of server with LB distribution, records the IP address of the server carried in the response message;
Second sending module 23 is connected to corresponding server for the IP address according to the server recorded, initiates
Service request.
In an embodiment of the present invention, it can effectively avoid depending on LB unduly, avoid after LB breaks down just not
Workable to happen, making LB is no longer system bottleneck, while improving the distribution capability of load balancing.
Further, first sending module 21 includes: the first transmission unit, for sending to multiple LB for distributing
The request of server, the multiple LB are deployed in the route computer room of different operators;The receiving module 22 includes: to receive list
Member, the response message returned for receiving the multiple LB for the request, records and is taken in the response message returned at first
The IP address of the server of band.
Further, described device 20 further include: the first Service Processing Module, for sending to LB for the service of distributing
After the request of device, if do not obtain response within a preset time, according to the IP of local pre-set escape server
Location, to the corresponding escape server initiating business request of IP address of the escape server.
Further, described device 20 further include: the second Service Processing Module, for sending to LB for the service of distributing
After the request of device, when not obtaining response within a preset time, if the IP address of local pre-set escape server is sky,
The IP address of the server of previous record then saves as to the IP address of escape server, and to the escape server after preservation
The corresponding server initiating business request of IP address.
The above is a preferred embodiment of the present invention, it is noted that for those skilled in the art
For, without departing from the principles of the present invention, several improvements and modifications can also be made, these improvements and modifications
It should be regarded as protection scope of the present invention.