CN104410632A - Method and device for synchronizing business data - Google Patents

Method and device for synchronizing business data Download PDF

Info

Publication number
CN104410632A
CN104410632A CN201410699181.1A CN201410699181A CN104410632A CN 104410632 A CN104410632 A CN 104410632A CN 201410699181 A CN201410699181 A CN 201410699181A CN 104410632 A CN104410632 A CN 104410632A
Authority
CN
China
Prior art keywords
service
function
class
synchronization information
service server
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.)
Granted
Application number
CN201410699181.1A
Other languages
Chinese (zh)
Other versions
CN104410632B (en
Inventor
覃炜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huaduo Network Technology Co Ltd
Original Assignee
Guangzhou Huaduo Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Huaduo Network Technology Co Ltd filed Critical Guangzhou Huaduo Network Technology Co Ltd
Priority to CN201410699181.1A priority Critical patent/CN104410632B/en
Publication of CN104410632A publication Critical patent/CN104410632A/en
Application granted granted Critical
Publication of CN104410632B publication Critical patent/CN104410632B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multi Processors (AREA)

Abstract

The invention discloses a method and a device for synchronizing business data and belongs to the field of internet communication. The method includes that once the fact that a procedure code of running business generates first business data is monitored by a first business server, a class and a function, used for generating the first business data, of the procedure code are acquired; according to the class and the function, first synchronous information corresponding to the first business data is acquired, to be specific, the first synchronous information contains class identification, function identification and parameter type and value of the function; the first synchronous information is transmitted to business servers except the first business server of a business server group corresponding to the business, causing the business servers except the first one execute the class and the function to generate first business data according to the first synchronous information, thus the first business data are synchronized. The device comprises a first acquiring module, a second acquiring module and a sending module. By the use of the method and the device, bandwidth resources are saved, and business data synchronization efficiency is improved.

Description

Method and device for synchronizing service data
Technical Field
The present invention relates to the field of internet communications, and in particular, to a method and an apparatus for synchronizing service data.
Background
Currently, to relieve the pressure on the service server caused by the huge access amount, a plurality of service servers are generally used to provide services for one service. When service data is generated on one service server, the service server needs to synchronize the generated service data to other service servers, so as to ensure that the other service servers can provide services for the service according to the service data.
Currently, the prior art provides a method for synchronizing service data, which includes: a data server is set in advance, and the data server is used for storing service data of a service. The service corresponds to a plurality of service servers, and when service data is generated on any one of the plurality of service servers, the service server transmits the generated service data to the data server, and the data server stores the service data. When a service server receives a service request for reading the service data, the service server sends a request for acquiring the service data to a data server, acquires the service data from the data server to realize the synchronization of the service data to the service server, and then sends the acquired service data to a user.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
each time of generating service data, the generated service data is sent to the data server, and when the service data needs to be read, the service data is obtained from the data server, so that a large amount of bandwidth resources are occupied, and when the capacity of the generated service data is large, the time spent on sending the service data is long, and the efficiency of synchronizing the service data is low.
Disclosure of Invention
In order to save bandwidth resources and improve the efficiency of synchronizing service data, the invention provides a method and a device for synchronizing service data. The technical scheme is as follows:
a method of synchronizing traffic data, the method comprising:
when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function used for generating the first service data in the program code;
acquiring first synchronization information corresponding to the first service data according to the class and the function, wherein the first synchronization information comprises a class identifier of the class, a function identifier of the function, and a parameter type and a parameter value of a parameter included in the function;
and sending the first synchronization information to each other service server except the first service server in the service server group corresponding to the service, so that each other service server executes the class and the function according to the first synchronization information to generate the first service data, thereby realizing synchronization of the first service data.
An apparatus for synchronizing traffic data, the apparatus comprising:
the system comprises a first acquisition module, a first service server and a second acquisition module, wherein the first acquisition module is used for acquiring a class and a function used for generating first service data in a program code when the first service server monitors that the program code of an operation service generates the first service data;
a second obtaining module, configured to obtain, according to the class and the function, first synchronization information corresponding to the first service data, where the first synchronization information includes a class identifier of the class, a function identifier of the function, and a parameter type and a parameter value of a parameter included in the function;
a sending module, configured to send the first synchronization information to each service server in a service server group corresponding to the service, except for the first service server, so that each service server executes the class and the function according to the first synchronization information to generate the first service data, thereby synchronizing the first service data.
In the embodiment of the invention, when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function for generating the first service data in the program code; according to the class and the function, first synchronization information corresponding to the first service data is obtained, wherein the first synchronization information comprises class identification of the class, function identification of the function, and parameter types and parameter values of parameters included in the function; and sending first synchronization information to each other service server except the first service server in the service server group corresponding to the service, so that each other service server generates first service data according to the execution class and the function of the first synchronization information respectively, thereby realizing the synchronization of the first service data. Because the capacity of the first synchronization information is very small, the bandwidth occupied by sending the first synchronization information is very small, the speed of sending the first synchronization information is very high, and after each other service server receives the first synchronization information, the first service data is quickly generated according to the first synchronization information, so that the network bandwidth is saved, and the efficiency of synchronizing the service data is improved.
Drawings
Fig. 1 is a flowchart of a method for synchronizing service data according to embodiment 1 of the present invention;
fig. 2 is a flowchart of a method for synchronizing service data according to embodiment 2 of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for synchronizing service data according to embodiment 3 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Example 1
Referring to fig. 1, an embodiment of the present invention provides a method for synchronizing service data, including:
step 101: when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function for generating the first service data in the program code;
step 102: according to the class and the function, first synchronization information corresponding to the first service data is obtained, wherein the first synchronization information comprises class identification of the class, function identification of the function, and parameter types and parameter values of parameters included in the function;
step 103: and sending first synchronization information to each other service server except the first service server in the service server group corresponding to the service, so that each other service server generates first service data according to the execution class and the function of the first synchronization information respectively, thereby realizing the synchronization of the first service data.
Preferably, the obtaining of the first synchronization information corresponding to the first service data according to the class and the function includes:
acquiring a class identifier of the class and a function identifier of the function;
acquiring each parameter included in the function, respectively acquiring a parameter value of each parameter, and acquiring a parameter type of each parameter value;
and the acquired class identifier, function identifier, parameter type and parameter value form first synchronization information corresponding to the first service data.
Preferably, the sending the first synchronization information to each service server except the first service server in the service server group corresponding to the service includes:
the method comprises the steps that the address of each service server except a first service server in a service server group corresponding to a service is obtained from a control server, and first synchronization information is sent to each other service server according to the address of each other service server; or,
and sending the first synchronization information, the service identifier of the service and the identifier of the first service server to the control server, so that the control server respectively sends the first synchronization information to each other service server according to the address of each other service server except the first service server in the service server group corresponding to the service.
Further, the method further comprises:
receiving second synchronous information sent by a second service server, wherein the second synchronous information comprises a class identifier, a function identifier, a parameter type and a parameter value;
and executing the class corresponding to the class identifier and the function corresponding to the function identifier according to the second synchronization information to generate second service data.
Preferably, executing the class corresponding to the class identifier and the function corresponding to the function identifier according to the second synchronization information to generate the second service data includes:
acquiring a class corresponding to the class identifier from the program code according to the class identifier included in the second synchronization information;
acquiring a function corresponding to the function identifier from the program code according to the function identifier included in the second synchronization information;
and executing the acquired class and the acquired function according to the parameter type and the parameter value included in the second synchronization information to generate second service data.
In the embodiment of the invention, when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function for generating the first service data in the program code; according to the class and the function, first synchronization information corresponding to the first service data is obtained, wherein the first synchronization information comprises class identification of the class, function identification of the function, and parameter types and parameter values of parameters included in the function; and sending first synchronization information to each other service server except the first service server in the service server group corresponding to the service, so that each other service server generates first service data according to the execution class and the function of the first synchronization information respectively, thereby realizing the synchronization of the first service data. Because the capacity of the first synchronization information is very small, the bandwidth occupied by sending the first synchronization information is very small, the speed of sending the first synchronization information is very high, and after each other service server receives the first synchronization information, the first service data is quickly generated according to the first synchronization information, so that the network bandwidth is saved, and the efficiency of synchronizing the service data is improved.
Example 2
The embodiment of the invention provides a method for synchronizing service data.
At present, in order to relieve the pressure on the service server caused by huge access volume, a plurality of service servers are generally used for providing service for one service, so that one service corresponds to one service server group. When one service server in the service server group generates service data, the service server can synchronize the generated service data to each service server in the service server group except the service server by using the method provided by the embodiment of the invention.
The service also corresponds to a load balancing server, and is used for balancing the load pressure of each service server in the service server group corresponding to the service. When the load balancing server receives a service request of the service, the load balancing server determines a service server with the minimum load pressure according to the load condition of each service server in the service server group, and forwards the service request to the determined service server.
Referring to fig. 2, the method specifically includes:
step 201: when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function for generating the first service data in the program code;
when writing a program code of a service, a technician labels classes and functions capable of generating service data in the program code, and then stores the program code of the service in each service server included in a service server group corresponding to the service.
Wherein a class is a type of data in object-oriented programming that describes a class of things having common characteristics. The interior of the class encapsulates functions, and the class needs to be instantiated at runtime as an object having the characteristics of the class description through which the function is called. For example, a "teacher" is a class that describes the common features of all teachers. The class "teacher" may encapsulate the "prepare lesson" function and the "view lesson preparation" function. Instantiating the class "teacher" may result in an object "plum teacher". At run-time, the function "prepare lesson" or "view lesson book" is called by the object "li teacher". The 'li teacher' calls the function 'to prepare lessons' to generate service data, and the 'li teacher' calls the function 'to check lessons' to generate service data.
The instantiation of the class as the object is to open up a storage space in the memory for storing the data information of the object. For example, the class "teacher" is instantiated as an object "li teacher", which is to create a storage space in the memory to store the data information of "li teacher", and the data information of "li teacher" may include the name of the class and the name of the course taught by "li teacher".
The method specifically includes that when a first service server receives a service request forwarded by a load balancing server, a program code of the service is operated to process the service request, at the moment, the first service server monitors the program code of the service, when it is monitored that a certain labeled class in the program code calls a certain labeled function, the class and the function are judged to be executed and first service data are generated, and at the moment, the class and the function are obtained from the program code.
The first service server is any one service server in the service server group corresponding to the service.
For example, when a first service server receives a service request forwarded by a load balancing server, the first service server runs a program code of the service 1 to process the service request, and monitors the program code of the service 1, and when it is monitored that a certain labeled class in the program code calls a certain labeled function, it is determined that the class and the function are executed and first service data is generated. The labeled class is assumed to be the class "teacher" and the labeled function is the function "prepare lesson". At this point the class "teacher" and the function "prepare lesson" are obtained from the program code.
Step 202: acquiring first synchronization information corresponding to the first service data according to the acquired class and function, wherein the first synchronization information comprises class identification of the class, function identification of the function, and parameter type and parameter value of parameters included in the function;
the class identifier of the class may be a class name of the class, and the function identifier of the function may be a function name of the function. The function comprises at least one parameter, and when the function is operated, the parameter comprised in the function is endowed with a parameter value, the parameter value has a corresponding parameter type, and the parameter type can be integer type or character type.
Specifically, the step is to acquire the class name of the class from the class as the class identifier of the class. And acquiring the function name of the function from the function as the function identification of the function. Obtaining each parameter included in the function, respectively obtaining a parameter value of each parameter, and obtaining a parameter type of each parameter value. And the acquired class identifier, function identifier, parameter type and parameter value form first synchronization information corresponding to the first service data.
For example, the class name "teacher" of the class is acquired from the class "teacher" as the class identification of the class. And acquiring the function name 'lesson preparation' of the function from the function 'lesson preparation' as the function identification of the function. Each parameter included in the function "lesson preparation" is obtained, the function "lesson preparation" is assumed to include parameters "teacher", "course" and "page number", the parameter value "li teacher" of the parameter "teacher", the parameter value "language" of the parameter "course" and the parameter value "5 pages" of the parameter "page number" are obtained, and the parameter types of the parameter values "li teacher", "language" and the parameter value "5 pages" are all integer types. And the acquired class identifier 'teacher', the function identifier 'lesson preparation', the parameter value 'li teacher' and the parameter type integer thereof, the parameter value 'language' and the parameter type integer thereof, and the parameter value '5 pages' and the parameter type integer thereof form first synchronization information S1 corresponding to the first service data.
After the first synchronization information corresponding to the first service data is obtained through the operations in steps 201 and 202, the first service data may be synchronized to each service server, except the first service server, included in the service server group corresponding to the service through the following operation in step 203.
Step 203: sending first synchronization information to each service server except the first service server in the service server group corresponding to the service, so that each other service server executes the type and the function according to the first synchronization information to generate first service data, thereby realizing synchronization of the first service data;
the network can also be provided with a control server, and the control server stores the corresponding relation between the identification and the address of each service server included in the service server group corresponding to the service. The control server and the load balancing server may be the same server or different servers.
The step can be realized by the following first and second modes, specifically:
first, a first service server sends a service identifier of the service and an identifier of the first service server to a control server. The control server obtains the service server group corresponding to the service from the corresponding relation between the service identifier and the service server group according to the service identifier of the service, obtains the identifier of each service server except the first service server from the service server group according to the identifier of the first service server, then obtains the address of each service server except the first service server from the corresponding relation between the identifier of the service server and the address according to the identifier of each service server, and returns the address of each service server to the first service server. And the first service server respectively sends first synchronization information to each other service server according to the address of each other service server. After receiving the first synchronization information, each of the other service servers executes the class and the function according to the first synchronization information to generate first service data, so as to synchronize the first service data.
For example, assume that the service server group includes service servers 1, 2, and 3, where service server 1 is the first service server. The first service server 1 sends the service identity B1 of the service 1 and the identity F1 of the first service server to the control server. The control server obtains the service server group (F1, F2, F3) corresponding to the service 1 from the correspondence between the service identifier and the service server group shown in table 1 according to the service identifier B1 of the service 1, obtains the identifiers of the service servers 2 and 3 other than the first service server from the service server group (F1, F2, F3) according to the identifier F1 of the first service server as F2 and F3 respectively, then obtains the addresses of the service servers 2 and 3 other than the first service server 1 in the service server group (F1, F2, F3) as URL2 and URL3 respectively from the correspondence between the identifiers and the addresses of the service servers as shown in table 2 according to the identifiers F2 and F3 of the service servers 2 and 3, and returns the addresses 2 and URL3 of the service servers 2 and 3 to the first service server 1. The first service server 1 transmits the first synchronization information S1 to the service servers 2 and 3 according to the address URLs 2 and 3 of the service servers 2 and 3, respectively. After the service servers 2 and 3 receive the first synchronization information S1, the class "teacher" and the function "prepare lessons" are executed according to the first synchronization information S1, respectively, to generate first service data, so as to implement synchronization of the first service data.
TABLE 1
Service identification Business server group
B1 (F1、F2、F3)
…… ……
TABLE 2
Identification of a service server Address of service server
F1 URL1
F2 URL2
F3 URL3
Secondly, the first service server sends the first synchronization information, the service identifier of the service and the identifier of the first service server to the control server. The control server obtains the corresponding service server group from the corresponding relation between the service identifier and the service server group according to the service identifier of the service, obtains the identifier of each service server except the first service server from the obtained service server group according to the identifier of the first service server, and then obtains the address of each service server from the corresponding relation between the identifier of the service server and the address according to the identifier of each service server. And the control server respectively sends the first synchronization information to each other service server according to the address of each other service server. After receiving the first synchronization information, each of the other service servers executes the class and the function according to the first synchronization information to generate first service data, so as to synchronize the first service data.
For example, the first service server 1 transmits the first synchronization information S1, the service identity B1 of the service 1, and the identity F1 of the first service server to the control server. The control server obtains the corresponding service server group (F1, F2, F3) from the corresponding relationship between the service identifier and the service server group shown in table 1 according to the service identifier B1 of the service 1, obtains the identifiers of the service servers 2 and 3 except the first service server 1 as F2 and F3 from the obtained service server group (F1, F2, F3) according to the identifier F1 of the first service server, and then obtains the addresses of the service servers 2 and 3 as URLs 2 and 3 from the corresponding relationship between the identifiers and the addresses of the service servers shown in table 2 according to the identifiers F2 and F3 of the service servers 2 and 3. The control server transmits the first synchronization information S1 to the service servers 2 and 3 according to the address URLs 2 and 3 of the service servers 2 and 3, respectively. After the service servers 2 and 3 receive the first synchronization information S1, the class "teacher" and the function "prepare lessons" are executed according to the first synchronization information S1, respectively, to generate first service data, so as to implement synchronization of the first service data.
When the service data is generated for each service server except the first service server included in the service server group corresponding to the service, the generated service data may be synchronized with the first service server according to the operations of step 201 and step 203.
The first service server may obtain the first synchronization information when generating the first service data, and send the first synchronization information to each of the service servers included in the service server group except the first service server. It is also possible to receive the second synchronization information sent by the other service server and generate the second service data according to the second synchronization information by the following operations of steps 204 and 205.
Step 204: the first service server receives second synchronous information sent by a second service server, wherein the second synchronous information comprises a class identifier, a function identifier, a parameter type and a parameter value;
the second service server is any service server except the first service server in the service server group corresponding to the service.
For example, the first service server 1 receives the second synchronization information S2 sent by the second service server 2, and the second synchronization information S2 includes a class identifier "teacher", a function identifier "lesson preparation", a parameter value "teacher" and its corresponding parameter type integer, "math" and its corresponding parameter type integer, and a parameter value "10 pages" and its corresponding parameter type integer.
Step 205: and executing the class corresponding to the class identifier and the function corresponding to the function identifier according to the second synchronization information to generate second service data.
Specifically, according to the class identifier included in the second synchronization information, a class corresponding to the class identifier is obtained from the program code of the service. And acquiring a function corresponding to the function identifier from the program code of the service according to the function identifier included in the second synchronization information. And executing the acquired class and function according to the parameter type and the parameter value included in the second synchronous information to generate second service data.
The obtained class and function may be executed in the following manner:
and instantiating the acquired class according to the parameter type and the parameter value included in the second synchronous information to obtain an object. And substituting the parameter type and the parameter value included in the second synchronization information into the acquired function, and calling the function through the object to generate second service data.
For example, based on the class identification "teacher" included in the second synchronization information S2, the class "teacher" corresponding to the class identification is acquired from the program code of the service 1. According to the function identifier "lesson preparation" included in the second synchronization information S2, the function "lesson preparation" corresponding to the function identifier is obtained from the program code of service 1. The acquired class "teacher" is instantiated as the object "teacher" according to the parameter value "teacher" and its data type integer included in the second synchronization information S2. The parameter value "math" and its parameter type integer, and the parameter value "10 pages" and its parameter type integer included in the second synchronization information S2 are substituted into the function "lesson preparation", and the function "lesson preparation" is called by the object "teacher" so that "teacher prepares lessons on math to obtain 10 pages of lesson preparation records", thereby generating the second service data.
When each of the other service servers included in the service server group corresponding to the service receives the synchronization information, the service server group and the first service server may generate service data according to the synchronization information according to the operations of the above steps 204 and 205, so as to complete synchronization of the service data.
In the embodiment of the invention, when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function for generating the first service data in the program code; according to the class and the function, first synchronization information corresponding to the first service data is obtained, wherein the first synchronization information comprises class identification of the class, function identification of the function, and parameter types and parameter values of parameters included in the function; and sending first synchronization information to each other service server except the first service server in the service server group corresponding to the service, so that each other service server generates first service data according to the execution class and the function of the first synchronization information respectively, thereby realizing the synchronization of the first service data. Because the capacity of the first synchronization information is very small, the bandwidth occupied by sending the first synchronization information is very small, the speed of sending the first synchronization information is very high, and after each other service server receives the first synchronization information, the first service data is quickly generated according to the first synchronization information, so that the network bandwidth is saved, and the efficiency of synchronizing the service data is improved.
Example 3
Referring to fig. 3, an embodiment of the present invention provides an apparatus for synchronizing service data, including:
a first obtaining module 301, configured to, when it is monitored that a program code of an operating service generates first service data, obtain a class and a function used for generating the first service data in the program code;
a second obtaining module 302, configured to obtain first synchronization information corresponding to the first service data according to the class and the function, where the first synchronization information includes a class identifier of the class, a function identifier of the function, and a parameter type and a parameter value of a parameter included in the function;
the sending module 303 is configured to send first synchronization information to each other service server in the service server group corresponding to the service, except for the first service server, so that each other service server generates first service data according to the first synchronization information execution class and the function, respectively, to implement synchronization of the first service data.
Wherein, the second obtaining module 302 includes:
the first obtaining unit is used for obtaining the class identifier of the class and the function identifier of the function;
the second obtaining unit is used for obtaining each parameter included in the function, respectively obtaining the parameter value of each parameter, and obtaining the parameter type of each parameter value;
and the composition unit is used for composing the acquired class identifier, function identifier, parameter type and parameter value into first synchronization information corresponding to the first service data.
Wherein, the sending module 303 includes:
a first sending unit, configured to obtain, from the control server, an address of each of the other service servers in the service server group corresponding to the service, except the first service server, and send first synchronization information to each of the other service servers according to the addresses of each of the other service servers; or,
and the second sending unit is used for sending the first synchronization information, the service identifier of the service and the identifier of the first service server to the control server, so that the control server respectively sends the first synchronization information to other service servers according to the addresses of other service servers except the first service server in the service server group corresponding to the service.
Further, the apparatus further comprises:
the receiving module is used for receiving second synchronous information sent by a second service server, wherein the second synchronous information comprises a class identifier, a function identifier, a parameter type and a parameter value;
and the execution module is used for executing the class corresponding to the class identifier and the function corresponding to the function identifier according to the second synchronous information so as to generate second service data.
Wherein, the execution module includes:
a third obtaining unit, configured to obtain, according to the class identifier included in the second synchronization information, a class corresponding to the class identifier from the program code;
a fourth obtaining unit, configured to obtain, according to the function identifier included in the second synchronization information, a function corresponding to the function identifier from the program code;
and the execution unit is used for executing the acquired class and the acquired function according to the parameter type and the parameter value included in the second synchronous information so as to generate second service data.
In the embodiment of the invention, when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function for generating the first service data in the program code; according to the class and the function, first synchronization information corresponding to the first service data is obtained, wherein the first synchronization information comprises class identification of the class, function identification of the function, and parameter types and parameter values of parameters included in the function; and sending first synchronization information to each other service server except the first service server in the service server group corresponding to the service, so that each other service server generates first service data according to the execution class and the function of the first synchronization information respectively, thereby realizing the synchronization of the first service data. Because the capacity of the first synchronization information is very small, the bandwidth occupied by sending the first synchronization information is very small, the speed of sending the first synchronization information is very high, and after each other service server receives the first synchronization information, the first service data is quickly generated according to the first synchronization information, so that the network bandwidth is saved, and the efficiency of synchronizing the service data is improved.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method for synchronizing traffic data, the method comprising:
when monitoring that a program code of an operation service generates first service data, a first service server acquires a class and a function used for generating the first service data in the program code;
acquiring first synchronization information corresponding to the first service data according to the class and the function, wherein the first synchronization information comprises a class identifier of the class, a function identifier of the function, and a parameter type and a parameter value of a parameter included in the function;
and sending the first synchronization information to each other service server except the first service server in the service server group corresponding to the service, so that each other service server executes the class and the function according to the first synchronization information to generate the first service data, thereby realizing synchronization of the first service data.
2. The method of claim 1, wherein the obtaining first synchronization information corresponding to the first service data according to the class and the function comprises:
acquiring a class identifier of the class and a function identifier of the function;
acquiring each parameter included in the function, respectively acquiring a parameter value of each parameter, and acquiring a parameter type of each parameter value;
and forming the acquired class identification, the function identification, the parameter type and the parameter value into first synchronization information corresponding to the first service data.
3. The method of claim 1, wherein the sending the first synchronization information to each service server other than the first service server in the service server group corresponding to the service comprises:
acquiring the address of each other service server except the first service server in a service server group corresponding to the service from a control server, and respectively sending the first synchronization information to each other service server according to the address of each other service server; or,
and sending the first synchronization information, the service identifier of the service and the identifier of the first service server to the control server, so that the control server respectively sends the first synchronization information to each other service server according to the address of each other service server except the first service server in the service server group corresponding to the service.
4. The method of claim 1, wherein the method further comprises:
receiving second synchronous information sent by a second service server, wherein the second synchronous information comprises a class identifier, a function identifier, a parameter type and a parameter value;
and executing the class corresponding to the class identifier and the function corresponding to the function identifier according to the second synchronization information to generate second service data.
5. The method of claim 4, wherein the executing the class corresponding to the class identifier and the function corresponding to the function identifier to generate second service data according to the second synchronization information comprises:
according to the class identification included in the second synchronous information, obtaining a class corresponding to the class identification from a program code;
acquiring a function corresponding to the function identifier from the program code according to the function identifier included in the second synchronization information;
and executing the acquired class and the acquired function according to the parameter type and the parameter value included in the second synchronization information to generate second service data.
6. An apparatus for synchronizing traffic data, the apparatus comprising:
the system comprises a first acquisition module, a first service server and a second acquisition module, wherein the first acquisition module is used for acquiring a class and a function used for generating first service data in a program code when the first service server monitors that the program code of an operation service generates the first service data;
a second obtaining module, configured to obtain, according to the class and the function, first synchronization information corresponding to the first service data, where the first synchronization information includes a class identifier of the class, a function identifier of the function, and a parameter type and a parameter value of a parameter included in the function;
a sending module, configured to send the first synchronization information to each service server in a service server group corresponding to the service, except for the first service server, so that each service server executes the class and the function according to the first synchronization information to generate the first service data, thereby synchronizing the first service data.
7. The apparatus of claim 6, wherein the second obtaining module comprises:
a first obtaining unit, configured to obtain a class identifier of the class and a function identifier of the function;
a second obtaining unit, configured to obtain each parameter included in the function, respectively obtain a parameter value of each parameter, and obtain a parameter type of each parameter value;
and the composing unit is used for composing the acquired class identifier, the function identifier, the parameter type and the parameter value into first synchronization information corresponding to the first service data.
8. The apparatus of claim 6, wherein the sending module comprises:
a first sending unit, configured to obtain, from a control server, an address of each of the other service servers in the service server group corresponding to the service, except for the first service server, and send the first synchronization information to each of the other service servers according to the address of each of the other service servers; or,
and a second sending unit, configured to send the first synchronization information, the service identifier of the service, and the identifier of the first service server to the control server, so that the control server sends the first synchronization information to each other service server according to an address of each other service server in the service server group corresponding to the service, except the first service server.
9. The apparatus of claim 6, wherein the apparatus further comprises:
the receiving module is used for receiving second synchronous information sent by a second service server, wherein the second synchronous information comprises a class identifier, a function identifier, a parameter type and a parameter value;
and the execution module is used for executing the class corresponding to the class identifier and the function corresponding to the function identifier according to the second synchronization information so as to generate second service data.
10. The apparatus of claim 9, wherein the execution module comprises:
a third obtaining unit, configured to obtain, according to a class identifier included in the second synchronization information, a class corresponding to the class identifier from a program code;
a fourth obtaining unit, configured to obtain, according to a function identifier included in the second synchronization information, a function corresponding to the function identifier from the program code;
and the execution unit is used for executing the acquired class and the acquired function according to the parameter type and the parameter value included in the second synchronization information so as to generate second service data.
CN201410699181.1A 2014-11-26 2014-11-26 A kind of method and device of synchronous service data Active CN104410632B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410699181.1A CN104410632B (en) 2014-11-26 2014-11-26 A kind of method and device of synchronous service data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410699181.1A CN104410632B (en) 2014-11-26 2014-11-26 A kind of method and device of synchronous service data

Publications (2)

Publication Number Publication Date
CN104410632A true CN104410632A (en) 2015-03-11
CN104410632B CN104410632B (en) 2018-01-16

Family

ID=52648230

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410699181.1A Active CN104410632B (en) 2014-11-26 2014-11-26 A kind of method and device of synchronous service data

Country Status (1)

Country Link
CN (1) CN104410632B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070271309A1 (en) * 2006-05-22 2007-11-22 Microsoft Corporation Synchronizing structured web site contents
CN101640588A (en) * 2009-08-18 2010-02-03 中兴通讯股份有限公司 Method and system for synchronizing and processing data
CN102184237A (en) * 2011-05-11 2011-09-14 中山市中商港科技有限公司 Service data synchronization method between associated platforms based on network
CN102571695A (en) * 2010-12-16 2012-07-11 腾讯科技(深圳)有限公司 Data synchronization method and game server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070271309A1 (en) * 2006-05-22 2007-11-22 Microsoft Corporation Synchronizing structured web site contents
CN101640588A (en) * 2009-08-18 2010-02-03 中兴通讯股份有限公司 Method and system for synchronizing and processing data
CN102571695A (en) * 2010-12-16 2012-07-11 腾讯科技(深圳)有限公司 Data synchronization method and game server
CN102184237A (en) * 2011-05-11 2011-09-14 中山市中商港科技有限公司 Service data synchronization method between associated platforms based on network

Also Published As

Publication number Publication date
CN104410632B (en) 2018-01-16

Similar Documents

Publication Publication Date Title
CN111176976A (en) Test data generation method and device, storage medium and electronic device
CN106411970B (en) A kind of fault handling method based on service call, device and system
CN112579118B (en) Method, device, system, medium and equipment for updating configuration information of micro-service
CN112580730B (en) Terminal type identification method and device
CN102904977A (en) Network address allocation method, server and node
CN101115180B (en) Electronic program menu system and functional module dynamic load operating method
CN106021512A (en) Page refresh method and apparatus
CN110602171B (en) Interaction method and device
CN107273112B (en) Method and device for displaying gift list information
CN108399095A (en) Dynamic is supported to manage method, system, equipment and the storage medium of timed task
CN113360413A (en) Code testing method and device
CN103473106B (en) Method and system for generating page
CN104410632B (en) A kind of method and device of synchronous service data
CN113836212B (en) Method for automatically generating Json data by database data, readable medium and electronic equipment
CN106686150A (en) Backup method and system of application information, client and cloud server
CN114285779B (en) Processing method, device and system of test request
CN114490318B (en) Environment treatment system and method for realizing weak isolation based on byte code enhancement
CN105447141A (en) Data processing method and node
CN108023920B (en) Data packet transmission method, equipment and application interface
CN111294220A (en) Network isolation configuration method and device based on nginx
CN110602172B (en) Link identification generation method and device
CN108228145A (en) Data processing method, system and the mobile equipment of mixed type application program
CN109324820B (en) Host updating method, device, equipment and medium
CN112346979A (en) Software performance testing method, system and readable storage medium
CN110134547B (en) Middleware-based repeated data deleting method and related device

Legal Events

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

Address after: 511446 Guangzhou City, Guangdong Province, Panyu District, South Village, Huambo Business District Wanda Plaza, block B1, floor 28

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

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

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

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20150311

Assignee: GUANGZHOU CUBESILI INFORMATION TECHNOLOGY Co.,Ltd.

Assignor: GUANGZHOU HUADUO NETWORK TECHNOLOGY Co.,Ltd.

Contract record no.: X2021980000151

Denomination of invention: A method and device for synchronizing service data

Granted publication date: 20180116

License type: Common License

Record date: 20210107

EE01 Entry into force of recordation of patent licensing contract