CN109587278A - Data transmission method and relevant apparatus - Google Patents
Data transmission method and relevant apparatus Download PDFInfo
- Publication number
- CN109587278A CN109587278A CN201910043335.4A CN201910043335A CN109587278A CN 109587278 A CN109587278 A CN 109587278A CN 201910043335 A CN201910043335 A CN 201910043335A CN 109587278 A CN109587278 A CN 109587278A
- Authority
- CN
- China
- Prior art keywords
- server
- mentioned
- instruction
- cluster
- executes
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The application proposes that a kind of data transmission method and device, the above method include: that above-mentioned load-balanced server receives above-mentioned first instruction and above-mentioned second instruction from above-mentioned queue server;First server is chosen from above-mentioned first server cluster, above-mentioned first server cluster includes at least two-server;Above-mentioned first instruction is sent to above-mentioned first server;In the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, second server is chosen from above-mentioned second server cluster;Above-mentioned second instruction is sent to above-mentioned second server.Implement the application, the resource of server can be saved, the safety and stability of improve data transfer reduces the degree of coupling in server cluster between each server.
Description
Technical field
The present invention relates to computer field more particularly to a kind of data transmission methods and device.
Background technique
With the development of internet, the call instruction between network system becomes increasingly complex.In practical applications, for letter
Change the function of server, fragment can be carried out to complicated instruction, obtain the relatively simple instruction of multiple functions.Wherein, these refer to
There may be sequencings in logic between order.Carrying out quickly processing to a large amount of instructions with logic sequencing becomes very
Urgently.For example, when third party's calling system sends acquisition risk report instruction to air control system, above-mentioned acquisition risk report
Instruction may be broken down into the instruction of verifying user information, obtain collage-credit data instruction, the instruction of calculation risk coefficient and generate
Risk report instruction etc., these instructions need successively to execute in sequence.Complicated for this logic, substantial amounts instructions,
Single server obviously can not be handled correctly.
In order to handle a large amount of instruction with logical relation, usually these are instructed while being sent in server cluster
Servers-all.In server cluster after the preferential instruction of a certain server successful execution logical order, pass through the side of broadcast
The formula message that will run succeeded is sent to remaining server.Carry logical order instruction rearward server receive above-mentioned execution at
After function message, start to execute the instruction of above-mentioned logical order rearward.
This to carry into execution a plan, every server is needed to send to multiple servers and be broadcast the message in server cluster, and
The broadcast message of multiple servers is received, server resource loss is larger, and the safety and stability of data transmission is lower, service
The degree of coupling in device cluster between each server is higher.
Summary of the invention
The application proposes a kind of data transmission method, can save the resource of server, the safety of improve data transfer
And stability, reduce the degree of coupling in server cluster between each server.
In a first aspect, the application provides a kind of data transmission method, it is applied to distributed system, above-mentioned distributed system packet
Queue server, load-balanced server and server cluster are included, above-mentioned queue server is used to receive from calling
Above-metioned instruction is subjected to fragment after the instruction of system, obtains the first instruction and the second instruction, the above method includes:
Above-mentioned load-balanced server receives above-mentioned first instruction and above-mentioned second instruction from above-mentioned queue server;
First server is chosen from above-mentioned first server cluster, above-mentioned first server cluster takes comprising at least two
Business device;
Above-mentioned first instruction is sent to above-mentioned first server;
In the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, selected from above-mentioned second server cluster
Take second server;
Above-mentioned second instruction is sent to above-mentioned second server.
With reference to first aspect, in one possible implementation, above-mentioned first instruction is being sent to above-mentioned first service
After device, above-mentioned before choosing second server in above-mentioned second server cluster, further includes:
It receives first from above-mentioned first server and executes mark, above-mentioned first executes mark for determining above-mentioned the
One server executes whether above-mentioned first instruction succeeds;
It is above-mentioned in the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, from above-mentioned second server cluster
Middle selection second server, comprising:
Mark is being executed according to above-mentioned first, is determining that above-mentioned first server executes the successful situation of above-mentioned first instruction
Under, above-mentioned second server is chosen from above-mentioned second server cluster.
With reference to first aspect, in one possible implementation, above-mentioned that the first clothes are chosen from first server cluster
Business device, comprising:
The first request message from first server cluster is received, above-mentioned first request message is to reach load at first
The request message of equalization server;
The corresponding server of first request message above-mentioned in first server cluster is determined as first server;
Alternatively,
Select load lower than the server of first threshold as first server from first server cluster.
In the embodiment of the present application, service of the selection load lower than the first request message of server or transmission of first threshold
Device can make full use of the performance of each server in server cluster as first server, accelerate the execution efficiency of instruction.
With reference to first aspect, in one possible implementation, above-mentioned that is chosen from above-mentioned second server cluster
Two servers, comprising:
It receives by the request message of second server collection pocket transmission reached at first;
The corresponding server of request message reached at first above-mentioned in second server cluster is determined as second server;
Alternatively,
Select load lower than the server of second threshold as second server from second server cluster.
With reference to first aspect, in one possible implementation, the above method further include:
In the case where above-mentioned first server executes above-mentioned first instruction and generates mistake, above-mentioned first instruction is sent out again
Toward above-mentioned first server.
In one possible implementation, above-mentioned to execute above-mentioned first instruction appearance mistake in above-mentioned first server
In the case of, above-mentioned first instruction is sent to first server again, comprising:
In the case where above-mentioned first server executes above-mentioned first instruction and generates the number of mistake lower than threshold value, again will
Above-mentioned first instruction is sent to above-mentioned first server.
In one possible implementation, described second is instructed above-mentioned after being sent to the second server, also
Include:
In the case where determining the successful situation of above-mentioned second instruction of execution, the mark that runs succeeded, the above-mentioned mark that runs succeeded are generated
For indicating that above-mentioned first instruction and above-mentioned second instruction are performed success;
Mark storage is run succeeded into cache server by above-mentioned.
In one possible implementation, it is above-mentioned again by it is above-mentioned first instruction be sent to first server after, on
State method further include:
In the case where above-mentioned first server executes the number that above-mentioned first instruction generates mistake and reaches threshold value, from first
Above-mentioned first server is excluded in server cluster;
A server is reselected from the remaining server of above-mentioned first server cluster as first server;
Above-mentioned first instruction is sent to above-mentioned first server.
With reference to first aspect, in one possible implementation, above-mentioned second instruction is being sent to above-mentioned second service
After device, further includes:
In the case where above-mentioned second server executes above-mentioned second instruction and generates mistake, above-mentioned second instruction is sent out again
Toward above-mentioned second server.
In the embodiment of the present application, in the case where the instruction of execution first and the second instruction errors, by the first instruction and second
Instruction is retransmitted to corresponding server, and the Stability and veracity executed instruction can be improved.
Implement the embodiment of the present application, after first server cluster has executed the first preferential instruction of logical order, will patrol
Second instruction of volume back is sent to second server cluster, and the mode between server without going through broadcast is communicated,
The resource of server can be saved, the safety and stability of improve data transfer reduces each server in server cluster
Between the degree of coupling;Meanwhile different server clusters executes the different instruction of logical order, can simplify appointing for server
Business, improves the performance of server.
Second aspect, the application propose a kind of data transmission device, comprising:
First receiving unit, for receiving above-mentioned first instruction and above-mentioned second instruction from queue server;
First selecting unit, for choosing first server, above-mentioned first server cluster from first server cluster
Include at least two-server;
First transmission unit, for above-mentioned first instruction to be sent to above-mentioned first server;
Second selecting unit, in the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, from above-mentioned
Second server is chosen in second server cluster;
Second transmission unit, for above-mentioned second instruction to be sent to above-mentioned second server.
In conjunction with second aspect, in one possible implementation, above-mentioned apparatus further include:
Second receiving unit first executes mark from above-mentioned first server for receiving, and above-mentioned first executes
Mark executes whether above-mentioned first instruction succeeds for determining above-mentioned first server;
Above-mentioned second selecting unit is specifically used for executing mark according to above-mentioned first, determines in above-mentioned server execution
It states in the successful situation of the first instruction, chooses second server from second server cluster.
Optionally, above-mentioned first selecting unit disappears specifically for receiving the first request from first server cluster
Breath;The corresponding server of first request message above-mentioned in above-mentioned first server cluster is determined as first server;Alternatively, from
Select load lower than the server of first threshold as first server in first server cluster.
Optionally, above-mentioned apparatus further include:
First retransmission unit is used in the case where above-mentioned first server executes above-mentioned first instruction and generates mistake, heavy
Above-mentioned first instruction is newly sent to above-mentioned first server.
Optionally, above-mentioned first retransmission unit is specifically used for executing above-mentioned first instruction generation in above-mentioned first server
In the case that the number of mistake is lower than threshold value, above-mentioned first instruction is sent to above-mentioned first server again.
Optionally, above-mentioned apparatus further include:
Second retransmission unit is used in the case where above-mentioned second server executes above-mentioned second instruction and generates mistake, heavy
Above-mentioned second instruction is newly sent to above-mentioned second server.
The third aspect, the application propose a kind of data transmission device, including processor and memory;Above-mentioned processor and upper
Memory is stated to be connected with each other by bus;Wherein, for storing computer program, above-mentioned computer program includes above-mentioned memory
Program instruction, above-mentioned processor are configured for calling above procedure instruction, execute method shown in above-mentioned first aspect.
Fourth aspect, the application propose a kind of computer readable storage medium, which is characterized in that above-mentioned computer-readable to deposit
Storage media is stored with computer program, and above-mentioned computer program includes program instruction, and above procedure instruction, which is worked as, to be executed by processor
When, so that above-mentioned processor is executed the method as shown in first aspect.
5th aspect, the embodiment of the present application provides a kind of computer program product comprising program instruction, when it is being counted
When being run on calculation machine, so that computer executes the method as shown in first aspect.
Implement the application, the resource of server can be saved, the safety and stability of improve data transfer reduces service
The degree of coupling in device cluster between each server.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application or in background technique below will be implemented the application
Attached drawing needed in example or background technique is illustrated.
Fig. 1 is a kind of flow chart for data transmission method that the application proposes;
Fig. 2 is the flow chart for another data transmission method that the application proposes;
Fig. 3 is a kind of flow chart of the concrete application scene for data transmission method that the application proposes;
Fig. 4 is a kind of structural schematic diagram for data transmission device that the application proposes;
Fig. 5 is the structural schematic diagram for another data transmission device that the application proposes;
Fig. 6 is a kind of structural schematic diagram for data transmission device that the application proposes.
Specific embodiment
The description and claims of this application and term " first " in above-mentioned attached drawing, " second " etc. are for distinguishing
Different objects, is not use to describe a particular order.In addition, term " includes " and " having " and their any deformations, meaning
Figure, which is to cover, non-exclusive includes.Such as contain the process, method, system, product or equipment of a series of steps or units
It is not limited to listed step or unit, but optionally further comprising the step of not listing or unit, or optionally also
Including other step or units intrinsic for these process, methods or equipment.
The application proposes a kind of data transmission method, is applied to distributed system, and above-mentioned distributed system includes queue clothes
Business device, load-balanced server and server cluster, above-mentioned queue server is for receiving the finger from calling system
Above-metioned instruction is subjected to fragment after order, obtains the first instruction and the second instruction.Implement the application, the money of server can be saved
Source, the safety and stability of improve data transfer reduce the degree of coupling in server cluster between each server.Below will
The embodiment of the present application is described in conjunction with attached drawing.
Fig. 1 is a kind of flow chart for data transmission method that the application proposes, this method includes the following contents:
101, load-balanced server receives the first instruction and the second instruction from queue server;
Above-mentioned load-balanced server is the server that data or instruction are distributed to server cluster, to ensure service
The performance of each server is utilized to greatest extent in device cluster.Above-mentioned queue server can receive to call from third party
The instruction of system.Above-metioned instruction can be sent to queue server, queue server in an asynchronous manner by above-mentioned third party's calling system
After receiving above-metioned instruction, above-metioned instruction can be stored into the queue data structure being pre-created.
Above-metioned instruction is carried out fragment by above-mentioned queue server, obtains the first instruction and the second instruction, it is also possible to obtain the
Three instructions and the 4th instruction.In above-mentioned distributed system other than first server cluster and second server cluster, it is also possible to
Including third server cluster and the 4th server cluster.Wherein, the instruction of different server cluster processing Different Logic sequence.
Specifically, due to that can need to use the first instruction of execution obtained implementing result when executing the second instruction, on
The execution sequence for stating the first instruction should be prior to the second instruction.
For example, third party's calling system is sent to air control system obtains reference report instruction, and air control system receives
After stating instruction, above-metioned instruction is subjected to fragment by load-balanced server, user information instruction is verified, obtains collage-credit data
Instruction and generation reference report instruction.These instructions, which have, executes sequencing, wherein verifying user information instructs preferential
Grade is greater than the priority for obtaining collage-credit data instruction, and the priority for obtaining collage-credit data instruction, which is greater than, generates reference report instruction
Priority.
Above-mentioned load-balanced server can be attached using various communications protocols with above-mentioned queue server, on
Stating various communications protocols may include hypertext transfer protocol (HyperText transfer protocol, HTTP), file biography
Defeated agreement (file transfer protocol, FTP) and remote terminal protocol etc..
102, first server is chosen from first server cluster, above-mentioned first server cluster takes comprising at least two
Business device;
Specifically, above-mentioned first server cluster may include at least two-server, above-mentioned at least two-server
Performance, configuration and function can be consistent.The command logic sequence that above-mentioned at least two-server executes is identical.
In one possible implementation, above-mentioned load-balanced server can open receiving port, start to receive and
The request message of one or more servers from first server cluster.Receive first of above-mentioned load-balanced server
After request message, using the corresponding server of first message as first server, and receiving port is closed, no longer received
Other request messages.
In one possible implementation, above-mentioned load-balanced server can choose loads in first server cluster
Lower than first threshold server as destination server.Specifically, above-mentioned load-balanced server can use weighted polling
Algorithm calculates the load of one or more servers in first server cluster.Wherein, when in above-mentioned first server cluster
Server is chosen to be after first server, and according to Weighted Round Robin, the load of the server increases, and is chosen to be next time
The probability of first server reduces.
103, above-mentioned first instruction is sent to above-mentioned first server;
After choosing first server in first server cluster, above-mentioned load-balanced server refers to above-mentioned first
Order is sent to above-mentioned first server.
After above-mentioned first server receives above-mentioned first instruction, above-mentioned first instruction is executed.Above-mentioned first server is held
After the completion of above-mentioned first instruction of row, mark can be executed by first and be sent to above-mentioned load-balanced server, so as to above-mentioned load
Equalization server, which determines, executes whether above-mentioned first instruction succeeds.Wherein, above-mentioned first mark is executed for determining above-mentioned first
Server executes whether above-mentioned first instruction succeeds.
In one possible implementation, above-mentioned load-balanced server can be by Connectionless transport service by above-mentioned first
Instruction is sent to above-mentioned first server.I.e. above-mentioned load-balanced server, will after the request for receiving above-mentioned first server
Above-mentioned first instruction is forwarded directly to first server.Alternatively, above-mentioned load-balanced server select above-mentioned first server it
Afterwards, above-mentioned first instruction is sent to above-mentioned first server, after above-mentioned first server receives above-mentioned first instruction, Xiang Shangshu the
One server returns to confirmation message.
In one possible implementation, above-mentioned load-balanced server can by towards connection service by above-mentioned the
One instruction is sent to above-mentioned first server.I.e. above-mentioned load-balanced server can establish connection with above-mentioned first server first
Above-mentioned first instruction is sent to above-mentioned first server by above-mentioned interface channel by channel.Above-mentioned first server receives
After stating the first instruction, confirmation message is replied to above-mentioned load-balanced server by above-mentioned interface channel.
104, it in the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, is selected from second server cluster
Take second server;
In one possible implementation, it after above-mentioned first server executes above-mentioned first instruction of completion, can incite somebody to action
First, which executes mark, returns to load-balanced server.Above-mentioned load-balanced server executes mark according to above-mentioned first, determines
Above-mentioned first server executes whether above-mentioned first instruction succeeds.Above-mentioned load-balanced server is determining that executing above-mentioned first refers to
It enables in successful situation, chooses second server from above-mentioned second server cluster.
In one possible implementation, above-mentioned load-balanced server can open receiving port, start to receive and
The request message of one or more servers from second server cluster.Receive first of above-mentioned load-balanced server
After request message, using the corresponding server of first request message as first server, and receiving port is closed, no longer
Receive other request messages.
In one possible implementation, above-mentioned load-balanced server can choose loads in second server cluster
Lower than second threshold server as destination server.Specifically, above-mentioned load-balanced server can use weighted polling
Algorithm calculates the load of one or more servers in second server cluster.Wherein, when the service in second server cluster
Device is chosen to be after second server, and according to Weighted Round Robin, the load of the server increases, and is chosen to be second next time
The probability of server reduces.
105, above-mentioned second instruction is sent to above-mentioned second server.
After choosing second server in second server cluster, above-mentioned load-balanced server refers to above-mentioned second
Order is sent to above-mentioned second server.
After above-mentioned second server receives above-mentioned second instruction, above-mentioned second instruction is executed.Above-mentioned second server is held
After the completion of above-mentioned second instruction of row, mark can be executed by second and be sent to above-mentioned load-balanced server, so as to above-mentioned load
Equalization server, which determines, executes whether above-mentioned second instruction succeeds.Wherein, above-mentioned second mark is executed for determining above-mentioned second
Server executes whether above-mentioned second instruction succeeds.
In one possible implementation, above-mentioned load-balanced server can be by Connectionless transport service by above-mentioned second
Instruction is sent to above-mentioned second server.I.e. above-mentioned load-balanced server, will after the request for receiving above-mentioned second server
Above-mentioned second instruction is forwarded directly to second server.Alternatively, above-mentioned load-balanced server select above-mentioned second server it
Afterwards, above-mentioned second instruction is sent to above-mentioned second server, after above-mentioned second server receives above-mentioned second instruction, Xiang Shangshu the
Two servers return to confirmation message.
In one possible implementation, above-mentioned load-balanced server can by towards connection service by above-mentioned the
Two instructions are sent to above-mentioned second server.I.e. above-mentioned load-balanced server can establish connection with above-mentioned second server first
Above-mentioned second instruction is sent to above-mentioned second server by above-mentioned interface channel by channel.Above-mentioned second server receives
After stating the second instruction, confirmation message is returned to above-mentioned load-balanced server by above-mentioned interface channel.
Implement the embodiment of the present application, the resource of server, the safety and stability of improve data transfer, drop can be saved
The degree of coupling in low server cluster between each server.
Referring to Fig. 2, Fig. 2 is the flow chart for another data transmission method that the application proposes.This method includes following
Content:
201, load-balanced server receives the first instruction and the second instruction from queue server;
202, the first request message from first server cluster is received;By in first server cluster above-mentioned first
The corresponding server of request message is determined as first server;Alternatively, selection load is lower than first from first server cluster
The server of threshold value is as first server;
Above-mentioned load-balanced server opens receiving process and receiving port, receives in first server cluster one or more
The request message of a server.Above-mentioned request message is used for above-mentioned first instruction of above-mentioned load-balanced server request.
Above-mentioned load-balanced server receives above-mentioned first request message, and above-mentioned first request message is server cluster
In server send at first reach load-balanced server request message.Above-mentioned load-balanced server receives above-mentioned
After first request message, the corresponding server of the first request message above-mentioned in server cluster is determined as first server.
For example, the server in above-mentioned first server cluster can periodically be sent to above-mentioned load-balanced server
Request message, above-mentioned load-balanced server receive from queue server first instruction after, open receiving process and
Receiving port.After above-mentioned load-balanced server receives the request message reached at first, receiving process is closed, it is no longer received
His request message, and using the corresponding server of the request message received as first server.
Above-mentioned load-balanced server can select load lower than the server of first threshold from first server cluster
As first server.Specifically, above-mentioned load-balanced server can use Weighted Round Robin, above-mentioned first service is calculated
The load of each server in device cluster.
For example, above-mentioned first server cluster has three servers, and the weight coefficient of three servers is respectively
0.8,1.0,1.2, load=link weight * weight coefficient of server.When server is chosen to be first server, link
Weight increases by 1.After load-balanced server calculates the load of each server, penultimate load can choose as the
One threshold value, i.e., above-mentioned load-balanced server, which can be chosen, loads minimum server as first server.Alternatively, selection is most
The average value of high load and minimum load is as first threshold, if having the loads of multiple servers lower than first threshold, from negative
It carries in the multiple servers lower than first threshold and randomly selects a server as first server.
203, above-mentioned first instruction is sent to above-mentioned first server;
204, it receives first from above-mentioned first server and executes mark, above-mentioned first executes mark for determining
It states first server and executes whether above-mentioned first instruction succeeds;
In one possible implementation, in the case where above-mentioned first server executes above-mentioned first instruction failure,
Above-mentioned first executes the reason of mark may include execution failure information and abnormal results.
For example, when above-mentioned first server executes above-mentioned first instruction failure, the original for executing failure can be captured
Because of information, the abnormal results for executing and obtaining after failure are obtained, above-mentioned abnormal results are merged with cause information, obtain the first execution
Mark, and execute mark for above-mentioned first and be sent to load-balanced server.
In one possible implementation, when above-mentioned first server executes above-mentioned first and instructs successfully, above-mentioned the
One, which executes mark, may include the one or more that the first implementing result runs succeeded mark with first.Wherein, above-mentioned first
Success flag is the unique identification that load-balanced server is formulated according to preset agreement.
For example, when above-mentioned first server executes above-mentioned first and instructs successfully, above-mentioned first server can be obtained
It gets the first implementing result to run succeeded mark with first, above-mentioned first runs succeeded the mark for identifying and may include the first instruction
The binary system verification data that code and a string of representatives run succeeded.Above-mentioned first server can be by above-mentioned first implementing result
It runs succeeded to identify with above-mentioned first and merge, obtain first identifier.Alternatively, above-mentioned first server can be executed above-mentioned first
As a result cache server is arrived in storage, runs succeeded mark as first identifier for above-mentioned first, and be sent to load balancing service
Device.
205, in the case where above-mentioned first server executes above-mentioned first instruction and generates the number of mistake lower than threshold value, weight
Above-mentioned first instruction is newly sent to above-mentioned first server.
Specifically, according to above-mentioned first identifier, it is above-mentioned to determine that above-mentioned first server executes for above-mentioned load-balanced server
In the case that first instruction generates mistake, calculates above-mentioned first server and execute the number that above-mentioned first instruction generates mistake;If
The number of above-mentioned generation mistake is lower than first threshold, then above-mentioned first instruction is sent to above-mentioned first server again.
Specifically, above-mentioned load-balanced server in the case where the number of above-mentioned generation mistake reaches threshold value, can incite somebody to action
Above-mentioned first server is rejected from first server cluster, i.e., above-mentioned load-balanced server not make by the reselection hardware device
For first server.A server is reselected from the remaining server of above-mentioned first server cluster as first service
Device;Above-mentioned first instruction is sent to above-mentioned first server.
Wherein, above-mentioned to reselect a server as the method for first server and see 202.
206, in the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, from above-mentioned second server cluster
It is middle to choose above-mentioned second server;
It is above-mentioned in the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, from above-mentioned second server cluster
It is middle to choose above-mentioned second server, comprising:
Mark is being executed according to first, is determining that first server execution above-mentioned first instructs in successful situation, from described
Above-mentioned second server is chosen in second server cluster.
Above-mentioned load-balanced server receives above-mentioned first identifier, by above-mentioned first identifier according to preset parsing template
It is parsed, determines that above-mentioned first server executes whether above-mentioned first instruction succeeds.It is executed in above-mentioned first server above-mentioned
In the first successful situation of instruction, second server is chosen from second server cluster.
Above-mentioned load-balanced server opens receiving process and receiving port, receives in second server cluster one or more
The request message of a server.Above-mentioned request message is used for above-mentioned first instruction of above-mentioned load-balanced server request.
Above-mentioned load-balanced server receives above-mentioned second request message, and above-mentioned second request message is second server
Collect the request message for reaching load-balanced server at first of pocket transmission.Above-mentioned load-balanced server receives above-mentioned second and asks
After seeking message, the corresponding server of the second request message above-mentioned in second server cluster is determined as second server.
It in one possible implementation, can be by acquisition after above-mentioned first server executes above-mentioned first instruction
First implementing result is stored into cache server.
207, above-mentioned second instruction is sent to above-mentioned second server;
208, in the case where above-mentioned second server executes above-mentioned second instruction and generates mistake, above-mentioned second is referred to again
Order is sent to above-mentioned second server.
Specifically, above-mentioned load-balanced server, which can receive, executes mark from second server second, above-mentioned second
It executes mark and executes whether above-mentioned second instruction generates mistake for determining above-mentioned second server.
It is above-mentioned above-mentioned second server execute it is above-mentioned second instruction generate mistake in the case where, above-mentioned second is referred to again
Order is sent to above-mentioned second server, comprising:
Mark is being executed according to above-mentioned second, is determining that above-mentioned second server executes the feelings that above-mentioned second instruction generates mistake
Under condition, above-mentioned second instruction is sent to above-mentioned second server again.
It, in one possible implementation, can after above-mentioned second server receives above-mentioned second instruction in conjunction with 206
To read the first implementing result from cache server, using above-mentioned first implementing result as parameter is executed, above-mentioned second is executed
Instruction.After above-mentioned second server executes above-mentioned second instruction of completion, by the storage of the second implementing result into cache server.Its
In, above-mentioned first implementing result is that above-mentioned first server executes above-mentioned first instruction implementing result obtained.
Implement the embodiment of the present application, after first server cluster has executed the first preferential instruction of logical order, will patrol
Second instruction of volume back is sent to second server cluster, and the mode between server without going through broadcast is communicated,
The resource of server can be saved, the safety and stability of improve data transfer reduces each server in server cluster
Between the degree of coupling;Meanwhile different server clusters executes the different instruction of logical order, can simplify appointing for server
Business, improves the performance of server.
Referring to Fig. 3, Fig. 3 is a kind of flow chart of the concrete application scene for data transmission method that the application proposes.It should
Method be applied to air control system, above-mentioned air control system include queue server, load-balanced server, first server cluster and
Second server cluster.Above-mentioned queue server receives the risk assessment instruction of third party's calling system transmission, by above-mentioned finger
It enables and carries out fragment, obtain the instruction of acquisition collage-credit data and generate risk report instruction.Wherein, above-mentioned acquisition collage-credit data instruction
It is executed into later, could execute and generate risk report instruction.
S301, load-balanced server receive the acquisition collage-credit data instruction from queue server and generate risk report
Instruction;
S302, the first request message from first server cluster is received;It will be above-mentioned in first server cluster
The corresponding server of first request message is determined as first server;
Above-mentioned load-balanced server opens the first receiving process and the first receiving port, receives in first server cluster
The request message of one or more servers.Above-mentioned request message is used to request above-mentioned acquisition sign to above-mentioned load-balanced server
Letter data instruction.
Above-mentioned load-balanced server receives above-mentioned first request message, and above-mentioned first request message is first server
The request message for reaching load-balanced server at first that server in cluster is sent.Above-mentioned load-balanced server receives
After above-mentioned first request message, the corresponding server of the first request message above-mentioned in server cluster is determined as first service
Device.
S303, the instruction of above-mentioned acquisition collage-credit data is sent to above-mentioned first server;
After above-mentioned first server receives above-mentioned acquisition collage-credit data instruction, above-mentioned acquisition collage-credit data is executed and has referred to
It enables, the first obtained implementing result will be executed and stored into cache server, and generate first and execute mark.
After above-mentioned first server generates the first execution mark, mark is executed by above-mentioned first and is sent to load balancing service
Device.
S304, it receives and first executes mark from above-mentioned first server;
Above-mentioned first execute mark for judge above-mentioned first server execute above-mentioned acquisition collage-credit data instruction whether at
Function.
S305, judge that above-mentioned first server executes whether above-mentioned acquisition collage-credit data instruction succeeds;
Above-mentioned load-balanced server executes mark according to above-mentioned first, judges that above-mentioned first server executes above-mentioned acquisition
Whether collage-credit data instruction succeeds, if success, thens follow the steps S306;Otherwise, then repeatedly step S303 and S304.
S306, second server is chosen from second server cluster;
Above-mentioned load-balanced server opens the second receiving process and the second receiving port, receives in second server cluster
The request message of one or more servers.Above-mentioned request message is used to request above-mentioned generation wind to above-mentioned load-balanced server
Danger report instruction.
Above-mentioned load-balanced server receives above-mentioned second request message, and above-mentioned second request message is second server
The request message for reaching load-balanced server at first that server in cluster is sent.Above-mentioned load-balanced server receives
After above-mentioned second request message, the corresponding server of the second request message above-mentioned in second server cluster is determined as second
Server.
S307, generation risk report instruction is sent to above-mentioned second server;
After above-mentioned second server receives above-mentioned generation risk report instruction, first is read from cache server and is executed
As a result, executing above-mentioned generation risk report instruction, obtains second and execute mark and the second implementing result.Above-mentioned second server can
Storing the second implementing result into cache server.Wherein, above-mentioned second mark is executed for judging above-mentioned second service
Device executes whether above-mentioned generation risk report instruction succeeds.
S308, judge that above-mentioned second server executes whether above-mentioned generation risk report instruction succeeds;
What above-mentioned load-balanced server received from above-mentioned second server second executes mark, according to above-mentioned second
Mark is executed, judges that above-mentioned second server executes whether above-mentioned generation risk report instruction succeeds.If success, thens follow the steps
S309;Otherwise, S307 and S308 are re-execute the steps.
S309, generation execute mark, above-mentioned execution mark are sent to queue server, above-mentioned execution mark is for indicating
Above-mentioned acquisition collage-credit data instruction and the instruction of above-mentioned generation risk report are performed success.
After above-mentioned queue server receives the above-mentioned mark that runs succeeded, second can be read from cache server and held
Row is as a result, return to third party's calling system for the second implementing result.
Specifically, above-mentioned second server is when executing the report instruction of above-mentioned generation reference, it can be from cache server
Above-mentioned first implementing result is read, using above-mentioned first implementing result as the parameter of implementation procedure.Above-mentioned second server executes
After complete above-mentioned generation reference report instruction, by the storage of the second implementing result into cache server.
Implement the embodiment of the present application, the resource of server, the safety and stability of improve data transfer, drop can be saved
The degree of coupling in low server cluster between each server improves the performance of server.
Referring to Fig. 4, Fig. 4 is a kind of structural schematic diagram for data transmission device that the application proposes, above-mentioned apparatus includes:
First receiving unit 401, for receiving above-mentioned first instruction and above-mentioned second instruction from queue server;
First selecting unit 402, for choosing first server, above-mentioned first server collection from first server cluster
Group includes at least two-server;
First transmission unit 403, for above-mentioned first instruction to be sent to above-mentioned first server;
Second selecting unit 404, in the case where above-mentioned first server executes the successful situation of above-mentioned first instruction, from upper
It states in second server cluster and chooses second server;
Second transmission unit 405, for above-mentioned second instruction to be sent to above-mentioned second server.
As shown in figure 5, above-mentioned apparatus further include:
Second receiving unit 406 first executes mark from above-mentioned first server for receiving, and above-mentioned first holds
Line identifier executes whether above-mentioned first instruction succeeds for determining above-mentioned first server;
First retransmission unit 407 is used in the case where above-mentioned first server executes above-mentioned first instruction and generates mistake,
Again above-mentioned first instruction is sent to above-mentioned first server;
Second retransmission unit 408, specifically for executing the feelings that above-mentioned second instruction generates mistake in above-mentioned second server
Under condition, above-mentioned second instruction is sent to above-mentioned second server again.
In one possible implementation, above-mentioned second selecting unit 404 is specifically used for executing according to above-mentioned first
Mark determines that above-mentioned server executes in the successful situation of above-mentioned first instruction, the second clothes is chosen from second server cluster
Business device.
In one possible implementation, above-mentioned first selecting unit 403 comes from first service specifically for receiving
First request message of device cluster;The corresponding server of first request message above-mentioned in first server cluster is determined as first
Server;Alternatively, selecting load lower than the server of first threshold as first server from first server cluster.
In one possible implementation, above-mentioned first retransmission unit 407, specifically for being held in above-mentioned first server
Above-mentioned first instruction of row generates the number of mistake lower than in the case where threshold value, and above-mentioned first instruction is sent to above-mentioned first clothes again
Business device.
It is understood that the specific implementation of Fig. 4 and data transmission device shown in fig. 5 reference may also be made to Fig. 1, Fig. 2 and Fig. 3 institute
The method shown, is no longer described in detail one by one here.
Implement device provided by the embodiment of the present application, the resource of server, the safety of improve data transfer can be saved
Property and stability, reduce the degree of coupling in server cluster between each server.
Referring to Fig. 6, Fig. 6 is the structural schematic diagram of another data transmission device provided by the embodiments of the present application.The dress
Setting includes: at least one processor 601, such as central processing unit (central processing unit, CPU), at least one
Memory 602, at least one transceiver 603 and at least one bus 604.Wherein, above-mentioned bus 604 can be one group it is parallel
Data line, for realizing the interconnection of above-mentioned processor 601, above-mentioned memory 602 and above-mentioned transceiver 603;Above-mentioned storage
Device 602 can be high-speed random access memory (random access memory, RAM), be also possible to non-volatile memories
Device (non-volatile memory), for example, at least a read-only memory (read only memory, ROM).
Specifically, above-mentioned transceiver 603 can be used for receiving the first instruction and the second instruction from queue server, it will be upper
It states the first instruction and is sent to first server, and above-mentioned second instruction is sent to second server.
In one possible implementation, above-mentioned transceiver 603 can also be used to receive first from first server
It executes mark, and receives and second execute mark from second server.Wherein, above-mentioned first execution mark can be used for judging
Above-mentioned first server executes whether above-mentioned first instruction succeeds, and above-mentioned second, which executes mark, can be used for judging above-mentioned second service
Device executes whether above-mentioned second instruction succeeds.
It can store program instruction in above-mentioned memory 602, above-mentioned processor 601 can be used for caller instruction execution figure
1, method shown in Fig. 2 and Fig. 3.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can
It is completed with instructing relevant hardware by program, which can store in computer readable storage medium, and storage is situated between
Matter include read-only memory (read only memory, ROM), random access memory (random access memory, RAM),
Programmable read only memory (programmable read only memory, PROM), Erasable Programmable Read Only Memory EPROM
(erasable programmable read only memory, EPROM), disposable programmable read-only memory (one-time
Programmable read-only memory, OTPROM), the electronics formula of erasing can make carbon copies read-only memory
(electrically-erasable programmable read-only memory, EEPROM), CD-ROM (compact
Disc read-only memory, CD-ROM) or other disc memories, magnetic disk storage, magnetic tape storage or can
For carrying or any other computer-readable medium of storing data.
A kind of data transmission method and device disclosed in the embodiment of the present application are described in detail above, answered herein
With specific case, the principle and implementation of this application are described, and the explanation of above example is only intended to help to manage
Solve the present processes and its core concept;At the same time, for those skilled in the art, according to the thought of the application,
There will be changes in specific embodiment and application range.In conclusion the content of the present specification should not be construed as to this Shen
Limitation please.
Claims (10)
1. a kind of data transmission method, which is characterized in that be applied to distributed system, the distributed system includes queue service
Device, load-balanced server, first server cluster and second server cluster, the queue server is for receiving
Described instruction is subjected to fragment after instruction from calling system, obtains the first instruction and the second instruction, which comprises
The load-balanced server receives first instruction and second instruction from the queue server;
First server is chosen from the first server cluster, the first server cluster is serviced comprising at least two
Device;
First instruction is sent to the first server;
In the case where the first server executes the successful situation of first instruction, the is chosen from the second server cluster
Two servers include at least two-server in the second server cluster;
Second instruction is sent to the second server.
2. method according to claim 1, which is characterized in that by it is described first instruction be sent to the first server it
Afterwards, described before choosing second server in the second server cluster, further includes:
It receives first from the first server and executes mark, described first executes mark for determining first clothes
Business device executes whether first instruction succeeds;
It is described in the case where the first server executes the successful situation of first instruction, selected from the second server cluster
Take second server, comprising:
Mark is being executed according to described first, is determining that the first server executes in the successful situation of first instruction, from
The second server is chosen in the second server cluster.
3. method according to claim 1 or claim 2, which is characterized in that described to choose first server, packet from server cluster
It includes:
Receive the first request message from first server cluster;
The corresponding server of first request message described in the first server cluster is determined as first server;
Alternatively,
Select load lower than the server of first threshold as first server from first server cluster.
4. method according to claim 1, which is characterized in that by it is described first instruction be sent to the first server it
Afterwards, before choosing second server in the server cluster, further includes:
In the case where the first server executes first instruction and generates mistake, first instruction is sent to institute again
State first server.
5. method according to claim 4, which is characterized in that described to be instructed out in first server execution described first
In the case where existing mistake, first instruction is sent to the first server again, comprising:
It, again will be described in the case where the first server executes first instruction and generates the number of mistake lower than threshold value
First instruction is sent to the first server.
6. method according to claim 1, which is characterized in that second instruction is sent to the second server described
Later, further includes:
In the case where the second server executes second instruction and generates mistake, second instruction is sent to institute again
State second server.
7. a kind of data transmission device characterized by comprising
First receiving unit, for receiving first instruction and second instruction from queue server;
First selecting unit, for choosing first server from first server cluster, the first server cluster includes
At least two-server;
First transmission unit, for first instruction to be sent to the first server;
Second selecting unit is used in the case where the first server executes the successful situation of first instruction, from second service
Second server is chosen in device cluster;
Second transmission unit, for second instruction to be sent to the second server.
8. method according to claim 7, which is characterized in that described device further include:
Second receiving unit first executes mark from the first server for receiving, and described first, which executes mark, uses
Whether succeed in determining that the first server executes described first and instructs;
Second selecting unit is specifically used for executing mark according to described first, determines server execution described the
In the one successful situation of instruction, second server is chosen from the second server cluster.
9. a kind of data transmission device, which is characterized in that including processor and memory;The processor and the memory are logical
Cross bus interconnection;The memory is for storing computer program, and the computer program includes program instruction, the place
Reason device is configured for calling described program instruction, executes such as method as claimed in any one of claims 1 to 6.
10. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has computer journey
Sequence, the computer program include program instruction, and described program instructs when being executed by a processor, execute the processor such as
Method as claimed in any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910043335.4A CN109587278A (en) | 2019-01-16 | 2019-01-16 | Data transmission method and relevant apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910043335.4A CN109587278A (en) | 2019-01-16 | 2019-01-16 | Data transmission method and relevant apparatus |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109587278A true CN109587278A (en) | 2019-04-05 |
Family
ID=65916722
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910043335.4A Pending CN109587278A (en) | 2019-01-16 | 2019-01-16 | Data transmission method and relevant apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109587278A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104484167A (en) * | 2014-12-05 | 2015-04-01 | 广州华多网络科技有限公司 | Task processing method and device |
CN104881466A (en) * | 2015-05-25 | 2015-09-02 | 百度在线网络技术(北京)有限公司 | Method and device for processing data fragments and deleting garbage files |
CN108287756A (en) * | 2018-01-25 | 2018-07-17 | 联动优势科技有限公司 | A kind of method and device of processing task |
CN109144731A (en) * | 2018-08-31 | 2019-01-04 | 中国平安人寿保险股份有限公司 | Data processing method, device, computer equipment and storage medium |
-
2019
- 2019-01-16 CN CN201910043335.4A patent/CN109587278A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104484167A (en) * | 2014-12-05 | 2015-04-01 | 广州华多网络科技有限公司 | Task processing method and device |
CN104881466A (en) * | 2015-05-25 | 2015-09-02 | 百度在线网络技术(北京)有限公司 | Method and device for processing data fragments and deleting garbage files |
CN108287756A (en) * | 2018-01-25 | 2018-07-17 | 联动优势科技有限公司 | A kind of method and device of processing task |
CN109144731A (en) * | 2018-08-31 | 2019-01-04 | 中国平安人寿保险股份有限公司 | Data processing method, device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110855792B (en) | Message pushing method, device, equipment and medium | |
CN104917749B (en) | account registration method and device | |
CN103731499B (en) | Terminal and document transmission method | |
CN115004673B (en) | Message pushing method, device, electronic equipment and computer readable medium | |
CN104936156B (en) | Note transmission method and device | |
CN110955677A (en) | Identity verification method, device and system | |
CN104702647B (en) | Information requesting method and system | |
CN107562555A (en) | The cleaning method and server of duplicate data | |
CN109587278A (en) | Data transmission method and relevant apparatus | |
CN111538588A (en) | Distributed data processing method and related device | |
CN115412609B (en) | Service processing method, device, server and storage medium | |
CN105813040A (en) | Short message sending method, server and mobile terminal | |
CN115952515A (en) | Data security processing method and device based on big data | |
CN113098763B (en) | Instant communication message sending method, device, storage medium and equipment | |
CN108600308A (en) | Data uploading method, device, storage medium and server | |
CN113098978B (en) | Data transmission method, device and medium | |
CN109905459A (en) | A kind of data transmission method and device | |
CN113313278A (en) | Commemorative coin reservation method based on block chain, user terminal and block chain link point | |
CN114862500A (en) | Order processing method and device, electronic equipment and storage medium | |
CN111010441B (en) | Block chain cross-chain method and system and electronic equipment | |
CN115766696A (en) | File uploading method and device, electronic equipment and storage medium | |
CN108880994B (en) | Method and device for retransmitting mails | |
CN109347760B (en) | Data sending method and device | |
CN113746924A (en) | Power grid service data trans-regional transmission method and device | |
CN110337115A (en) | A method of wechat payment perception is judged based on Transmission Control Protocol |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190405 |
|
WD01 | Invention patent application deemed withdrawn after publication |