CN104243285B - A kind of method and server of message push - Google Patents

A kind of method and server of message push Download PDF

Info

Publication number
CN104243285B
CN104243285B CN201410484584.4A CN201410484584A CN104243285B CN 104243285 B CN104243285 B CN 104243285B CN 201410484584 A CN201410484584 A CN 201410484584A CN 104243285 B CN104243285 B CN 104243285B
Authority
CN
China
Prior art keywords
virtual machine
client
run
required operation
volume reduction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410484584.4A
Other languages
Chinese (zh)
Other versions
CN104243285A (en
Inventor
黄郁财
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huaduo Network Technology Co Ltd
Original Assignee
Guangzhou Huaduo Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Huaduo Network Technology Co Ltd filed Critical Guangzhou Huaduo Network Technology Co Ltd
Priority to CN201410484584.4A priority Critical patent/CN104243285B/en
Publication of CN104243285A publication Critical patent/CN104243285A/en
Application granted granted Critical
Publication of CN104243285B publication Critical patent/CN104243285B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention discloses the method and server of a kind of message push, wherein, methods described includes:Detect the quantity of the client accessed;The quantity of the virtual machine run according to needed for being set the quantity of the client accessed, the virtual machine of the required operation are used to be connected by the client;PUSH message is pushed to by the client by the virtual machine of the required operation.Using the present invention, system resource can be saved in PUSH message.

Description

A kind of method and server of message push
Technical field
The present invention relates to communication technical field, more particularly to the method and server of a kind of push of message.
Background technology
Current real-time messages supplying system is widely used to the Internet, applications, such as advertisement pushing.Current real-time Used in message push system during the function of server push, it is necessary to substantial amounts of long connection be maintained, in order to remain substantial amounts of Long connection, traditional way is to use server cluster, i.e., service end application is deployed on more physical servers, and combine Load balancing handles connection request.But in the case of light load, more physical servers still can be run simultaneously, this Inevitably result in the waste of system resource.
The content of the invention
The embodiment of the present invention provides a kind of method and server of message push, can save system in PUSH message System resource.
First aspect of the embodiment of the present invention provides a kind of method of message push, including:
Detect the quantity of the client accessed;
The quantity of the virtual machine run according to needed for being set the quantity of the client accessed, the required operation Virtual machine is used to be connected by the client;
PUSH message is pushed to by the client by the virtual machine of the required operation.
Second aspect of the embodiment of the present invention provides a kind of message push server, including:
Detection module, for detecting the quantity of the client accessed;
Setup module, the quantity of the client for having been accessed according to set the quantity of the virtual machine of required operation, The virtual machine of operation needed for described is used to be connected by the client;
Pushing module, for PUSH message to be pushed into the client by the virtual machine of the required operation.
In the embodiment of the present invention, by detecting the quantity of the client accessed, the virtual of required operation can be set out The quantity of machine, and PUSH message is pushed to by client by the virtual machine of required operation, due to the virtual machine of required operation Quantity is dynamic change, and virtual machine is run on physical server, so the quantity of the virtual machine in required operation During reduction, the quantity for the physical server for needing to run can be equally reduced, so as to save system resource.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is a kind of structural representation of the system of message push provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic flow sheet of the method for message push provided in an embodiment of the present invention;
Fig. 3 is the schematic flow sheet of the method for another message push provided in an embodiment of the present invention;
Fig. 4 is the schematic flow sheet of one of which expansion method provided in an embodiment of the present invention;
Fig. 5 is the schematic flow sheet of one of which volume reduction method provided in an embodiment of the present invention;
Fig. 6 is a kind of structural representation of message push server provided in an embodiment of the present invention;
Fig. 7 is a kind of structural representation of setup module provided in an embodiment of the present invention;
Fig. 8 is a kind of structural representation of dilatation unit provided in an embodiment of the present invention;
Fig. 9 is a kind of structural representation of volume reduction unit provided in an embodiment of the present invention;
Figure 10 is the structural representation of another message push server provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
Involved virtual machine can be seen as a Netty server in the embodiment of the present invention, i.e., each virtual It is deployed with machine using Netty to do the serve end program of long connection, for example, when creating virtual machine, by Netty servers Program is injected into virtual machine and run.When creating virtual machine, vmware virtualization technologies can be used, can also be used certainly The virtualization technologies such as xen, kvm, existing virtualization technology can be supported to create, start, stop, deleting virtual machine substantially Function.Virtual machine needs to run in physical server, therefore, a physical server can be virtualized into more it is different Virtual machine, if for example, a physical server can be virtualized into 20 virtual machines, and be currently needed for using 35 virtual machines, It is then current at least to need to run two physical servers.Involved client can include in the embodiment of the present invention:Intelligence Mobile phone, tablet personal computer, desktop computer etc. have the terminal of connection network function, and the client can also be in terminal device Browser application, the browser application can be the browser application based on Netty, or, the client can also be specific For set group chat, net cast, channel K songs, the comprehensive amusement client being integrated using functions such as game, online video display End, the embodiment of the present invention are not construed as limiting.
Fig. 1 is referred to, is a kind of structural representation of the system of message push provided in an embodiment of the present invention;The system can With including central server 100, virtual machine 200a, virtual machine 200b ..., virtual machine 200n, virtual resources server 300, equalization server 400 and client 500a, client 500b ..., client 500n, wherein, each virtual machine and The virtual resources server 300 can be by network connection to the central server 100, and each virtual machine can be with By network connection to the equalization server 400, meanwhile, the equalization server 400 can also be each by network connection Client so that each client can pass through the equalization server 400 virtual machine corresponding with server cluster Establish long connection.Each virtual machine can be seen as a Netty server, i.e., use is deployed with each virtual machine Netty grows the serve end program of connection to do.The server cluster can include more physical servers and virtualization money Source server 300, multiple virtual machines can be run in every physical server, therefore, are connected in the central server 100 Before connecing each virtual machine, the central server 100 needs elder generation to be connected with more physical servers in server cluster Connect.The virtual resources server 300 can be used for recording the quantity of virtual machine and the state of virtual machine, the virtualization Resource Server 300 can be same server with the central server 100.The equalization server 400 can pass through HAProxy does load balancing.
Central server 100 in the system provided in an embodiment of the present invention, virtual machine 200a, virtual machine 200b ..., virtual machine 200n, virtual resources server 300, equalization server 400 and client 500a, client 500b ..., client 500n may apply to the scene of browser PUSH message.So that client is browser as an example, client Hold 500a, client 500b ..., client 500n passes through the equalization server 400 and corresponding virtual machine and establishes and grow company Connect, the central server 100 can obtain the total of all long connections by obtaining the long quantity connected in each virtual machine Number, that is, the quantity of the client accessed.The central server 100 can be according to the number of the client accessed The quantity of the virtual machine of operation needed for setting is measured, when the quantity of the virtual machine of the required operation is virtual more than currently having run During the quantity of machine, the central server 100 can apply for increase virtual machine to the virtual resources server 300, described Virtual resources server 300 can notify server cluster increase virtual machine to meet the quantity of the virtual machine of required operation; When the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run, the central server 100 Release virtual machine can be applied for the virtual resources server 300, the virtual resources server 300 can notify to take Business device cluster reduces virtual machine to meet the quantity of the virtual machine of required operation.When the central server 100 receives push During message, the central server 100 PUSH message can be sent to virtual machine 200a, virtual machine 200b ..., it is empty Plan machine 200n, and notify virtual machine 200a, virtual machine 200b ..., virtual machine 200n the PUSH message is sent to it is described The PUSH message is pushed to client 500a, client by equalization server 400, the equalization server 400 again 500b ..., client 500n.Because the quantity of the virtual machine of required operation is dynamic change, and virtual machine is in physics Run on server, so when the quantity of the virtual machine of required operation is reduced, can equally reduce the physics for needing to run The quantity of server, so as to save system resource.
Fig. 2 is referred to, is a kind of schematic flow sheet of the method for message push provided in an embodiment of the present invention, methods described It can include:
S101, detect the quantity of the client accessed;
Specifically, central server can count the quantity of the long connection of the current virtual machine run and client, i.e., Calculate the summation of the long connection quantity of each virtual machine run, the quantity for the client that the summation has as accessed.Examining Survey before the quantity of the client accessed, the client needs first to establish long connection with the virtual machine being currently running, and this is built Vertical process can be:Client sends connection request to virtual machine, and virtual machine is established according to the connection request and the client to be grown Connection, client sends safety certification message to virtual machine again, if virtual machine is verified, virtual machine is by the mark of the client Knowledge is attached in length connection;If virtual machine authentication failed, virtual machine will be switched off length connection.
S102, the quantity of the virtual machine run according to needed for being set the quantity of the client accessed are described required The virtual machine of operation is used to be connected by the client;
Specifically, the virtual machine that central server can be run according to needed for calculating the quantity of the client accessed Quantity, it is described needed for the quantity of virtual machine of operation be to be just met for the quantity of current business demand.Wherein, it is described to have accessed Client quantity it is bigger, the quantity of the virtual machine of required operation is more, conversely, the quantity of the client accessed is got over Small, the quantity of the virtual machine of required operation is fewer, it can be seen that, the quantity of the virtual machine of required operation is dynamic change.
When the quantity of the virtual machine of the required operation calculated is more than the quantity of the current virtual machine run, Quantity by the quantity dilatation processing of the virtual machine currently run for the virtual machine of the required operation, for example, currently having transported The quantity of capable virtual machine is 10, that is, 10 virtual machines is currently running, if the quantity according to the client currently accessed The quantity of the virtual machine of the required operation calculated is 11, then the virtual machine that central server will can currently have been run Quantity dilatation handle to 11, that is, need increase newly a virtual machine.
When the quantity of the virtual machine of the required operation calculated is less than the number of the current virtual machine run During amount, the quantity by the quantity volume reduction treatment of the virtual machine currently run for the virtual machine of the required operation, for example, currently The quantity of the virtual machine run is 10, that is, 10 virtual machines is currently running, if according to the client currently accessed The quantity of the virtual machine for the required operation that quantity calculates is 8, then the void that central server will can currently have been run The quantity volume reduction treatment of plan machine suspends 2 virtual machines to 8 that is, from 10 virtual machines being currently running.
Assuming that current operation there are 2 physical servers, 10 virtual machines are run on every physical server, that is, are had altogether 20 virtual machines are run, if calculating the number of the virtual machine of current desired operation according to the quantity of the client currently accessed Measure as 5, then 5 virtual machines can be run by a wherein physical server, another physical server then may be at stopping Breath state, so as to save system resource.
S103, PUSH message is pushed to by the client by the virtual machine of the required operation;
Specifically, when central server receives the PUSH message from third party system, the push can be disappeared Breath send to the required operation virtual machine, will the PUSH message send to dilatation processing or volume reduction treatment after The PUSH message is pushed to the client by the virtual machine of operation, the virtual machine of the required operation again.Wherein, it is described to push away Message is sent to include the type of destination client, therefore, the virtual machine of the required operation is receiving the PUSH message Afterwards, all long connections can be traveled through according to the type of the destination client, the PUSH message are pushed to described in meeting The client of the type of destination client.Wherein, in order to avoid the PUSH message to be disposably pushed to excessive client And cause the pressure of third party system excessive, push maximum can be set so that the virtual machine of operation can enter needed for described Row repeatedly push, the client terminal quantity pushed every time are no more than push maximum, for example, it is assumed that push maximum is 10,000, it is described PUSH message is first pushed to 10,000 clients by the virtual machine of required operation, is pushed away again to second batch client after 20s Send.
In the embodiment of the present invention, by detecting the quantity of the client accessed, the virtual of required operation can be set out The quantity of machine, and PUSH message is pushed to by client by the virtual machine of required operation, due to the virtual machine of required operation Quantity is dynamic change, and virtual machine is run on physical server, so the quantity of the virtual machine in required operation During reduction, the quantity for the physical server for needing to run can be equally reduced, so as to save system resource.
Fig. 3 is referred to, is the schematic flow sheet of the method for another message push provided in an embodiment of the present invention, the side Method can include:
S201, create and start the initial virtual machine for connecting client, so that the initial virtual machine and the visitor Long connection is established at family end;
Specifically, when starting the physical server for running virtual machine, central server can notify physical services Device creates initial virtual machine, and starts initial virtual machine, so that the initial virtual machine establishes long connection with the client, just The quantity of beginning virtual machine can be set according to the quantity of the client accessed in the past.
S202, the quantity of the long connection of the current virtual machine run of statistics and client, with the client accessed The quantity at end;
Specifically, after initial virtual machine is started, it is possible to the current virtual machine run of statistics and client The quantity of long connection, that is, calculate the summation of the long connection quantity of each virtual machine run, the visitor that the summation has as accessed The quantity at family end.Wherein it is possible to the quantity of the client accessed by real-time statistics, with real time to the virtual machine of required operation Quantity be adjusted.Before the quantity for the client that detection has accessed, the client needs the first void with being currently running Plan machine establishes long connection, and this, which establishes process, to be:Client sends connection request please according to the connection to virtual machine, virtual machine Ask and establish long connection with the client, client sends safety certification message to virtual machine again, empty if virtual machine is verified The mark of the client is attached in length connection by plan machine;If virtual machine authentication failed, virtual machine will be switched off length connection.
S203, the quantity of the virtual machine run according to needed for calculating the quantity of the client accessed;
Specifically, the virtual machine that central server can be run according to needed for calculating the quantity of the client accessed Quantity, the quantity for the virtual machine that central server can be run according to needed for being calculated formula c=(n+s/m)/s+1, wherein, N is the quantity of client accessed, and s is the maximum of the quantity for the long connection that virtual machine can create, and m is buffer factor, m For the quantity of the virtual machine of operation needed for calculating in advance, to avoid the long connection quantity in virtual machine could when reaching s The quantity of the virtual machine of operation needed for calculating, if it is integer to calculate c, the quantity of the virtual machine of required operation is c;If meter When to calculate c be not integer, then the quantity of the virtual machine of required operation is the numerical value after being rounded downwards to c.If for example, calculate It is 3 to go out c, then the quantity of the virtual machine of required operation is 3;If it is 3.1 to calculate c, the quantity of the virtual machine of required operation is still It is so 3;If it is 3.9 to calculate c, the quantity of the virtual machine of required operation is remained on as 3.For example, it is assumed that virtual machine can be created The maximum s=100 (ten thousand) of the quantity for the long connection built, and set buffer factor m=5, then central server can be according to public affairs Formula c=(n+20)/100+1 calculates the quantity of the virtual machine of required operation, if the quantity n=of the current client accessed 160 (ten thousand), then c=2.8 can be calculated, then carry out rounding to obtain 2 downwards to 2.8, i.e., the quantity of the virtual machine of required operation For 2;If the quantity n=180 (ten thousand) of the current client accessed, c=3 can be calculated, i.e., needed for run it is virtual The quantity of machine is 3.
S204, when the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run, Quantity by the quantity dilatation processing of the virtual machine currently run for the virtual machine of the required operation;
Specifically, when the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run When, central server can be by the number for the virtual machine that the quantity dilatation processing of the virtual machine currently run is the required operation Amount, if for example, the quantity of the current virtual machine run is 3, and the number of the virtual machine of the required operation now calculated Measure as 4, then central server can notify physical server to increase a virtual machine newly, by the number of the virtual machine to put into operation Dilatation is measured to 4.The dilation process can be:Central server can increase virtual machine to the application of virtual resources server, The virtual resources server can correspond to the virtual resources server in embodiment, the virtualization money for above-mentioned Fig. 1 Source server and central server can be same server, and the virtual resources server can be every according to what is recorded The virtual machine being currently running in platform physical server and the virtual machine in holding state, select at least one in standby The virtual machine of state, and at least one virtual machine in holding state described in physical server startup optimization corresponding to notice, The quantity of the virtual machine to put into operation is allowd to reach the quantity of the virtual machine of the required operation calculated.If physics The virtual machine in holding state is not present in server, then physical server can create new virtual machine, and startup optimization The new virtual machine.Wherein, the virtual machine increased newly, can be the information registerings such as IP to center service after service is entered Device.
S205, when the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run, Quantity by the quantity volume reduction treatment of the virtual machine currently run for the virtual machine of the required operation;
Specifically, when the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run When, the quantity volume reduction treatment of the virtual machine currently run can be the number of the virtual machine of the required operation by central server Amount, if for example, the quantity of the current virtual machine run is 3, and the number of the virtual machine of the required operation now calculated Measure as 2, then central server can notify physical server to suspend one of them virtual machine being currently running, and input is transported The quantity volume reduction of capable virtual machine is to 2.The volume reduction process can be:Central server can be to virtual resources server Shen Virtual machine please be discharge, the virtual resources server can correspond to the virtual resources server in embodiment for above-mentioned Fig. 1, The virtual resources server and central server can be same server, and the virtual resources server can root According to the virtual machine being currently running in the every physical server recorded, at least one virtual machine being currently running is selected, and Physical server corresponding to notice suspends at least one virtual machine being currently running so that the number of the virtual machine to put into operation Amount can be reduced to the quantity of the virtual machine of the required operation calculated.Wherein, suspend it is described it is at least one , it is necessary to which the long connection at least one virtual machine being currently running to be suspended is disconnected during the virtual machine of operation, And the long connection that will be switched off is reconnected in the virtual machine that other are continued to run with, and new length connection can not be linked into and treat temporarily In at least one virtual machine being currently running stopped, do not have when at least one virtual machine being currently running to be suspended When having long connect, you can pause at least one virtual machine being currently running.Wherein, the virtual resources server can be with The quantity of virtual machine of the statistics in holding state, when the quantity of the virtual machine in holding state is more than predetermined number threshold value When, the virtual resources server can notify physical server to delete the virtual machine for being partially in holding state.
The embodiment of the present invention can also carry out dilatation, volume reduction treatment to the physical server for running virtual machine.Due to The quantity of the virtual machine run in physical server has higher limit, it is possible to the number for the virtual machine that real-time statistics are currently running Amount, when the quantity for the virtual machine being currently running is excessive, central server can send alarm to notify the thing for needing dilatation new Manage server.For example, there is 2 physical servers, every physical server is at best able to run 10 virtual machines, i.e., most altogether 20 virtual machines can be run, it is assumed that alert threshold 80%, if the quantity for the virtual machine being currently running is 16, then by In 16/20=0.8=80%, so now having reached alert threshold, you can send alarm to notify the thing for needing dilatation new Manage server.
S206, PUSH message is pushed to by the client by the virtual machine of the required operation;
Specifically, when central server receives the PUSH message from third party system, the push can be disappeared Breath send to the required operation virtual machine, will the PUSH message send to dilatation processing or volume reduction treatment after The PUSH message is pushed to the client by the virtual machine of operation, the virtual machine of the required operation again.Wherein, it is described to push away Message is sent to include the type of destination client, therefore, the virtual machine of the required operation is receiving the PUSH message Afterwards, all long connections can be traveled through according to the type of the destination client, the PUSH message are pushed to described in meeting The client of the type of destination client.Wherein, in order to avoid the PUSH message to be disposably pushed to excessive client And cause the pressure of third party system excessive, push maximum can be set so that the virtual machine of operation can enter needed for described Row repeatedly push, the client terminal quantity pushed every time are no more than push maximum, for example, it is assumed that push maximum is 10,000, it is described PUSH message is first pushed to 10,000 clients by the virtual machine of required operation, is pushed away again to second batch client after 20s Send.
So that client is browser as an example, the service end of long connection is done due to being deployed with virtual machine using Netty Program, it is possible to using C voices so that the browser to be arranged to carry out growing what is be connected with virtual machine inside browser Netty clients.When browser receives the PUSH message that virtual machine is pushed, browser can turn the C voices of correlation Going out to call a javascript function, the function is responsible for carrying out message pop-up, is using the advantages of javascript, because The page exhibition of html (HyperText Mark-up Language, HTML) is can be based on for javascript Show, so displaying, UI (User Interface, user interface) interaction to message can carry out more flexible customization, and It can be realized without carrying out upgrading to browser again.
In the embodiment of the present invention, by detecting the quantity of the client accessed, the virtual of required operation can be set out The quantity of machine, and PUSH message is pushed to by client by the virtual machine of required operation, due to the virtual machine of required operation Quantity is dynamic change, and virtual machine is run on physical server, so the quantity of the virtual machine in required operation During reduction, the quantity for the physical server for needing to run can be equally reduced, so as to save system resource.
Further, then Fig. 4 is referred to, is the flow signal of one of which expansion method provided in an embodiment of the present invention Figure, methods described can correspond to above-mentioned Fig. 3 and correspond to S204 in embodiment, and methods described can include:
S301, ought when the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run The running status of the preceding virtual machine run is arranged to state to be expanded;
Specifically, when the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run, in The running status of the virtual machine currently run can be arranged to state to be expanded by central server, for example, what is calculated is required The quantity of the virtual machine of operation is 5, and the quantity of the virtual machine currently run is 4, then central server can will currently The running status of 4 virtual machines of operation is arranged to state to be expanded.
S302, detect the duration that the current virtual machine run is in the state to be expanded;
Specifically, central server, which can detect the current virtual machine run, is in holding for the state to be expanded Continuous duration, that is, the quantity for detecting the virtual machine of the required operation calculated in real time are more than the number of the current virtual machine run The duration of amount.
S303, when the duration is more than default duration threshold value, starts and run the virtual machine of the first quantity, institute State difference of first quantity for the quantity and the quantity of the current virtual machine run of the virtual machine of the required operation;
Specifically, for the robustness of strengthening system, system is caused to prevent long connection quantity from changing between critical value Frequently vibration, therefore, it is necessary to a default duration threshold value, when the duration is more than default duration threshold value, just starts And the virtual machine of the first quantity is run, first quantity has currently been transported for the quantity of the virtual machine of the required operation with described The difference of the quantity of capable virtual machine.For example, it is assumed that duration threshold value is 5 minutes, if the quantity of the current virtual machine run is 3 It is individual, and the long quantity for connecting the virtual machine that quantity reaches the required operation calculated when more than 1,800,000 is 4, then at 5 minutes When interior long connection quantity maintains more than 1,800,000 all the time, it is possible to start and run a new virtual machine so that put into operation Virtual machine quantity reach 4.
The embodiment of the present invention, can be with the robustness of strengthening system so that in dilation process by presetting a duration threshold value In can prevent long connection quantity from changing between critical value to cause system frequently to vibrate.
Further, then Fig. 5 is referred to, is the flow signal of one of which volume reduction method provided in an embodiment of the present invention Figure, methods described can correspond to above-mentioned Fig. 3 and correspond to S205 in embodiment, and methods described can include:
S401, when the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run, The running status of the virtual machine of second quantity in the virtual machine currently run is arranged to treat volume reduction state;
Specifically, second quantity is the virtual of quantity and the required operation of the current virtual machine run The difference of the quantity of machine.For example, the quantity of the virtual machine of the required operation calculated is 3, the number of the virtual machine currently run Measure as 5, central server can select 2 virtual machines according to the numbering of virtual machine, if the numbering of 5 virtual machines being currently running Respectively 1,2,3,4,5, then the running status for numbering the virtual machine for being 1 and 2 can be arranged to treat volume reduction state.
S402, the virtual machine for detecting second quantity are in the duration for treating volume reduction state;
Specifically, the virtual machine that central server can detect second quantity treats continuing for volume reduction state in described Duration, that is, the quantity for detecting the virtual machine of the required operation calculated in real time are less than the quantity of the current virtual machine run Duration.
S403, when the duration is more than default duration threshold value, treat that the virtual machine of volume reduction state breaks described in notice Open connected client so that the client reconnect in the current virtual machine run non-treat volume reduction shape The virtual machine of state;
Specifically, for the robustness of strengthening system, system is caused to prevent long connection quantity from changing between critical value Frequently vibration, therefore, it is necessary to a default duration threshold value, when the duration is more than default duration threshold value, is just notified The virtual machine for treating volume reduction state disconnects connected client, so that the client is reconnected to and described currently transported The non-virtual machine for treating volume reduction state in capable virtual machine.The virtual machine that the central server can notify to treat volume reduction state exists Indicate that the virtual machine will fail in data protocol head so that the equalization server that Fig. 1 is corresponded in embodiment distributes by client During to virtual machine, client will not be connected to the virtual machine for treating volume reduction state by the equalization server.It is genuinely convinced in described Device be engaged in when described in notice when the virtual machine disconnection of volume reduction state connected client, the virtual machine for treating volume reduction state can Message is jumped to client to inform that it is non-that the client needs to reconnect to disconnect connected client, and send to unite as one The virtual machine of volume reduction state is treated, the non-virtual machine for treating volume reduction state is except described in the current virtual machine run The virtual machine beyond the virtual machine of volume reduction state is treated, that is, needs the virtual machine continued to run with.For example, it is assumed that duration threshold value is 5 points Clock, if the quantity of the current virtual machine run is 3, and long connection quantity reach calculated when less than 1,800,000 it is required The quantity of the virtual machine of operation is 2, then when long connection quantity is maintained below 1,800,000 all the time in 5 minutes, it is possible to notify 1 virtual machine for treating volume reduction state disconnects connected client, so that the client reconnects to other 2 virtually Machine.
S404, it is described when the client with annexation is not present in the virtual machine of volume reduction state when detecting, will The virtual machine pause for treating volume reduction state is deleted;
Specifically, the virtual machine for treating volume reduction state is to disconnect established long connection successively, when detecting described treat When the client with annexation being not present in the virtual machine of volume reduction state, central server can notifies to be used to run void The virtual machine for treating volume reduction state is suspended or deleted by the physical server of plan machine.When in the presence of the void for being excessively in holding state During plan machine, physical server can directly deletes the virtual machine for treating volume reduction state, to save storage resource.
The embodiment of the present invention can be reduced by carrying out volume reduction treatment to virtual machine in the quantity of the virtual machine of required operation When, the quantity of physical server for needing to run can be equally reduced, so as to save system resource.
Fig. 6 is referred to, is a kind of structural representation of message push server 1 provided in an embodiment of the present invention, it is described to disappear Breath push server 1 can be that above-mentioned Fig. 1 to Fig. 5 corresponds to the central server being previously mentioned in embodiment, the message push clothes Business device 1 can include:Presetting module 40, detection module 10, setup module 20, pushing module 30;
The presetting module 40, for creating and starting the initial virtual machine for connecting client, so that described initial Virtual machine establishes long connection with the client;
Specifically, when starting the physical server for running virtual machine, the presetting module 40 can notify physics Server creates initial virtual machine, and starts initial virtual machine, so that the initial virtual machine establishes long connect with the client Connect, the quantity of initial virtual machine can be set according to the quantity of the client accessed in the past.
The detection module 10, for detecting the quantity of the client accessed;
Specifically, after initial virtual machine is started, the detection module 10 can count it is current run it is virtual The quantity of the long connection of machine and client, that is, calculate the summation of the long connection quantity of each virtual machine run, and the summation is For the quantity of the client accessed.Before the quantity of client that detection has accessed, the client need first with The virtual machine of operation establishes long connection, and this, which establishes process, to be:Client sends connection request to virtual machine, virtual machine according to The connection request establishes long connection with the client, and client sends safety certification message to virtual machine again, if virtual machine is verified By the way that then the mark of the client is attached in length connection by virtual machine;If virtual machine authentication failed, virtual machine will be switched off The length connects.
The setup module 20, the quantity of the client for having been accessed according to set the virtual machine of required operation Quantity, the virtual machine of the required operation are used to be connected by the client;
Specifically, the void that the setup module 20 can be run according to needed for calculating the quantity of the client accessed The quantity of plan machine, the quantity of the virtual machine of the required operation is to be just met for the quantity of current business demand.Wherein, it is described The quantity of the client of access is bigger, and the quantity of the virtual machine of required operation is more, conversely, the number of the client accessed Measure smaller, the quantity of the virtual machine of required operation is fewer, it can be seen that, the quantity of the virtual machine of required operation is dynamic change 's.
When the quantity of the virtual machine of the required operation calculated is more than the quantity of the current virtual machine run, Quantity of the setup module 20 by the quantity dilatation processing of the virtual machine currently run for the virtual machine of the required operation, For example, the quantity of the current virtual machine run is 10, that is, 10 virtual machines are currently running, if according to currently having accessed The quantity of client calculate it is described needed for the quantity of virtual machine of operation be 11, then the setup module 20 can ought The quantity dilatation of the preceding virtual machine run is handled to 11, that is, needs to increase a virtual machine newly.
When the quantity of the virtual machine of the required operation calculated is less than the number of the current virtual machine run During amount, the quantity volume reduction treatment of the virtual machine currently run is the virtual machine of the required operation by the setup module 20 Quantity, for example, the quantity of the current virtual machine run is 10, that is, 10 virtual machines are currently running, if according to currently The quantity of the virtual machine for the required operation that the quantity of the client of access calculates is 8, then the setup module 20 can So that to 8, i.e., the quantity volume reduction treatment of the virtual machine currently run is suspended into 2 from 10 virtual machines being currently running Platform virtual machine.
Assuming that current operation there are 2 physical servers, 10 virtual machines are run on every physical server, that is, are had altogether 20 virtual machines are run, if calculating the number of the virtual machine of current desired operation according to the quantity of the client currently accessed Measure as 5, then 5 virtual machines can be run by a wherein physical server, another physical server then may be at stopping Breath state, so as to save system resource.
The pushing module 30, for PUSH message to be pushed into the client by the virtual machine of the required operation End;
Specifically, when the pushing module 30 receives the PUSH message from third party system, can be pushed away described Send message to send to the virtual machine of the required operation, will the PUSH message send to dilatation processing or volume reduction treatment The PUSH message is pushed to the client by the virtual machine being currently running, the virtual machine of the required operation again.Wherein, institute The type of destination client can be included by stating PUSH message, and therefore, the virtual machine of the required operation is receiving the push After message, all long connections can be traveled through according to the type of the destination client, the PUSH message is pushed to and met The client of the type of the destination client.Wherein, in order to avoid the PUSH message to be disposably pushed to excessive visitor Family end and cause the pressure of third party system excessive, push maximum can be set so that it is described needed for operation virtual machine can Repeatedly to be pushed, the client terminal quantity pushed every time is no more than push maximum, for example, it is assumed that push maximum is 10,000, PUSH message is first pushed to 10,000 clients by the virtual machine of operation needed for described, is carried out again to second batch client after 20s Push.
Further, then Fig. 7 is referred to, is a kind of structural representation of setup module 20 provided in an embodiment of the present invention, The setup module 20 can include:Amount calculation unit 201, dilatation unit 202, volume reduction unit 203;
The amount calculation unit 201, the quantity of the client for having been accessed according to calculate the void of required operation The quantity of plan machine;
Specifically, the amount calculation unit 201 can be transported according to needed for calculating the quantity of the client accessed The quantity of capable virtual machine, the amount calculation unit 201 can calculate required operation according to formula c=(n+s/m)/s+1 Virtual machine quantity, wherein, n is the quantity of client accessed, and s is the quantity for the long connection that virtual machine can create Maximum, m are buffer factor, and m is used for the quantity for calculating the virtual machine of required operation in advance, to avoid the length in virtual machine Connection quantity can just calculate the quantity of the virtual machine of required operation, if it is integer to calculate c, required operation when reaching s The quantity of virtual machine is c;If to calculate c be not integer, the quantity of the virtual machine of required operation is is rounded downwards to c Numerical value afterwards.For example, if it is 3 to calculate c, the quantity of the virtual machine of required operation is 3;If it is 3.1 to calculate c, required The quantity of the virtual machine of operation remains as 3;If it is 3.9 to calculate c, the quantity of the virtual machine of required operation is remained on as 3.Example Such as, it is assumed that what virtual machine can create grows the maximum s=100 (ten thousand) of the quantity connected, and sets buffer factor m=5, then institute The quantity for the virtual machine that amount calculation unit 201 can be run according to needed for being calculated formula c=(n+20)/100+1 is stated, if working as The quantity n=160 (ten thousand) of the preceding client accessed, then c=2.8 can be calculated, then carry out rounding to obtain downwards to 2.8 2, i.e., the quantity of the virtual machine of required operation is 2;If the quantity n=180 (ten thousand) of the current client accessed, can be counted C=3 is calculated, i.e., the quantity of the virtual machine of required operation is 3.
The dilatation unit 202, quantity for the virtual machine when the required operation are more than described current run During the quantity of virtual machine, the number by the quantity dilatation processing of the virtual machine currently run for the virtual machine of the required operation Amount;
Specifically, when the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run When, the quantity dilatation processing of the virtual machine currently run can be the virtual of the required operation by the dilatation unit 202 The quantity of machine, if for example, the quantity of the current virtual machine run is 3, and the required operation now calculated is virtual The quantity of machine is 4, then the dilatation unit 202 can notify physical server to increase a virtual machine newly, will put into operation Virtual machine quantity dilatation to 4.The dilation process can be:The dilatation unit 202 can be to virtual resources service Device application increases virtual machine, and the virtual resources server can be that the virtual resources that above-mentioned Fig. 1 is corresponded in embodiment take Business device, the virtual resources server and the message push server 1 can be same server, the virtualization money Source server can be according to the virtual machine being currently running in the every physical server recorded and the void in holding state Plan machine, at least one virtual machine in holding state is selected, and described in physical server startup optimization corresponding to notice extremely A few virtual machine for being in holding state so that the quantity of the virtual machine to put into operation can reach the institute calculated The quantity for the virtual machine that need to be run.If the virtual machine in holding state is not present in physical server, physical server can To create new virtual machine, and virtual machine new described in startup optimization.Wherein, the virtual machine increased newly, can after service is entered With the information registerings such as IP to the message push server 1.
The volume reduction unit 203, quantity for the virtual machine when the required operation are less than described current run During the quantity of virtual machine, the number by the quantity volume reduction treatment of the virtual machine currently run for the virtual machine of the required operation Amount;
Specifically, when the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run When, the quantity volume reduction treatment of the virtual machine currently run can be the virtual of the required operation by the volume reduction unit 203 The quantity of machine, if for example, the quantity of the current virtual machine run is 3, and the required operation now calculated is virtual The quantity of machine be 2, then the volume reduction unit 203 can notify physical server suspend one of them be currently running it is virtual Machine, by the quantity volume reduction of the virtual machine to put into operation to 2.The volume reduction process can be:The volume reduction unit 203 can be to The application of virtual resources server discharges virtual machine, and the virtual resources server can be that above-mentioned Fig. 1 is corresponded in embodiment Virtual resources server, the virtual resources server and the message push server 1 can be same service Device, the virtual resources server can select according to the virtual machine being currently running in the every physical server recorded Go out at least one virtual machine being currently running, and physical server suspends at least one void being currently running corresponding to notice Plan machine so that the quantity of the virtual machine to put into operation can be reduced to the number of the virtual machine of the required operation calculated Amount.Wherein, during at least one virtual machine being currently running is suspended, it is necessary to by it is to be suspended it is described it is at least one just Long connection in the virtual machine of operation disconnects, and the long connection that will be switched off reconnects to other virtual machines continued to run with In, and new long connection can not be linked at least one virtual machine being currently running to be suspended, when to be suspended When at least one virtual machine being currently running without long connection, you can pause it is described it is at least one be currently running it is virtual Machine.Wherein, the virtual resources server can count the quantity of the virtual machine in holding state, when in holding state The quantity of virtual machine when being more than predetermined number threshold value, the virtual resources server can notify physical server deletion portion Office is in the virtual machine of holding state.
Further, then Fig. 8 is referred to, is a kind of structural representation of dilatation unit 202 provided in an embodiment of the present invention, The dilatation unit 202 can include:First sets subelement 2021, the first detection sub-unit 2022, startup optimization subelement 2023;
Described first sets subelement 2021, and the quantity for the virtual machine when the required operation, which is more than, currently have been run Virtual machine quantity when, the running status of the virtual machine currently run is arranged to state to be expanded;
Specifically, when the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run, institute State to be expanded can be arranged to by the running status of the virtual machine currently run by stating the first setting subelement 2021, for example, The quantity of the virtual machine of the required operation calculated is 5, and the quantity of the virtual machine currently run is 4, then described first sets State to be expanded can be arranged to by the running status of currently run 4 virtual machines by putting subelement 2021.
First detection sub-unit 2022, the shape to be expanded is in for detecting the current virtual machine run The duration of state;
Treated specifically, first detection sub-unit 2022 can detect the current virtual machine run in described The duration of dilatation state, that is, detect calculate in real time it is described needed for operation virtual machine quantity be more than currently run Virtual machine quantity duration.
The startup optimization subelement 2023, for when the duration is more than default duration threshold value, starting simultaneously The virtual machine of the first quantity is run, first quantity has currently been run for the quantity of the virtual machine of the required operation with described Virtual machine quantity difference;
Specifically, for the robustness of strengthening system, system is caused to prevent long connection quantity from changing between critical value Frequently vibration, therefore, it is necessary to a default duration threshold value, described to open when the duration is more than default duration threshold value Dynamic operation subelement 2023 just starts and runs the virtual machine of the first quantity, and first quantity is virtual for the required operation The difference of the quantity of machine and the quantity of the current virtual machine run.For example, it is assumed that duration threshold value is 5 minutes, if currently The quantity of the virtual machine run is 3, and long connection quantity reaches the virtual of the required operation that is calculated when more than 1,800,000 The quantity of machine is 4, then when long connection quantity maintains more than 1,800,000 all the time in 5 minutes, the startup optimization subelement 2023 cans start and run a new virtual machine so that the virtual machine quantity to put into operation reaches 4.
Further, then Fig. 9 is referred to, is a kind of structural representation of volume reduction unit 203 provided in an embodiment of the present invention, The volume reduction unit 203 can include:Second set subelement 2031, the second detection sub-unit 2032, notice subelement 2033, Control subelement 2034;
Described second sets subelement 2031, the quantity for the virtual machine when the required operation be less than it is described it is current During the quantity of the virtual machine of operation, the running status of the virtual machine of the second quantity in the virtual machine currently run is arranged to treat Volume reduction state, second quantity are the quantity and the number of the virtual machine of the required operation of the current virtual machine run The difference of amount;
Specifically, the quantity of the virtual machine for the required operation for assuming to calculate is 3, the quantity of the virtual machine currently run For 5, described second sets subelement 2031 to select 2 virtual machines according to the numbering of virtual machine, if 5 void being currently running The numbering of plan machine is respectively 1,2,3,4,5, then described second sets subelement 2031 will to number the virtual machine for being 1 and 2 Running status is arranged to treat volume reduction state.
Second detection sub-unit 2032, the virtual machine for detecting second quantity are in described and treat volume reduction state Duration;
Specifically, the virtual machine that second detection sub-unit 2032 can detect second quantity is waited to subtract in described The duration of appearance state, that is, the quantity for detecting the virtual machine of the required operation calculated in real time are less than what is currently run The duration of the quantity of virtual machine.
The notice subelement 2033, for when the duration is more than default duration threshold value, being treated described in notice The virtual machine of volume reduction state disconnects connected client, so that the client reconnects to the current void run The non-virtual machine for treating volume reduction state in plan machine;
Specifically, for the robustness of strengthening system, system is caused to prevent long connection quantity from changing between critical value Frequently vibration, therefore, it is necessary to a default duration threshold value, described logical when the duration is more than default duration threshold value Know that subelement 2033 treats that the virtual machine of volume reduction state disconnects connected client described in just notifying, so that the client is again The non-virtual machine for treating volume reduction state being connected in the current virtual machine run.The notice subelement 2033 can lead to Know that the virtual machine for treating volume reduction state indicates that the virtual machine will fail in data protocol head so that Fig. 1 corresponds to equal in embodiment Server weigh when client is distributed to virtual machine, client will not be connected to by the equalization server described treats volume reduction shape The virtual machine of state.The notice subelement 2033 disconnects connected client in the virtual machine that volume reduction state is treated described in notice When, the virtual machine for treating volume reduction state can disconnect connected client, and send unite as one jump message to client with Inform that the client needs to reconnect to the non-virtual machine for treating volume reduction state, the non-virtual machine for treating volume reduction state is described Virtual machine in the current virtual machine run in addition to the virtual machine for treating volume reduction state, that is, need the void continued to run with Plan machine.
The control subelement 2034, for being not present when in the virtual machine that volume reduction state is treated described in detecting with connection During the client of relation, the virtual machine for treating volume reduction state is suspended or deleted;
Specifically, the virtual machine for treating volume reduction state is to disconnect established long connection successively, when detecting described treat When the client with annexation being not present in the virtual machine of volume reduction state, the control subelement 2034 can notice is used The virtual machine for treating volume reduction state is suspended or deleted in the physical server of operation virtual machine.Excessively it is in standby when existing During the virtual machine of state, control subelement 2034 can notifies physical server directly by the void for treating volume reduction state Plan machine is deleted, to save storage resource.
In the embodiment of the present invention, by detecting the quantity of the client accessed, the virtual of required operation can be set out The quantity of machine, and PUSH message is pushed to by client by the virtual machine of required operation, due to the virtual machine of required operation Quantity is dynamic change, and virtual machine is run on physical server, so the quantity of the virtual machine in required operation During reduction, the quantity for the physical server for needing to run can be equally reduced, so as to save system resource.
Figure 10 is referred to, is the structural representation of another message push server provided in an embodiment of the present invention, it is described Message push server 1000 can include processor 1001, communication interface 1002 and (the message push clothes of memory 1003 The quantity for the processor 1001 being engaged in device 1000 can be one or more, in Figure 10 by taking a processor 1001 as an example).This hair In some bright embodiments, processor 1001, communication interface 1002 and memory 1003 can pass through communication bus or other modes Connection, wherein, Figure 10 by communication bus exemplified by being connected.
Wherein, the communication interface 1002, for being communicated with the virtual machine in physical server;
The memory 1003 is used for storage program;
The processor 1001 is used to perform described program, to realize
Detect the quantity of the client accessed;
The quantity of the virtual machine run according to needed for being set the quantity of the client accessed, the required operation Virtual machine is used to be connected by the client;
PUSH message is pushed to by the client by the virtual machine of the required operation.
Wherein, the processor 1001 is specifically used for:
The quantity of the long connection of the current virtual machine run of statistics and client, with the number of the client accessed Amount.
Wherein, the processor 1001 is specifically used for:
The quantity of the virtual machine run according to needed for calculating the quantity of the client accessed;
, will be current when the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run The quantity dilatation processing of the virtual machine run is the quantity of the virtual machine of the required operation;
, will be current when the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run The quantity volume reduction treatment of the virtual machine run is the quantity of the virtual machine of the required operation.
Wherein, the processor 1001 is specifically used for:
When the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run, will currently transport The running status of capable virtual machine is arranged to state to be expanded;
Detect the duration that the current virtual machine run is in the state to be expanded;
When the duration is more than default duration threshold value, starts and run the virtual machine of the first quantity, described One quantity is the difference of the quantity and the quantity of the current virtual machine run of the virtual machine of the required operation.
Wherein, the processor 1001 is specifically used for:
, will be current when the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run The running status of the virtual machine of the second quantity is arranged to treat volume reduction state in the virtual machine run, and second quantity is described The difference of the quantity and the quantity of the virtual machine of the required operation of the current virtual machine run;
The virtual machine for detecting second quantity is in the duration for treating volume reduction state;
When the duration is more than default duration threshold value, treats that the virtual machine of volume reduction state disconnects described in notice and connect The client connect, so that the non-void for treating volume reduction state that the client is reconnected in the current virtual machine run Plan machine;
It is described when the client with annexation is not present in the virtual machine of volume reduction state when detecting, treated described The virtual machine pause of volume reduction state is deleted.
Wherein, the processor 1001 is additionally operable to:
Create and start the initial virtual machine for connecting client, so that the initial virtual machine is built with the client Vertical long connection.
In the embodiment of the present invention, by detecting the quantity of the client accessed, the virtual of required operation can be set out The quantity of machine, and PUSH message is pushed to by client by the virtual machine of required operation, due to the virtual machine of required operation Quantity is dynamic change, and virtual machine is run on physical server, so the quantity of the virtual machine in required operation During reduction, the quantity for the physical server for needing to run can be equally reduced, so as to save system resource.
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
Above disclosure is only preferred embodiment of present invention, can not limit the right model of the present invention with this certainly Enclose, therefore the equivalent variations made according to the claims in the present invention, still belong to the scope that the present invention is covered.

Claims (12)

  1. A kind of 1. method of message push, it is characterised in that including:
    Detect the quantity of the client accessed;
    According to the quantity of the client accessed set needed for operation virtual machine quantity, it is described needed for run it is virtual Machine is used to be connected by the client;The quantity of the virtual machine of operation needed for described is calculated according to formula c=(n+s/m)/s+1 Obtain, wherein, the maximum for the quantity that n is the quantity of the client accessed, s is the long connection that virtual machine can create Value, m are buffer factor;The buffer factor is the quantity for calculating the virtual machine of the required operation in advance;
    PUSH message is pushed to by the client by the virtual machine of the required operation.
  2. 2. the method as described in claim 1, it is characterised in that the quantity for detecting the client accessed, specifically include:
    The quantity of the long connection of the current virtual machine run of statistics and client, with the quantity of the client accessed.
  3. 3. method as claimed in claim 2, it is characterised in that the quantity of the client accessed described in the basis sets institute The quantity for the virtual machine that need to be run, including:
    The quantity of the virtual machine run according to needed for calculating the quantity of the client accessed;
    When the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run, will currently transport The quantity dilatation processing of capable virtual machine is the quantity of the virtual machine of the required operation;
    When the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run, will currently transport The quantity volume reduction treatment of capable virtual machine is the quantity of the virtual machine of the required operation.
  4. 4. method as claimed in claim 3, it is characterised in that described when the quantity of the virtual machine of the required operation is more than institute It is the required operation by the quantity dilatation processing of the virtual machine currently run when stating the quantity of the current virtual machine run Virtual machine quantity, including:
    When the quantity of the virtual machine of the required operation is more than the quantity of the current virtual machine run, by what is currently run The running status of virtual machine is arranged to state to be expanded;
    Detect the duration that the current virtual machine run is in the state to be expanded;
    When the duration is more than default duration threshold value, starts and run the virtual machine of the first quantity, first number Measure the difference of the quantity and the quantity of the current virtual machine run for the virtual machine of the required operation.
  5. 5. method as claimed in claim 3, it is characterised in that described when the quantity of the virtual machine of the required operation is less than institute It is the required operation by the quantity volume reduction treatment of the virtual machine currently run when stating the quantity of the current virtual machine run Virtual machine quantity, including:
    When the quantity of the virtual machine of the required operation is less than the quantity of the current virtual machine run, will currently transport The running status of the virtual machine of the second quantity is arranged to treat volume reduction state in capable virtual machine, and second quantity is described current The difference of the quantity of the virtual machine run and the quantity of the virtual machine of the required operation;
    The virtual machine for detecting second quantity is in the duration for treating volume reduction state;
    When the duration is more than default duration threshold value, treat that the virtual machine of volume reduction state disconnects what is connected described in notice Client so that the client reconnect in the current virtual machine run non-treat the virtual of volume reduction state Machine;
    It is described when the client with annexation is not present in the virtual machine of volume reduction state when detecting, treat volume reduction by described The virtual machine pause of state is deleted.
  6. 6. the method as described in claim 1, it is characterised in that it is described detect accessed client quantity the step of it Before, in addition to:
    Create and start the initial virtual machine for connecting client, grown so that the initial virtual machine is established with the client Connection.
  7. A kind of 7. message push server, it is characterised in that including:
    Detection module, for detecting the quantity of the client accessed;
    Setup module, the quantity of the client for having been accessed according to sets the quantity of the virtual machine of required operation, described The virtual machine of required operation is used to be connected by the client;The quantity of the virtual machine of operation is according to formula c=needed for described (n+s/m)/s+1 is calculated, wherein, n is the quantity of the client accessed, s is length that virtual machine can create The maximum of the quantity of connection, m are buffer factor;The buffer factor is for calculating the virtual of the required operation in advance The quantity of machine;
    Pushing module, for PUSH message to be pushed into the client by the virtual machine of the required operation.
  8. 8. server as claimed in claim 7, it is characterised in that
    The detection module, the long quantity connected specifically for counting the current virtual machine run and client, to obtain The quantity of the client accessed.
  9. 9. server as claimed in claim 8, it is characterised in that the setup module includes:
    Amount calculation unit, the quantity of the client for having been accessed according to calculate the quantity of the virtual machine of required operation;
    Dilatation unit, the quantity for the virtual machine when the required operation are more than the quantity of the current virtual machine run When, the quantity by the quantity dilatation processing of the virtual machine currently run for the virtual machine of the required operation;
    Volume reduction unit, the quantity for the virtual machine when the required operation are less than the quantity of the current virtual machine run When, the quantity by the quantity volume reduction treatment of the virtual machine currently run for the virtual machine of the required operation.
  10. 10. server as claimed in claim 9, it is characterised in that the dilatation unit includes:
    First sets subelement, and the quantity for the virtual machine when the required operation is more than the number of the current virtual machine run During amount, the running status of the virtual machine currently run is arranged to state to be expanded;
    First detection sub-unit, for detect the current virtual machine run be in the state to be expanded it is lasting when It is long;
    Startup optimization subelement, for when the duration is more than default duration threshold value, starting and running the first quantity Virtual machine, first quantity is the quantity of the virtual machine of operation needed for described and the number of the current virtual machine run The difference of amount.
  11. 11. server as claimed in claim 9, it is characterised in that the volume reduction unit includes:
    Second sets subelement, and the quantity for the virtual machine when the required operation is less than the current virtual machine run Quantity when, the running status of the virtual machine of the second quantity in the virtual machine currently run is arranged to treat volume reduction state, institute State difference of second quantity for the quantity and the quantity of the virtual machine of the required operation of the current virtual machine run;
    Second detection sub-unit, the virtual machine for detecting second quantity are in the duration for treating volume reduction state;
    Subelement is notified, for when the duration is more than default duration threshold value, the void of volume reduction state to be treated described in notice Plan machine disconnects connected client, so that the client non-treating of reconnecting in the current virtual machine run The virtual machine of volume reduction state;
    Subelement is controlled, is detected for working as in the virtual machine for treating volume reduction state in the absence of the client with annexation When, the virtual machine for treating volume reduction state is suspended or deleted.
  12. 12. server as claimed in claim 7, it is characterised in that also include:
    Presetting module, for creating and starting the initial virtual machine for connecting client, so that the initial virtual machine and institute State client and establish long connection.
CN201410484584.4A 2014-09-19 2014-09-19 A kind of method and server of message push Active CN104243285B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410484584.4A CN104243285B (en) 2014-09-19 2014-09-19 A kind of method and server of message push

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410484584.4A CN104243285B (en) 2014-09-19 2014-09-19 A kind of method and server of message push

Publications (2)

Publication Number Publication Date
CN104243285A CN104243285A (en) 2014-12-24
CN104243285B true CN104243285B (en) 2018-02-23

Family

ID=52230675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410484584.4A Active CN104243285B (en) 2014-09-19 2014-09-19 A kind of method and server of message push

Country Status (1)

Country Link
CN (1) CN104243285B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105282245B (en) * 2015-09-29 2019-03-08 努比亚技术有限公司 Cross-server message push system and method
CN105554142B (en) * 2015-12-24 2019-02-01 北京奇虎科技有限公司 The method, apparatus and system of message push
CN106210098A (en) * 2016-07-20 2016-12-07 努比亚技术有限公司 A kind of monitoring method, supervising device and push server
CN106357747A (en) * 2016-08-30 2017-01-25 维沃移动通信有限公司 Server load management method and device
CN108243343B (en) * 2016-12-23 2019-02-05 视联动力信息技术股份有限公司 A kind of point distribution statistical method and its server based on view networking
CN109271112A (en) * 2018-09-27 2019-01-25 郑州云海信息技术有限公司 A kind of method of adjustment, device and the computer equipment of storage pool carry host
CN109873718A (en) * 2019-01-23 2019-06-11 平安科技(深圳)有限公司 A kind of container self-adapting stretching method, server and storage medium
CN111093099B (en) * 2019-02-15 2023-04-18 杭州海康威视系统技术有限公司 Streaming media service scheduling method, device and system
CN111221641A (en) * 2020-01-15 2020-06-02 广州虎牙科技有限公司 Task regulation and control method, system, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504620A (en) * 2009-03-03 2009-08-12 华为技术有限公司 Load balancing method, apparatus and system of virtual cluster system
CN102214117A (en) * 2010-04-07 2011-10-12 中兴通讯股份有限公司 Virtual machine management method, system and server
CN103561310A (en) * 2013-10-23 2014-02-05 深圳创维数字技术股份有限公司 Method, device and system for data processing
CN103685839A (en) * 2012-09-14 2014-03-26 株式会社理光 Image inspection apparatus and image inspection method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504620A (en) * 2009-03-03 2009-08-12 华为技术有限公司 Load balancing method, apparatus and system of virtual cluster system
CN102214117A (en) * 2010-04-07 2011-10-12 中兴通讯股份有限公司 Virtual machine management method, system and server
CN103685839A (en) * 2012-09-14 2014-03-26 株式会社理光 Image inspection apparatus and image inspection method
CN103561310A (en) * 2013-10-23 2014-02-05 深圳创维数字技术股份有限公司 Method, device and system for data processing

Also Published As

Publication number Publication date
CN104243285A (en) 2014-12-24

Similar Documents

Publication Publication Date Title
CN104243285B (en) A kind of method and server of message push
CN104995865B (en) Service based on sound and/or face recognition provides
CN113438355B (en) Communication method, device, equipment and storage medium based on cloud mobile phone
WO2016127818A1 (en) Information processing method, terminal, and server, and computer storage medium
US20140344286A1 (en) Method and apparatus for displaying webcast roomss
EP3547715A1 (en) Method and apparatus for reducing continuous-wakeup delay of bluetooth loudspeaker, and bluetooth loudspeaker
CN104054301A (en) Session transfer and suspension in remote access application framework
WO2014183427A1 (en) Method and apparatus for displaying webcast rooms
CN110433496B (en) Cloud game resource allocation method, electronic device and storage medium
CN107734394B (en) Method and device for displaying animation information
CN108243222A (en) Server network architecture method and device
CN103281346A (en) Disconnection reconnection method, network system and proxy server
CN114116092A (en) Cloud desktop system processing method, cloud desktop system control method and related equipment
CN114748873A (en) Interface rendering method, device, equipment and storage medium
CN104750553B (en) Using operation method and device
CN102387178A (en) Method and device for upgrading message
CN106657172A (en) Method and device for realizing information push
CN103095532A (en) System and method for online game pug-in prevention and plug-in prevention server-side
CN104348646A (en) Configuration data processing method, device and system
CN106793173B (en) The method and mobile terminal of information processing
CN112966201B (en) Object processing method, device, electronic equipment and storage medium
CN108132788A (en) A kind of development device of real time multi-human interaction systems, method and system
CN109847341B (en) Cloud game method and equipment
CN111245810B (en) Method, device, equipment and medium for realizing cloud host functional terminal
CN114268799A (en) Streaming media transmission method and device, electronic equipment and medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510000, Guangdong Province, Guangzhou, Panyu District Town, Huambo business district, Wanda Plaza, block B1, 28 floor

Applicant after: Guangzhou Huaduo Network Technology Co., Ltd.

Address before: 510655, Guangzhou, Whampoa Avenue, No. 2, creative industrial park, building 3-08,

Applicant before: Guangzhou Huaduo Network Technology Co., Ltd.

GR01 Patent grant
GR01 Patent grant