Summary of the invention
In order to solve the problem of correlation technique, the embodiment of the present invention provides a kind of method, server, ballot processing node and system that realizes internet ballot.Described technical scheme is as follows:
First aspect, provides a kind of method that realizes internet ballot, and described method comprises:
Receive the ballot request that client sends, user ID is carried in described ballot request;
The target ballot processing node that selection is mated with described user ID from default a plurality of ballot processing nodes, and described ballot request is transmitted to described target ballot processing node, described target ballot processing node for providing ballot, described client is served.
In conjunction with first aspect, in the possible implementation of the first of first aspect, before the ballot request that described reception client sends, also comprise:
The ballot configuration information that receives described client transmission obtains request;
According to described ballot configuration information, obtain the acquisition request configuration information of comprehensively voting, described comprehensive ballot configuration information comprises ballot status information, current poll information and polling option information;
The comprehensive ballot configuration information getting is sent to described client, make described client determine whether to vote according to described polling option information, and if determine and vote, ballot request sent.
In conjunction with first aspect, in the possible implementation of the second of first aspect, before the described target ballot processing node of selecting to mate with described user ID from default a plurality of ballot processing nodes, also comprise:
A plurality of ballot processing nodes that set in advance are divided into groups, and the corresponding relation between every group of ballot processing node and user ID is set;
The described target that selection is mated with described user ID from default a plurality of ballot processing nodes ballot processing node, comprising:
According to the every group of ballot processing node arranging, determine with the corresponding relation between user ID the ballot processing node place grouping that described user ID is corresponding, and in definite grouping, select a ballot processing node mating with described user ID as the target processing node of voting.
In conjunction with the possible implementation of the second of first aspect, in the third possible implementation of first aspect, described a plurality of ballot processing nodes that set in advance are divided into groups before, also comprise:
From described a plurality of ballot processing nodes, select a ballot processing node as main ballot processing node, the ballot configuration information that described main ballot processing node is added up other ballot processing nodes for timing is to obtain after comprehensive ballot configuration information, described comprehensive ballot configuration information is broadcast to each client and other ballot processing node, and described ballot configuration information comprises this locality ballot status information, local current poll information and the local polling option information of each ballot processing node;
Describedly according to described ballot configuration information, obtain the acquisition request configuration information of comprehensively voting, comprising:
According to described ballot configuration information, the request of obtaining is obtained described comprehensive ballot configuration information from described main ballot processing node, or, at described main ballot processing node, described comprehensive ballot configuration information is broadcast to after each ballot processing node, from any one ballot processing node, obtains comprehensive ballot configuration information.
In conjunction with first aspect, in the 4th kind of possible implementation of first aspect, described described ballot request is transmitted to described target ballot processing node after, also comprise:
If described target processing node breaks down, shield described target ballot processing node, and distribute in described a plurality of ballot processing node the ballot except described target ballot processing node to process target ballot processing node described in node processing and work as the polled data of pre-treatment.
Second aspect, provides a kind of method that realizes internet ballot, and described method comprises:
The ballot request that reception server forwards, described ballot request is the request that client is sent to described server, and the user ID of coupling is carried in described ballot request;
According to described ballot request, for providing ballot, described client serves.
In conjunction with second aspect, in the possible implementation of the first of second aspect, before the ballot request that described reception server forwards, also comprise:
The ballot configuration information that receives described server forwards obtains request, and the request of obtaining of described ballot configuration information is sent to described server by described client;
According to described ballot configuration information, obtain the acquisition request configuration information of comprehensively voting, described comprehensive ballot configuration information comprises ballot status information, current poll information and polling option information;
The comprehensive ballot configuration information getting is sent to described server, described server is transmitted to described comprehensive ballot configuration information after described client, make described client determine whether to vote according to described polling option information, and if vote, ballot request sent.
In conjunction with the possible implementation of the first of second aspect, in the possible implementation of the second of second aspect, described according to described ballot request for described client provides ballot service, comprising:
According to described ballot status information, provide polling option information for described client, receive and buffer memory described in the client ballot paper information that object concurrency send of selecting to vote from described polling option information;
The ballot paper information of the identical ballot object that in polymerization Preset Time, the different clients of buffer memory is selected, and process the ballot paper information after polymerization, obtain the configuration information of voting, described ballot configuration information comprises local ballot status information, local current poll information and local polling option information.
In conjunction with the possible implementation of the second of second aspect, in the third possible implementation of second aspect, the ballot paper information after described processing polymerization, obtains voting after configuration information, also comprises:
Synchronous described ballot configuration information is to main ballot processing node, the ballot configuration information that makes described main ballot processing node regularly add up each ballot processing node obtains comprehensively voting configuration information, and described main ballot processing node is described server authorizes for regularly adding up the ballot processing node of the ballot configuration information of described a plurality of ballot processing nodes.
In conjunction with the third possible implementation of second aspect, in the 4th kind of possible implementation of second aspect, described according to described ballot request for after described client provides ballot service, also comprise:
Receive the switching command that described server sends;
According to described switching command, switch to main ballot processing node, and after switching to main ballot processing node, the ballot configuration information of regularly adding up described a plurality of ballot processing nodes obtains comprehensive ballot configuration information, and described comprehensive ballot configuration information is broadcast to other ballot processing node in each client and described a plurality of ballot processing node.
The third aspect, provides a kind of server, and described server comprises:
The first receiver module, the ballot request sending for receiving client, user ID is carried in described ballot request;
Select module, for the target ballot processing node of selecting to mate with described user ID from default a plurality of ballot processing nodes;
Forwarding module, for described ballot request being transmitted to described target ballot processing node, makes described target ballot processing node serve for described client provides ballot.
In conjunction with the third aspect, in the possible implementation of the first of the third aspect, described server, also comprises:
The second receiver module, obtains request for receiving the ballot configuration information of described client transmission;
Acquisition module, for obtain the acquisition request configuration information of comprehensively voting according to described ballot configuration information, described comprehensive ballot configuration information comprises ballot status information, current poll information and polling option information;
Sending module, for the comprehensive ballot configuration information getting is sent to described client, makes described client determine whether to vote according to described polling option information, and if determine and vote, send ballot request.
In conjunction with the third aspect, in the possible implementation of the second of the third aspect, described server, also comprises:
Grouping module, for a plurality of ballot processing nodes that set in advance are divided into groups, and arranges the corresponding relation between every group of ballot processing node and user ID;
Described selection module, for determining with the corresponding relation between user ID the ballot processing node place grouping that described user ID is corresponding according to the every group of ballot processing node arranging, and in definite grouping, select a ballot processing node mating with described user ID as the target processing node of voting.
In conjunction with the possible implementation of the second of the third aspect, in the third possible implementation of the third aspect, described selection module, also for select a ballot processing node as main ballot processing node from described a plurality of ballot processing nodes, the ballot configuration information that described main ballot processing node is added up other ballot processing nodes for timing is to obtain after comprehensive ballot configuration information, described comprehensive ballot configuration information is broadcast to each client and other ballot processing node, described ballot configuration information comprises this locality ballot status information of each ballot processing node, local current poll information and local polling option information,
Described acquisition module, for obtaining according to described ballot configuration information, ask to obtain described comprehensive ballot configuration information from described main ballot processing node, or, at described main ballot processing node, described comprehensive ballot configuration information is broadcast to after each ballot processing node, from any one ballot processing node, obtains comprehensive ballot configuration information.
In conjunction with the third aspect, in the 4th kind of possible implementation of the third aspect, described server, also comprises:
Shroud module, for when described target processing node breaks down, shields described target ballot processing node;
Distribution module, for distributing the ballot of described a plurality of ballot processing node except described target ballot processing node to process described in node processing target ballot processing node when the polled data of pre-treatment.
Fourth aspect, provides a kind of ballot processing node, and described ballot processing node comprises:
The first receiver module, the ballot request forwarding for reception server, described ballot request is the request that client is sent to described server, and the user ID of coupling is carried in described ballot request;
Ballot service module, for serving for described client provides ballot according to described ballot request.
In conjunction with fourth aspect, in the possible implementation of the first of fourth aspect, described ballot processing node, also comprises:
The second receiver module, obtains request for receiving the ballot configuration information of described server forwards, and the request of obtaining of described ballot configuration information is sent to described server by described client;
Acquisition module, for obtain the acquisition request configuration information of comprehensively voting according to described ballot configuration information, described comprehensive ballot configuration information comprises ballot status information, current poll information and polling option information;
Sending module, for the comprehensive ballot configuration information getting is sent to described server, described server is transmitted to described comprehensive ballot configuration information after described client, make described client determine whether to vote according to described polling option information, if and vote, send ballot request.
In conjunction with the possible implementation of the first of fourth aspect, in the possible implementation of the second of fourth aspect, described ballot service module, comprising:
Provide polling option unit, for providing polling option information according to described ballot status information for described client;
Receiving element, the ballot paper information of selecting ballot object concurrency to send from described polling option information for receiving described client;
Buffer unit, the ballot paper information of selecting ballot object concurrency to send from described polling option information for client described in buffer memory;
Polymerized unit, the ballot paper information of the identical ballot object of selecting for the different clients of buffer memory in polymerization Preset Time;
Processing unit, the ballot paper information for the treatment of after polymerization, obtains the configuration information of voting, and described ballot configuration information comprises local ballot status information, local current poll information and local polling option information.
In conjunction with the possible implementation of the second of fourth aspect, in the third possible implementation of fourth aspect, described ballot processing node, also comprises:
Synchronization module, be used for synchronous described ballot configuration information to main ballot processing node, the ballot configuration information that makes described main ballot processing node regularly add up each ballot processing node obtains comprehensively voting configuration information, and described main ballot processing node is described server authorizes for regularly adding up the ballot processing node of the ballot configuration information of described a plurality of ballot processing nodes.
In conjunction with the third possible implementation of fourth aspect, in the 4th kind of possible implementation of fourth aspect, described ballot processing node, also comprises:
The 3rd receiver module, the switching command sending for receiving described server;
Handover module, for switching to main ballot processing node according to described switching command;
Statistical module, for after switching to main ballot processing node, the ballot configuration information of regularly adding up described a plurality of ballot processing nodes obtains comprehensive ballot configuration information;
Broadcast module, for being broadcast to the comprehensive ballot configuration information obtaining other ballot processing node of each client and described a plurality of ballot processing nodes.
The 5th aspect, provides a kind of system that realizes internet ballot, and described system comprises: server and a plurality of ballot processing node;
Wherein, the server of server as described in the above-mentioned third aspect;
The ballot processing node of each ballot processing node as described in above-mentioned fourth aspect in a plurality of ballot processing nodes.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is:
By the target ballot processing node of selecting a plurality of ballot processing nodes from default to mate with user ID, for providing ballot, client serves, guarantee when realizing internet ballot, when synchronization participates in the client of ballot when numerous, can for providing ballot, client be served by a plurality of ballot processing nodes, when raising system is processed ballot efficiency, can bring good operating experience to user.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
As shown in Figure 1, it shows a kind of implementation environment structural representation of realizing the method for internet ballot that the embodiment of the present invention provides.In the implementation environment shown in Fig. 1, a kind of ballot system is provided, this ballot system comprises a plurality of clients, server and a plurality of ballot processing node.In embodiments of the present invention, when user need to participate in the ballot of certain activity by internet, can login this ballot system by the client at place, then by sending to server the request of ballot, by server, from default a plurality of ballot processing nodes, selected a ballot processing node to serve for client provides ballot.Wherein, a plurality of ballot processing nodes can be distributed in different areas or be distributed in different ISP(Internet Service Provider, and internet provides service provider) in equipment.When ballot service is provided for client, server selects a ballot processing node to serve for client provides ballot from a plurality of ballot processing nodes.For example, the ballot processing node in same ISP provides ballot service for client with client can to select one.
For convenience of explanation, in embodiments of the present invention, what server was selected is target ballot processing node for client provides the ballot of ballot service to process node definition.In addition, in order to make client can get the real-time progress of ballot, server can select a ballot processing node as main ballot processing node in a plurality of ballot processing nodes, for regularly adding up the ballot situation of each ballot processing node.
The method that the realizes internet ballot embodiment of the present invention being provided below in conjunction with each embodiment is elaborated, and specifically refers to following embodiment mono-and embodiment bis-:
Embodiment mono-
In conjunction with implementation environment structural representation and the foregoing shown in Fig. 1, the embodiment of the present invention provides a kind of method that realizes internet ballot.The angle of the method that the server of the take execution embodiment of the present invention provides is example, and referring to Fig. 2, the method flow that the embodiment of the present invention provides comprises:
201: receive the ballot request that client sends, user ID is carried in this ballot request;
202: from default a plurality of ballot processing nodes, select the target ballot processing node that mate with user ID, and ballot request is transmitted to target ballot processing node, the target processing node of voting is served for client provides to vote.
Preferably, before receiving the ballot request of client transmission, also comprise:
The ballot configuration information that receives client transmission obtains request;
According to ballot configuration information, obtain the acquisition request configuration information of comprehensively voting, this configuration information of comprehensively voting comprises ballot status information, current poll information and polling option information;
The comprehensive ballot configuration information getting is sent to client, make client determine whether to vote according to polling option information, and if determine and vote, ballot request sent.
Preferably, before the target ballot processing node of selecting to mate with user ID from default a plurality of ballot processing nodes, also comprise:
A plurality of ballot processing nodes that set in advance are divided into groups, and the corresponding relation between every group of ballot processing node and user ID is set;
From default a plurality of ballot processing nodes, select the target ballot processing node mating with user ID, comprising:
According to the every group of ballot processing node arranging, determine with the corresponding relation between user ID the ballot processing node place grouping that user ID is corresponding, and in definite grouping, select a ballot processing node mating with user ID as the target processing node of voting.
Preferably, before a plurality of ballot processing nodes that set in advance are divided into groups, also comprise:
From a plurality of ballot processing nodes, select a ballot processing node as main ballot processing node, the ballot configuration information that this main ballot processing node is added up other ballot processing nodes for timing is to obtain after comprehensive ballot configuration information, the configuration information of comprehensively voting is broadcast to each client and other ballot processing node, wherein, ballot configuration information comprises this locality ballot status information, local current poll information and the local polling option information of each ballot processing node;
According to ballot configuration information, obtain the acquisition request configuration information of comprehensively voting, comprising:
According to ballot configuration information, the request of obtaining is obtained comprehensive ballot configuration information from main ballot processing node, or, main ballot processing node will comprehensively vote configuration information be broadcast to each ballot processing node after, from any one ballot processing node obtain comprehensive ballot configuration information.
Preferably, after ballot request is transmitted to target ballot processing node, also comprise:
If target processing node breaks down, shield target ballot processing node, and distribute the one or more ballots except target ballot processing node in a plurality of ballot processing nodes to process node processing target ballot processing node when the polled data of pre-treatment.
The angle of the method that arbitrary ballot processing node execution embodiment of the present invention of take in a plurality of ballot processing nodes provides is example, and referring to Fig. 3, the method flow that the embodiment of the present invention provides comprises:
301: the ballot request that reception server forwards, this ballot asks to be sent to for client the request of server, and the user ID of coupling is carried in ballot request.
302: according to ballot request, for client provides ballot, serve.
Preferably, before the ballot request that reception server forwards, also comprise:
The ballot configuration information that reception server forwards obtains request, and the request of obtaining of this ballot configuration information is sent to server by client;
According to ballot configuration information, obtain the acquisition request configuration information of comprehensively voting, this configuration information of comprehensively voting comprises ballot status information, current poll information and polling option information;
The comprehensive ballot configuration information getting is sent to server, the server configuration information of comprehensively voting is transmitted to after client, make client determine whether to vote according to polling option information, and if vote, ballot request sent.
Preferably, according to ballot request, for client provides ballot service, comprising:
According to ballot status information, for client provides polling option information, receive the ballot paper information that also cache client selects ballot object concurrency to send from polling option information;
The ballot paper information of the identical ballot object that in polymerization Preset Time, the different clients of buffer memory is selected, and process the ballot paper information after polymerization, obtain the configuration information of voting, this ballot configuration information comprises local ballot status information, local current poll information and local polling option information.
Preferably, process the ballot paper information after polymerization, obtain voting after configuration information, also comprise:
Synchronous ballot configuration information is to main ballot processing node, the ballot configuration information that makes main ballot processing node regularly add up each ballot processing node obtains comprehensively voting configuration information, and main ballot processing node is server authorizes for regularly adding up the ballot processing node of the ballot configuration information of a plurality of ballot processing nodes.
Preferably, according to ballot request, for after client provides ballot service, also comprise:
The switching command that reception server sends;
According to switching command, switch to main ballot processing node, and after switching to main ballot processing node, the ballot configuration information of regularly adding up a plurality of ballot processing nodes obtains comprehensive ballot configuration information, and the configuration information of comprehensively voting is broadcast to other ballot processing node in each client and a plurality of ballot processing node.
The method that the embodiment of the present invention provides, by the target ballot processing node of selecting a plurality of ballot processing nodes from default to mate with user ID, for providing ballot, client serves, guarantee when realizing internet ballot, when synchronization participates in the client of ballot when numerous, can for providing ballot, client be served by a plurality of ballot processing nodes, when raising system is processed ballot efficiency, can bring good operating experience to user.
Embodiment bis-
In conjunction with the content of the implementation environment structural representation shown in Fig. 1 and above-described embodiment one, the embodiment of the present invention provides a kind of method that realizes internet ballot.Referring to Fig. 4, the method flow that the embodiment of the present invention provides comprises:
401: server divides into groups to default a plurality of ballot processing nodes, and the corresponding relation between every group of ballot processing node and user ID is set.
Because the method that realizes internet ballot that the embodiment of the present invention provides is supported multipoint service, ballot system comprises a plurality of ballot processing nodes, by a plurality of ballot processing nodes, is served for different clients provides ballot simultaneously.Therefore, server can divide into groups for a plurality of ballot processing nodes default in ballot system, and after a plurality of ballot processing nodes to default divide into groups, when ballot service is provided for client, can for providing ballot, different clients serve by the ballot processing node in different grouping.
The mode of default a plurality of ballot processing nodes being divided into groups about server, can have multiple.For example, server, when a plurality of ballot processing nodes are divided into groups, can divide into groups according to area, and the client that the ballot processing node in different grouping is respectively different regions provides ballot service.For example, server can be controlled the client that the ballot processing node of Beijing area is Beijing area ballot service is provided.Server also can divide into groups to a plurality of ballot processing nodes according to ISP, and now, server selects the ballot processing node mating with the ISP of client to serve for client provides ballot according to the ISP of client.
In addition, after server divides into groups to default a plurality of ballot processing nodes, can for providing ballot, different clients serve by the ballot processing node in different grouping.In such cases, for when ballot service is provided for client, can from a plurality of ballot processing nodes, select rapidly to provide for client the ballot processing node of ballot service, server that the corresponding relation between every group of ballot processing node and user ID can be set.The embodiment of the present invention does not specifically limit the mode of the corresponding relation between every group of ballot processing node of Servers installed and user ID.For example, server can arrange the corresponding relation between ballot processing node and the residing area of client.
It should be noted that, because this step is that server is providing the operation of carrying out before ballot service to client, therefore, this step is without all carry out when providing ballot service for client at every turn.If when grouping changes or need to upgrade, can again carry out this step.
402: server selects a ballot processing node as main ballot processing node from default a plurality of ballot processing nodes, the ballot configuration information that this main ballot processing node is added up other ballot processing node for timing is to obtain comprehensive ballot configuration information, and this configuration information of comprehensively voting comprises ballot status information, current poll information and polling option information.
For make other ballot processing node in client or ballot system can Real-time Obtaining the progress of ballot, server can select a ballot processing node as main ballot processing node from default a plurality of ballot processing nodes, and this main ballot processing node overall situation is unique, the ballot configuration information of adding up other ballot processing node for timing is to obtain comprehensive ballot configuration information.In addition, main ballot processing node is after obtaining comprehensive ballot configuration information, this comprehensive ballot configuration information can be broadcast to each client and other ballot processing node, so that client is upgraded UI(User Interface, user interface) show or make other ballot processing node obtain in real time current ballot progress.
Wherein, comprehensively vote configuration information comprise ballot status information, current poll information and polling option information.Ballot status information is for showing the state of ballot, and as ballot is carried out, ballot does not start or vote to finish etc.Current poll information is for showing relation between the poll of each ballot object current acquisition and poll that each ballot object obtains etc.Polling option information, for when ballot status information is when carrying out, provides polling option to user, for user's selection, votes.
About server, from default a plurality of ballot processing nodes, select a ballot processing node as the mode of main ballot processing node, can have a variety of.For example, server can limit the main ballot processing node of certain ballot processing node for fixing in default a plurality of ballot processing nodes; Also can determine main ballot processing node according to the ballot disposition of default a plurality of ballot processing nodes, for example, server can be according to how much definite main ballot processing nodes of the ballot quantity of the client of a plurality of ballots processing node processing; Also can chosen in advance some ballot processing nodes, and each selected ballot processing node is set as the time of main ballot processing node, make the different moment respectively by different ballot processing nodes as main ballot processing node etc.
Further, main ballot processing node is regularly added up the ballot configuration information of other ballot processing node to obtain the mode of comprehensive ballot configuration information, is specially: the ballot configuration information of each ballot processing node Timing Synchronization self is to main ballot processing node; The ballot configuration information that main ballot processing node is regularly added up each ballot processing synchronisation of nodes obtains comprehensively voting configuration information.Wherein, the ballot configuration information of each ballot processing node comprises this locality ballot status information, local current poll information and the local polling option information of each ballot processing node.Wherein, local ballot status information is for showing that local ballot state is to carry out, completed or do not start etc.Local current poll information is for showing the poll of each ballot object of local current acquisition.Local polling option information, for when voting status information when carrying out, provides polling option to user, and now user corresponding to client can vote by polling option.In the time interval of regularly adding up about main ballot processing node, the embodiment of the present invention is not done concrete restriction, for example, can be 5min(minute), 10min etc.Certainly, in order to make each client and other ballot processing node can obtain in real time the progress of ballot, this time interval of regularly adding up is more short better.
It should be noted that, this step neither provide ballot service all to need to carry out at every turn, can select the mode of main ballot processing node to carry out according to server.For example, if server is selected certain fixing ballot processing node, be main ballot processing node, this step need be carried out once; If it is main ballot processing node that server is regularly selected some ballot processing node, this step needs regularly to carry out, etc.
403: the ballot configuration information that server receives client transmission obtains request, and the request of obtaining of this ballot configuration information is transmitted to target ballot processing node.
Client, before participating in ballot, in order to obtain current ballot development situation, need to send ballot configuration information to server and obtain request.Now, the ballot configuration information that server receives client transmission obtains request, and the request of obtaining of this ballot configuration information is transmitted to target ballot processing node.About server, receive the ballot configuration information request of obtaining of client transmission and the mode that the request of obtaining of this ballot configuration information is transmitted to target ballot processing node, the embodiment of the present invention is not done concrete restriction.
It should be noted that, server, before request that this ballot configuration information is obtained is transmitted to target ballot processing node, can select a ballot processing node as the target processing node of voting from default a plurality of ballot processing nodes.Wherein, server selects a ballot processing node as the mode of target ballot processing node from default a plurality of ballot processing nodes, can have a variety of, for example, server can select a ballot processing node mating with this user ID as the target processing node of voting according to sending user ID corresponding to client that this ballot configuration information obtain request from a plurality of ballot processing nodes of presetting.For example, if this user ID is carried user's regional information, server can select according to user's regional information a ballot processing node as the target processing node of voting from the area at this user place.In addition, because main ballot processing node is after obtaining comprehensive ballot configuration information, this comprehensive ballot configuration information can be synchronized to other each ballot processing node in this ballot system, therefore, server is before the ballot configuration information that forwards client transmission obtains request, also, after can selecting at random a ballot processing node as target ballot processing node, the request of obtaining of this ballot configuration information is transmitted to target ballot processing node.Certainly, in order to make client obtain fast comprehensive ballot configuration information, in embodiments of the present invention, preferential selection with the ballot processing node of client in areal or same ISP as the target processing node of voting.
404: the ballot configuration information that target ballot processing node reception server forwards obtains request, according to ballot configuration information, obtain the acquisition request configuration information of comprehensively voting.
Wherein, the mode that the ballot configuration information that the embodiment of the present invention does not forward target ballot processing node reception server obtains request specifically limits.
About target ballot processing node, according to ballot configuration information, obtain comprehensively the vote mode of configuration information of acquisition request, can have a variety of.For example, target ballot processing node can obtain comprehensive ballot configuration information to the comprehensive ballot configuration information of the current statistics of the main ballot processing node of main ballot processing node request; Also can first detect and receive comprehensive ballot configuration information that this ballot configuration information obtains subsynchronous statistics on moment of request and the main ballot processing node time interval between the moment.When this time interval is very little, target ballot processing node can be directly using the comprehensive ballot configuration information of subsynchronous statistics on main ballot processing node as the comprehensive ballot configuration information obtaining.
In addition, in embodiments of the present invention, server, in order to grasp in real time the development situation of ballot, also needs according to ballot configuration information Real-time Obtaining ballot configuration information.Wherein, server obtains comprehensively the vote mode of configuration information of acquisition request according to ballot configuration information, include but not limited to that the request of obtaining is obtained comprehensive ballot configuration information from main ballot processing node according to ballot configuration information, or, main ballot processing node will comprehensively vote configuration information be broadcast to each ballot processing node after, from any one ballot processing node obtain comprehensive ballot configuration information.
405: target ballot processing node sends to server by the comprehensive ballot configuration information getting, the server configuration information of comprehensively voting is transmitted to after client, client determines whether to vote according to polling option information, and if vote, to server, send ballot request.
Wherein, the mode that the embodiment of the present invention does not send to server and server that the configuration information of comprehensively voting is transmitted to client the comprehensive ballot configuration information getting to target ballot processing node specifically limits.
When the server configuration information of comprehensively voting is transmitted to after client, client obtains comprehensive ballot configuration information.Because comprehensive ballot configuration information comprises ballot status information, current poll information and polling option information.Therefore, the current ballot state showing when ballot status information carries out when middle for ballot, and the polling option that client can provide according to polling option information is voted, and determines after ballot when client, need to send ballot to server and ask.The mode that sends ballot request about user end to server, the embodiment of the present invention is not done concrete restriction.During concrete enforcement, ballot system can arrange polling option on corresponding ballot webpage, and client, after showing polling option, triggers to server transmission ballot request by detecting the clicked operation of polling option.
406: server receives the ballot request that client sends, and the target that selection is mated with user ID from default a plurality of ballot processing nodes ballot processing node, and ballot request is transmitted to target ballot processing node, wherein, user ID is carried in ballot request.
The mode that receives the ballot request of client transmission about server, the embodiment of the present invention is not done concrete restriction.
It should be noted that, owing to default a plurality of ballot processing nodes being divided into groups before server, and the corresponding relation between every group of ballot processing node and user ID is set.Therefore, service is after the ballot request that receives client, and the client that the ballot processing node that can select mate with user ID from default a plurality of ballot processing nodes is this request as target ballot processing node provides to vote serves.Wherein, the server ballot processing node that selection is mated with user ID from default a plurality of ballot processing nodes, as the mode of target ballot processing node, includes but not limited to realize in the following manner:
Server determines with the corresponding relation between user ID the ballot processing node place grouping that user ID is corresponding according to the every group of ballot processing node arranging, and in definite grouping, selects a ballot processing node mating with user ID as the target processing node of voting.
Certainly, server can also adopt other modes from default a plurality of ballot processing nodes, to select the ballot processing node that mates with user ID as the target processing node of voting, and the embodiment of the present invention is not done concrete restriction to this.
407: the ballot request that target ballot processing node reception server forwards, according to this ballot request, for providing ballot, client serves.
Server is transmitted to ballot request after target ballot processing node, the ballot request that target ballot processing node reception server forwards.About server, ballot request is transmitted to the mode of the ballot request of target ballot processing node and the forwarding of target ballot processing node reception server, the embodiment of the present invention is not done concrete restriction.
Wherein, target ballot processing node, comprising for client provides ballot service according to ballot request:
Target ballot processing node provides polling option information according to ballot status information for client; In client, get the ballot object that user selects from polling option information and obtain after ballot paper information, this ballot paper information is sent to target ballot processing node.The ballot paper information that target ballot processing node receives and cache client sends; The ballot paper information of the identical ballot object that in target ballot processing node aggregation Preset Time, the different clients of buffer memory is selected, and process the ballot paper information after polymerization, obtain the configuration information of voting.
It should be noted that, in embodiments of the present invention, after ballot paper information that object concurrency send that target ballot processing node receives and cache client is selected to vote from polling option information, the ballot paper information of directly client not being selected is added in local current poll information, but first the ballot paper information cache of this acquisition is processed to intra-node in ballot, then in nearest a period of time of quantitative check, whether there is other similarly to operate.If within this time period, there are again one or more clients to select this ballot object, now, the ballot paper information of the same ballot object that target ballot processing node is selected a plurality of clients is carried out after polymerization, and poll corresponding to ballot paper information after polymerization is added in local current poll information.The mode that realizes converging operationJu Hecaozuo about target ballot processing node, can have a variety of.For example, can process intra-node in ballot timer is set, and use the ballot paper information of this timer timing scan buffer memory, when timer arrives timing time, automatically the ballot paper information of this section of time buffer memory is carried out to polymerization, and by the ballot paper information write into Databasce after polymerization.
For the ease of the process that above-mentioned target ballot is processed to the ballot paper information of the identical ballot object that in node aggregation Preset Time, different clients is selected, explain, will describe for example below.
For example, user A and user B, thrown 1 ticket in the same timing of timer same ballot object, target ballot processing node can be separately by 1 ticket difference write into Databasce of this increase so, but this twice ballot operation is aggregated into single job, by the ballot paper information write into Databasce of the twice ballot operation after polymerization, the ballot paper of the ballot object now recording in database has increased by 2 tickets.
Pass through converging operationJu Hecaozuo, the in the situation that, request amount many at ballot number of users being large, target ballot processing node aggregates into operation once of equal value by numerous ballot requests, thereby make this ballot system support high concurrent situation, avoided participating in the client of ballot when numerous, the risk that ballot processing node causes the ballot system to break down because arriving bottleneck.
In addition, the ballot paper information after node processing polymerization is processed in target ballot, obtain voting after configuration information, also comprise: the ballot configuration information obtaining is synchronized to main ballot processing node, the ballot configuration information update that makes main ballot processing node regularly process synchronisation of nodes according to each ballot configuration information of comprehensively voting.
By above-mentioned steps, client can be by target ballot service that processing node the provides operation of voting of voting.Yet, if in current ballot system for after client provides the target ballot processing node of ballot service to break down, this target ballot processing node can not be normally for client provides ballot service.After guaranteeing that target ballot processing node breaks down, do not affect user's ballot operation, the embodiment of the present invention also provides the solution while breaking down for target ballot processing node, specifically refers to following step 408.
408: if target ballot processing node breaks down, server shields target ballot processing node, and distributes the one or more ballots processing node processing targets ballot processing nodes except target ballot processing node in a plurality of ballot processing nodes to work as the polled data of pre-treatment.
In order to guarantee when target ballot processing node breaks down, ballot system still can be processed the ballot request of client, in embodiments of the present invention, if target ballot processing node breaks down, server shields target ballot processing node, and distributes the one or more ballots processing node processing targets ballot processing nodes except target ballot processing node in a plurality of ballot processing nodes to work as the polled data of pre-treatment.About the mode of server shielding target ballot processing node, the embodiment of the present invention is not done concrete restriction.In addition, about the one or more ballots except target ballot processing node in a plurality of ballot processing nodes of server-assignment, process node processing target ballot processing node when the mode of the polled data of pre-treatment, can have a variety of.For example, server can be selected one or more ballot processing nodes in the grouping at the target ballot processing node place of breaking down; Certainly, server also can be selected one or more ballot processing nodes from other grouping, and the embodiment of the present invention is not done concrete restriction to this.
By this step, after target ballot processing node breaks down, by distributing other ballot processing node to carry out the current polled data of processing of processing target ballot processing node, polled data can not made mistakes because certain votes handle node failures, when having increased the disaster tolerance performance of ballot system, do not affect user's ballot operation.
409: the switching command that target ballot processing node reception server sends, and switch to main ballot processing node according to switching command.
This step is optional step.In embodiments of the present invention, any one ballot processing node in ballot system all can switch to main ballot processing node, guarantee when current main ballot handle node failures, can be continued to carry out by other processing nodes of voting the function of main ballot processing node.Because main ballot processing node is the unique ballot processing node of the overall situation, therefore, in order to switch to the action need server authorizes of main ballot processing node, guarantee the global uniqueness of the main ballot processing node of mandate.Therefore, target ballot processing node, when switching to main ballot processing node, needs the switching command of reception server transmission, and switches to main ballot processing node according to switching command.
Further, target ballot processing node is after switching to main ballot processing node, continue to carry out the function that main ballot processing node is carried out, the ballot configuration information of regularly adding up a plurality of ballot processing nodes obtains comprehensive ballot configuration information, and by the configuration information real-time broadcast of comprehensively voting to other ballot processing node in each client and a plurality of ballot processing node.
The method that the embodiment of the present invention provides, by the target ballot processing node of selecting a plurality of ballot processing nodes from default to mate with user ID, for providing ballot, client serves, guarantee when realizing internet ballot, when synchronization participates in the client of ballot when numerous, can for providing ballot, client be served by a plurality of ballot processing nodes, when raising system is processed ballot efficiency, can bring good operating experience to user.
Embodiment tri-
The embodiment of the present invention provides a kind of server, the function that this server is carried out for carrying out above-described embodiment one and embodiment bis-servers.Referring to Fig. 5, this server comprises:
The first receiver module 501, the ballot request sending for receiving client, user ID is carried in ballot request;
Select module 502, for the target ballot processing node of selecting to mate with user ID from default a plurality of ballot processing nodes;
Forwarding module 503, for ballot request being transmitted to target ballot processing node, makes target ballot processing node serve for client provides ballot.
Preferably, referring to Fig. 6, server, also comprises:
The second receiver module 504, obtains request for receiving the ballot configuration information of client transmission;
Acquisition module 505, for obtaining the acquisition request configuration information of comprehensively voting according to ballot configuration information, the configuration information of comprehensively voting comprises ballot status information, current poll information and polling option information;
Sending module 506, for the comprehensive ballot configuration information getting is sent to client, makes client determine whether to vote according to polling option information, and if determine and vote, send ballot request.
Preferably, referring to Fig. 7, server, also comprises:
Grouping module 507, for a plurality of ballot processing nodes that set in advance are divided into groups, and arranges the corresponding relation between every group of ballot processing node and user ID;
Select module 502, for determining with the corresponding relation between user ID the ballot processing node place grouping that user ID is corresponding according to the every group of ballot processing node arranging, and in definite grouping, select a ballot processing node mating with user ID as the target processing node of voting.
Preferably, select module 502, also for select a ballot processing node as main ballot processing node from a plurality of ballot processing nodes, the ballot configuration information that main ballot processing node is added up other ballot processing nodes for timing is to obtain after comprehensive ballot configuration information, the configuration information of comprehensively voting is broadcast to each client and other ballot processing node, and ballot configuration information comprises this locality ballot status information, local current poll information and the local polling option information of each ballot processing node;
Acquisition module 505, for obtaining and ask to obtain comprehensive ballot configuration information from main ballot processing node according to ballot configuration information, or, main ballot processing node will comprehensively vote configuration information be broadcast to each ballot processing node after, from any one ballot processing node obtain comprehensive ballot configuration information.
Preferably, referring to Fig. 8, server, also comprises:
Shroud module 508, for when target processing node breaks down, shielding target ballot processing node;
Distribution module 509, for distributing the one or more ballots of a plurality of ballot processing nodes except target ballot processing node to process node processing target ballot processing node when the polled data of pre-treatment.
The server that the embodiment of the present invention provides, by the target ballot processing node of selecting a plurality of ballot processing nodes from default to mate with user ID, for providing ballot, client serves, guarantee when realizing internet ballot, when synchronization participates in the client of ballot when numerous, can for providing ballot, client be served by a plurality of ballot processing nodes, when raising system is processed ballot efficiency, can bring good operating experience to user.
Embodiment tetra-
The embodiment of the present invention provides a kind of ballot processing node, and this ballot processing node is for carrying out the function of above-described embodiment one and embodiment bis-target ballot processing nodes.Referring to Fig. 9, this ballot processing node comprises:
The first receiver module 901, the ballot request forwarding for reception server, ballot asks to be sent to for client the request of server, and the user ID of coupling is carried in ballot request;
Ballot service module 902, for serving for client provides ballot according to ballot request.
Preferably, referring to Figure 10, ballot processing node, also comprises:
The second receiver module 903, the ballot configuration information forwarding for reception server obtains request, and the request of obtaining of ballot configuration information is sent to server by client;
Acquisition module 904, for obtaining the acquisition request configuration information of comprehensively voting according to ballot configuration information, the configuration information of comprehensively voting comprises ballot status information, current poll information and polling option information;
Sending module 905, for the comprehensive ballot configuration information getting is sent to server, the server configuration information of comprehensively voting is transmitted to after client, make client determine whether to vote according to polling option information, if and vote, send ballot request.
Preferably, referring to Figure 11, ballot service module 902, comprising:
Provide polling option unit 9021, for providing polling option information according to ballot status information for client;
Receiving element 9022, the ballot paper information of selecting ballot object concurrency to send from polling option information for receiving client;
Buffer unit 9023, the ballot paper information of selecting ballot object concurrency to send from polling option information for cache client;
Polymerized unit 9024, the ballot paper information of the identical ballot object of selecting for the different clients of buffer memory in polymerization Preset Time;
Processing unit 9025, the ballot paper information for the treatment of after polymerization, obtains the configuration information of voting, and ballot configuration information comprises local ballot status information, local current poll information and local polling option information.
Preferably, referring to Figure 12, ballot processing node, also comprises:
Synchronization module 906, for the synchronous extremely main ballot processing node of configuration information of voting, the ballot configuration information that makes main ballot processing node regularly add up each ballot processing node obtains comprehensively voting configuration information, and main ballot processing node is server authorizes for regularly adding up the ballot processing node of the ballot configuration information of a plurality of ballot processing nodes.
Preferably, referring to Figure 13, ballot processing node, also comprises:
The 3rd receiver module 907, the switching command sending for reception server;
Handover module 908, for switching to main ballot processing node according to switching command;
Statistical module 909, for after switching to main ballot processing node, the ballot configuration information of regularly adding up a plurality of ballot processing nodes obtains comprehensive ballot configuration information;
Broadcast module 910, for being broadcast to the comprehensive ballot configuration information obtaining other ballot processing node of each client and a plurality of ballot processing nodes.
The ballot processing node that the embodiment of the present invention provides, by the target ballot processing node of selecting a plurality of ballot processing nodes from default to mate with user ID, for providing ballot, client serves, guarantee when realizing internet ballot, when synchronization participates in the client of ballot when numerous, can for providing ballot, client be served by a plurality of ballot processing nodes, when raising system is processed ballot efficiency, can bring good operating experience to user.
Embodiment five
The embodiment of the present invention provides a kind of system that realizes internet ballot, and referring to Figure 14, this system comprises server 1401 and a plurality of ballot processing node 1402;
Wherein, the server that server 1401 provides as above-described embodiment three, specifically refers to the content of above-described embodiment three, does not repeat them here;
Each ballot processing node 1402 in a plurality of ballot processing nodes, as the ballot processing node that above-described embodiment four provides, specifically refers to the content of above-described embodiment four, does not repeat them here;
Wherein, server can select a ballot processing node as main ballot processing node 1403 from a plurality of ballot processing nodes, the ballot configuration information that this main ballot processing node is added up other ballot processing node for timing, to obtain after comprehensive ballot configuration information, is broadcast to each client and other ballot processing node by described comprehensive ballot configuration information.
The system that the embodiment of the present invention provides, by server, from default a plurality of ballot processing nodes, select the target ballot processing node mating with user ID to serve for client provides ballot, guarantee when realizing internet ballot, when synchronization participates in the client of ballot when numerous, can for providing ballot, client be served by a plurality of ballot processing nodes, when raising system is processed ballot efficiency, can bring good operating experience to user.
It should be noted that: the server that above-described embodiment provides, ballot processing node are when realizing internet ballot, only the division with above-mentioned each functional module is illustrated, in practical application, can above-mentioned functions be distributed and by different functional modules, completed as required, the inner structure of the equipment of being about to is divided into different functional modules, to complete all or part of function described above.In addition, the server that above-described embodiment provides, the processing node of voting, the system that realizes internet ballot belong to same design with the embodiment of the method that realizes internet ballot, and its specific implementation process refers to embodiment of the method, repeats no more here.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step that realizes above-described embodiment can complete by hardware, also can come the hardware that instruction is relevant to complete by program, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be ROM (read-only memory), disk or CD etc.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.