CN110309157A - A kind of data synchronization updating method and apparatus - Google Patents

A kind of data synchronization updating method and apparatus Download PDF

Info

Publication number
CN110309157A
CN110309157A CN201810181865.0A CN201810181865A CN110309157A CN 110309157 A CN110309157 A CN 110309157A CN 201810181865 A CN201810181865 A CN 201810181865A CN 110309157 A CN110309157 A CN 110309157A
Authority
CN
China
Prior art keywords
data
database
switch value
update
latest
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
Application number
CN201810181865.0A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810181865.0A priority Critical patent/CN110309157A/en
Publication of CN110309157A publication Critical patent/CN110309157A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of data synchronization updating method and apparatus, are related to field of computer technology.One specific embodiment of this method includes: to obtain the data cached corresponding latest data from database when listening to the update of data cached corresponding database data;It is updated according to the latest data got described data cached.When the embodiment is able to solve multiple operation systems acquisition same item datas, each operation system data synchronize difficult problem after data update, data can quickly and efficiently be read, reduce network overhead and time-consuming, the risk of reading data time-out when reduction data volume is larger, guarantee system stability, moreover it is possible to reduce the pressure of database connection while realizing data isolation.

Description

A kind of data synchronization updating method and apparatus
Technical field
The present invention relates to field of computer technology more particularly to a kind of data synchronization updating method and apparatus.
Background technique
In daily exploitation, such case can be encountered: there is partial data seldom to change, but according to service conditions needs It modifies once in a while.For example, the system template data in page finished system, can often make in page fitment process in user With these system template, system template will not often change, but can adjust sporadically depending on business needs.And these system moulds Plate data volume size is from tens kb (kilobytes) to several hundred kb etc., it is therefore desirable to be buffered, prevent from frequently inquiring data Library causes stress database.
These data usually have the feature that first is that data will not often change, but can change once in a while, therefore data are not It can be taken as the configuration of pure static state, once data content needs to modify, it is necessary to and modification configures and restarts application, and needs support Online modification;Second is that data volume may be larger, so that IO (input and output) consumption transmitted in a network and time loss all compare It is larger, transmission in a network should be reduced to the greatest extent;Third is that these data are business datums, deposit in the same database table or In the table of multiple and different type of database, it is difficult to be made into static configuration file, and also it is not recommended that (or not allowing) is business Data are put into configuration management system;Fourth is that usually multiple operation systems all need to read this partial data.
Existing scheme process as shown in Figure 1 (only for traffic engineered 1, similarly, scheme by other traffic engineered execution processes In be not shown).The program provides individual management backstage to carry out the operation such as increasing or modify data newly, and data are synchronized to In storage medium (may be various databases or disk).Also, the globally shared caching of use (such as a kind of redis (number According to library)) it is data cached, the operation system in need for accessing these data, inquire in " the redis caching " of oneself first whether There are data, obtain data if so, then directly caching from redis, inquires database otherwise to obtain data from database.
In realizing process of the present invention, at least there are the following problems in the prior art for inventor's discovery:
When multiple operation systems obtain same item data, data are cached to the redis caching of each operation system, work as data After management backstage update, it is difficult to be synchronized in the redis caching of each operation system;
Each operation system obtains data from redis cluster, and time-consuming reaches a millisecond rank, and network overhead is big, and in data Large data objects (data more than 500kb) frequently are obtained from redis cluster when measuring larger, it is more likely that overtime phenomenon occur;
Multiple operation systems require to be connected to that the same MySQL (a kind of relevant database), (one kind is based on MongDB Distributed document storage database) etc. databases, can greatly increase database connection pressure.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of data synchronization updating method and apparatus, it is able to solve multiple business When system obtains same item data, each operation system data synchronize difficult problem after data update, and can quickly and efficiently read number According to, network overhead and time-consuming are reduced, the risk of reading data time-out when reduction data volume is larger, guarantee system stability, moreover it is possible to Reduce the pressure of database connection while realizing data isolation.
To achieve the above object, according to an aspect of an embodiment of the present invention, a kind of data synchronization updating method is provided.
A kind of data synchronization updating method, comprising: when listening to the update of data cached corresponding database data, from number The data cached corresponding latest data is obtained according to library;It is updated according to the latest data got described data cached.
Optionally, it is updated by the switch value variation in listening key's value list to monitor the database data.
Optionally, the step that the database data updates is monitored by the switch value variation in listening key's value list Suddenly, comprising: the switch value in the switch value list is read periodically with the preset time cycle;By the switch value read and this The switch value that ground has been deposited compares, and such as the two compares inconsistent, then listens to the database data and update.
Optionally, the step of database data updates is monitored by the switch value variation in listening key's value list Before, comprising: receive the latest data, and the switch value in the switch value list is modified according to the latest data;It will The database data is updated to the latest data.
Optionally, by calling preset database service interface to obtain the latest data from the database.
Optionally, described data cached to be cached in local memory.
According to another aspect of an embodiment of the present invention, a kind of data synchronization updating device is provided.
A kind of data synchronization updating device, comprising: obtain module, listen to data cached corresponding database number for working as When according to updating, the data cached corresponding latest data is obtained from database;Update module, for according to getting Latest data updates described data cached.
Optionally, the acquisition module includes monitoring submodule, is used for: being become by the switch value in listening key's value list Change to monitor the database data and update.
Optionally, the monitoring submodule is also used to: periodically being read in the switch value list with the preset time cycle Switch value;The switch value read and the local switch value deposited are compared, such as the two compares inconsistent, then listens to described Database data updates.
Optionally, further include management module, be used for: receiving the latest data, and institute is modified according to the latest data State the switch value in switch value list;The database data is updated to the latest data.
Optionally, the acquisition module is also used to: by calling preset database service interface to obtain from the database The latest data.
Optionally, the update module is also used to: according to the latest data update local memory got It is data cached.
Another aspect according to an embodiment of the present invention, provides a kind of electronic equipment.
A kind of electronic equipment, comprising: one or more processors;Memory works as institute for storing one or more programs When stating one or more programs and being executed by one or more of processors, so that one or more of processors realize this hair The data synchronization updating method of bright offer.
Another aspect according to an embodiment of the present invention, provides a kind of computer-readable medium.
A kind of computer-readable medium is stored thereon with computer program, realizes this when described program is executed by processor The data synchronization updating method provided is provided.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that when listening to data cached corresponding number When updating according to library data, data cached corresponding latest data is obtained from database, multiple operation systems is able to solve and obtains together When one item data, each operation system data synchronize difficult problem after data update;It is cached in local memory by data cached, it can be fast Speed efficiently reads data, reduces network overhead and time-consuming, and the risk of reading data time-out when reduction data volume is larger guarantees system System stability;By calling preset database service interface to obtain latest data from database, data isolation can be being realized Reduce the pressure of database connection simultaneously.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is the technical framework diagram that the data of existing scheme update;
Fig. 2 is the key step schematic diagram of data synchronization updating method according to an embodiment of the present invention;
Fig. 3 is the technical framework diagram of dynamic configuration data synchronized update according to an embodiment of the present invention;
Fig. 4 is the main modular schematic diagram of data synchronization updating device according to an embodiment of the present invention;
Fig. 5 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 6 is adapted for the structural schematic diagram for the computer system for realizing the server of the embodiment of the present invention.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Fig. 2 is the key step schematic diagram of data synchronization updating method according to an embodiment of the present invention.
As shown in Fig. 2, the data synchronization updating method of the embodiment of the present invention mainly includes the following steps, namely S201 to step S202。
Step S201: it when listening to the update of data cached corresponding database data, is obtained from database data cached Corresponding latest data.
By taking java is developed as an example, each operation system is usually deployed multiple jvm (Java Virtual Machine) example, and jvm example is The thread started on startup using the program that java is developed.A certain size memory headroom can be distributed in each jvm example, claimed For jvm memory.A switch value list is safeguarded in each jvm example, it is corresponding which is stored in the jvm example In jvm memory, the corresponding item data of each switch value in value list is switched.
For each jvm example, the data cached data that can be stored in the corresponding jvm memory of the jvm example, number Be the corresponding data being stored in database profession according to library data, due to it is data cached be to be read out from database and be saved in this Certain data in jvm memory, therefore, this is data cached the corresponding data (database data) in the database.For example, certain Template data saves in the database, then correspondingly the template data is database data in database, when operation system needs When using the template data, the template data is obtained from database, and is saved in the corresponding jvm memory of jvm example, then, The template data in this jvm memory is as data cached.
When operation system is needed using certain data, first determining whether, which whether there is in the corresponding jvm memory of the jvm example, is somebody's turn to do Data, and if it exists, then obtain data from the jvm memory, otherwise will obtain the data in database, and data are stored in this Jvm memory obtains when reusing the data so as to operation system from the jvm memory.
Each jvm example can be changed by the switch value in listening key's value list to monitor data cached corresponding number It is updated according to library data.
It is updated by the switch value variation in listening key's value list to monitor data cached corresponding database data Specific steps include: with the switch value in regular read switch value list of preset time cycle;By the switch value read with The local switch value deposited compares, and such as the two compares inconsistent, then listens to database data update.Wherein, the week time Phase periodically can according to need sets itself, such as be set as 10s (second).The switch value that jvm example has locally been deposited is stored in this Switch value in the switch value list of the corresponding jvm memory of jvm example.
It is updated by the switch value variation in listening key's value list to monitor data cached corresponding database data Before step, data cached corresponding latest data is received, and the switch value in switch value list is modified according to the latest data, And database data is updated to the latest data.Wherein, specifically can be by calling preset database service interface, it will Database data is updated to latest data.
When listening to data cached corresponding database data and being updated to latest data, it can pass through and call preset data Database where service interface from the latest data obtains the latest data.Illustrate step S201, it is assumed that data cached It is to obtain from database since this is data cached for the template data (version I) in certain page finished system, number According in library, there is also the template data (version I) in the page finished system, i.e., data cached corresponding database datas.It is false If data cached corresponding database data is updated to version II by version I, when listening to data cached corresponding database When data update, then data cached corresponding latest data is obtained from the database, that is, obtain the data cached corresponding page Template data (version II) in the finished system of face.
Since (micro services framework is a kind of specific software architecture mode to system " micro services ", and large software is torn open It is divided into the service having a single function) usually require the service database that operation system exclusively enjoys oneself.The embodiment of the present invention provides unified Database service interface, by call the database service interface from database obtain latest data, after solving " micro services " Data isolation problem so that only one operation system is by calling number of the database service interface just in reading database According to, and other operation systems can only call the database service interface, reduce the pressure of database connection.
Step S202: it is updated according to the latest data got data cached.
It is data cached to be cached in local memory.For each jvm example, the local memory i.e. jvm example is corresponding Jvm memory.Data cached process is updated according to the latest data got, and latest data is synchronized to the local memory Process.
Data synchronization updating method according to an embodiment of the present invention, when certain item data updates, then the item data is corresponding Switch value changes, and expression needs synchronous latest data (respective cache data are updated to latest data), each business system System listens to switch value variation, and (by calling database service interface) obtains latest data from database, solves multiple industry When business system obtains same item data, each operation system data synchronize difficult problem after data update
The data that the embodiment of the present invention updates can be dynamic configuration data, and dynamic configuration data will not often change, But the data that can be changed once in a while according to service conditions, such as the system mould in electric business field in shop and loose-leaf finished system Plate data carry out in page fitment process in user, these system template can be commonly used, and system template data will not often become Change, but can adjust sporadically depending on business needs.The skill of the dynamic configuration data synchronized update of the embodiment of the present invention is described below Art framework.
Fig. 3 is the technical framework diagram of dynamic configuration data synchronized update according to an embodiment of the present invention.
As shown in figure 3, the Technical Architecture of the dynamic configuration data synchronized update of the embodiment of the present invention includes multiple independent parts The system engineering of administration, specifically includes: database service interface engineering, the management end man engineering, configuration management engineering, multiple business works Journey.Lower mask body introduces the function of each system engineering.
Data service in database service interface engineering provides preset database service interface, which is will RPC (remote procedure call) interface made of the operations encapsulation such as the newly-increased of dynamic configuration data, deletion, modification, lookup, data clothes Business Interface Engineering is directly connected to each database, and other systems can call the database service interface to execute to dynamic in database The operations such as the newly-increased of configuration data, deletion, modification, lookup.The database of the embodiment of the present invention can be a kind of MySQL (relationship Type database), MongDB (it is a kind of based on distributed document storage database) etc., database also by other storage mediums (such as Disk) etc. replace.It is mainly illustrated by taking database as an example below.
Manage the end man engineering, that is, management backstage, including operation interface, by operation interface can to dynamic configuration data into The updates operations such as row is newly-increased, modifies, deletes.The management backstage is not directly connected database corresponding to the dynamic configuration data, But the database service interface by calling database service interface engineering to provide, by the corresponding latest data of the dynamic configuration data It is synchronized to database, the dynamic configuration data in database is updated to latest data.In addition, being received by operation interface After latest data, which modifies the switch value in switch value list according to the latest data, switchs and wraps in value list One or more switch values are included, the corresponding switch value of every item data in dynamic configuration data, when certain item data is in operation interface It is middle modified after, management backstage i.e. modify switch value list in the corresponding switch value of the item data, indicate that the item data has update. Switch value list is provided by configuration management engineering, and the concrete function of configuration management engineering will be described in detail later.
Configuration management engineering is a configuration management system, can be provided in the switch value of line modification configuration, configuration management System can be the inside public resource of enterprise etc..The type and quantity of dynamic configuration data in one operation system may be very It is more, it can be one switch value of each data configuration, the switch value of all data forms a switch value list, and is matched with switch The form for setting file is configured in configuration management system, for example, it is assumed that having 4 dynamic configuration datas (template 1, template 2, template 3, template 4), switch value can be respectively as follows:
The configuration switch of module1=0//template 1
The configuration switch of module2=0//template 2
The configuration switch of module3=0//template 3
The configuration switch of module4=0//template 4
Switch value variation, which is used to indicate corresponding dynamic configuration data, update, i.e., if a certain switch value changes, It indicates that the corresponding dynamic configuration data of the switch value has update, then needs to update the dynamic configuration data in caching, the present invention is real Example is applied using configuration management system synchronous switch value, realizes that efficiently data are synchronous.
Multiple traffic engineered, each one operation system of traffic engineered correspondence, major function includes: dynamic for initializing State configuration data is to local memory.Specifically, traffic engineered in program starting, database service interface engineering can be called to provide Database service interface reads out the dynamic configuration data needed for this operation system from database, and is stored in local memory In (dynamic configuration data in local memory be above-mentioned data cached).The embodiment of the present invention is by taking java is developed as an example, often A operation system is usually deployed multiple jvm (Java Virtual Machine) example, and the program that jvm example uses java to develop is on startup The thread of starting.A certain size memory headroom, referred to as jvm memory can be distributed in each jvm example.For each jvm example For, initialization dynamic configuration data to local memory reads dynamic configuration data (by calling data clothes from database Business interface is read) it comes out, and be stored in the corresponding jvm memory of this jvm example.
It, can be directly real from current jvm when needing to use dynamic configuration data when traffic engineered in program process It is obtained in the jvm memory of example.
Since the embodiment of the present invention obtains dynamic configuration data from local jvm memory, without network overhead, time-consuming is few (in nanosecond rank), data reading speed are fast, and slave redis cluster compared with the prior art obtains data, and (time-consuming reaches millisecond Rank), the embodiment of the present invention can quickly and efficiently read data, reduce network overhead and time-consuming, number when reduction data volume is larger According to the risk for reading time-out.Moreover it is possible to guarantee system stability, even configuration management engineering, the management end man engineering, number All break down according to service interface engineering, it is each traffic engineered or can use each jvm memory in data operate normally, only These data cannot be modified.
It is traffic engineered to be also used to register configuration management engineering, with synchronous switch value to jvm memory.In each jvm example Safeguard that a switch value list, the switch value list are stored in the corresponding jvm memory of the jvm example.It is traffic engineered in program Register configuration management engineering when starting, specifically include: it is corresponding that the switch value in configuration management engineering is synchronized to each jvm example Jvm memory in.
The traffic engineered dynamic configuration data for being also used to update in jvm memory.The management end man engineering (i.e. management backstage) exists After modifying a certain dynamic configuration data, the access interface that configuration management engineering can be called to provide modifies this in configuration management engineering The corresponding switch value (such as module1=1) of dynamic configuration data.Each traffic engineered each jvm example monitors configuration pipe The switch value situation of change of respective switch value list in science and engineering journey changes, then when a jvm example listens to corresponding switch value Newest switch value list is stored in corresponding jvm memory, and calls database service interface work by the switch value after obtaining the variation The database service interface that journey provides is updated the latest data with obtaining the latest data of the dynamic configuration data from database Into corresponding jvm memory, thus when operation system needs these data again, it can obtain latest data from jvm memory. It, can be every 10 seconds (tools when jvm example monitors the switch value situation of change of the corresponding switch value list in configuration management engineering Body numerical value can be set as needed) read configuration management engineering in respective switch value list (the respective switch value list is i.e. Switch value list in configuration management engineering corresponding with the switch value list safeguarded in the jvm example), and opened what is read The switch value closed in value list is compared with the switch value in jvm memory, if the two comparison is inconsistent, that is, listens to dynamic configuration Data have update, then the database service interface for calling database service interface engineering to provide obtains dynamic configuration data pair from database The latest data answered, and the dynamic configuration data in jvm memory is updated according to the latest data.It is that MySQL is with database Example, it is assumed that five data item (i.e. five dynamic configuration datas) in MySQL database table (abbreviation MySQL table) are managed in configuration Switch value list in science and engineering journey can be following form:
Template1=1
Template2=0
Template3=2
Template4=3
Template5=5
Wherein, template1 to template5 can be referred to as configuration item (or configuration switch), each configuration item (configuration Switch) value be switch value.
The template1 each configuration item into template5 corresponds to a data item in above-mentioned MySQL table, if Wherein the corresponding data item of template5 has update, then the access that managing the end man engineering can call configuration management engineering to provide connects The corresponding numerical value of template5 (switch value) is increased by 1 by mouth, it may be assumed that " template5=5 " is revised as " template5=6 ", industry The switch value situation of change of jvm example listening key's value list of business system, specifically, (such as 10 seconds) are read at regular intervals Take the switch value list in configuration management engineering, and by the switch value in the switch value list read and opening in jvm memory It closes value list to compare, due to switch value " template5=5 " in jvm memory, accordingly the switch value in configuration management engineering is arranged In table, which has been modified to " template5=6 ", so that the two comparison is inconsistent, then the jvm example calls data The database service interface that service interface engineering provides, obtains the corresponding latest data of the data item from database, and most according to this New data updates the data item in jvm memory.
Fig. 4 is the main modular schematic diagram of data synchronization updating device according to an embodiment of the present invention.
It obtains module 401 as shown in figure 4, the data synchronization updating device 400 of the embodiment of the present invention specifically includes that, update Module 402.
Module 401 is obtained to be used to obtain from database slow when listening to the update of data cached corresponding database data The corresponding latest data of deposit data.
Obtaining module 401 specifically can be by calling preset database service interface to obtain the latest data from database.
Obtaining module 401 may include monitoring submodule, for being supervised by the switch value variation in listening key's value list Database data is listened to update.
Monitoring submodule specifically can be used for: with the switch value in regular read switch value list of preset time cycle; The switch value read and the local switch value deposited are compared, such as the two compares inconsistent, then listens to database data more Newly.
Data synchronization updating device 400 can also include management module, for receiving latest data, and according to latest data Switch value in modification switch value list;And database data is updated to latest data.
Management module may include that data update submodule, be used for: by calling preset database service interface, by data Library data are updated to latest data.
Update module 402 is used to be updated according to the latest data got data cached.
Update module 402 specifically can update the data cached of local memory according to the latest data got.
The Technical Architecture of the dynamic configuration data synchronized update of the embodiment of the present invention as shown in connection with fig. 3, above-mentioned acquisition mould Block 401 and the corresponding function of update module 402 can realize that the corresponding function of management module can pass through by traffic engineered The end man engineering (i.e. management backstage) Lai Shixian is managed, the switch value list that submodule is periodically read is monitored and is stored in configuration management In the switchgear distribution file of engineering, the local switch value deposited can be stored in the jvm memory of operation system local, preset Database service interface is provided by database service interface engineering.
The data synchronization updating device 400 of the embodiment of the present invention is using switch value configuration management and provides independent data clothes The mode of business interface, is in time synchronized to data (such as dynamic configuration data) in the jvm memory of operation system, guarantees business system System can quickly and efficiently get latest data when needing these data.
In addition, the specific implementation content of data synchronization updating device, data described above are same in embodiments of the present invention It has been described in detail in step update method, therefore has no longer illustrated in this duplicate contents.
Fig. 5, which is shown, can apply the data synchronization updating method of the embodiment of the present invention or showing for data synchronization updating device Example property system architecture 500.
As shown in figure 5, system architecture 500 may include terminal device 501,502,503, network 504 and server 505. Network 504 between terminal device 501,502,503 and server 505 to provide the medium of communication link.Network 504 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 501,502,503 and be interacted by network 504 with server 505, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 501,502,503 The application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform software etc..
Terminal device 501,502,503 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 505 can be to provide the server of various services, such as utilize terminal device 501,502,503 to user The shopping class website browsed provides the back-stage management server supported.Back-stage management server can believe the template received The data such as breath inquiry request carry out the processing such as analyzing, and processing result (such as Template Information) is fed back to terminal device.
It should be noted that data synchronization updating method provided by the embodiment of the present invention is generally executed by server 505, Correspondingly, data synchronization updating device is generally positioned in server 505.
It should be understood that the number of terminal device, network and server in Fig. 5 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 6, it illustrates the computer systems 600 for the terminal device for being suitable for being used to realize the embodiment of the present application Structural schematic diagram.Terminal device shown in Fig. 6 is only an example, function to the embodiment of the present application and should not use model Shroud carrys out any restrictions.
As shown in fig. 6, computer system 600 includes central processing unit (CPU) 601, it can be read-only according to being stored in Program in memory (ROM) 602 or be loaded into the program in random access storage device (RAM) 603 from storage section 608 and Execute various movements appropriate and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data. CPU 601, ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to always Line 604.
I/O interface 605 is connected to lower component: the importation 606 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 607 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 608 including hard disk etc.; And the communications portion 609 of the network interface card including LAN card, modem etc..Communications portion 609 via such as because The network of spy's net executes communication process.Driver 610 is also connected to I/O interface 605 as needed.Detachable media 611, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 610, in order to read from thereon Computer program be mounted into storage section 608 as needed.
Particularly, disclosed embodiment according to the present invention, can be by above with reference to the process of key step schematic diagram description It is embodied as computer software programs.For example, embodiment disclosed by the invention includes a kind of computer program product comprising carrying Computer program on a computer-readable medium, the computer program include for executing side shown in key step schematic diagram The program code of method.In such embodiments, the computer program can be downloaded from network by communications portion 609 and Installation, and/or be mounted from detachable media 611.When the computer program is executed by central processing unit (CPU) 601, hold The above-mentioned function of being limited in the system of row the application.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In this application, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this In application, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
Key step schematic diagram and block diagram in attached drawing, illustrate according to the system of the various embodiments of the application, method and The architecture, function and operation in the cards of computer program product.In this regard, in key step schematic diagram or block diagram Each box can represent a part of a module, program segment or code, one of above-mentioned module, program segment or code Subpackage is containing one or more executable instructions for implementing the specified logical function.It should also be noted that at some as replacement Realization in, function marked in the box can also occur in a different order than that indicated in the drawings.For example, two in succession The box that ground indicates can actually be basically executed in parallel, they can also be executed in the opposite order sometimes, this is according to involved And function depending on.It is also noted that each box and block diagram or key step in block diagram or key step schematic diagram The combination of box in schematic diagram, can the dedicated hardware based systems of the functions or operations as defined in executing realize, Or it can realize using a combination of dedicated hardware and computer instructions.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet It includes and obtains module 401, update module 402.Wherein, the title of these modules is not constituted to the module itself under certain conditions Restriction, be also described as example, obtaining module 401 " for when listening to data cached corresponding database data more When new, the module of data cached corresponding latest data is obtained from database ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes Obtaining the equipment includes: to obtain from database described data cached when listening to the update of data cached corresponding database data Corresponding latest data;It is updated according to the latest data got described data cached.
Technical solution according to an embodiment of the present invention, when listening to the update of data cached corresponding database data, from Database obtains data cached corresponding latest data, and when being able to solve multiple same item datas of operation systems acquisition, data are more Each operation system data synchronize difficult problem after new;It is cached in local memory by data cached, can quickly and efficiently read data, Network overhead and time-consuming are reduced, the risk of reading data time-out when reduction data volume is larger guarantees system stability;Pass through calling Preset database service interface obtains latest data from database, can reduce database connection while realizing data isolation Pressure.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention Within.

Claims (14)

1. a kind of data synchronization updating method characterized by comprising
When listening to the update of data cached corresponding database data, obtained from database described data cached corresponding newest Data;
It is updated according to the latest data got described data cached.
2. the method according to claim 1, wherein being supervised by the switch value variation in listening key's value list The database data is listened to update.
3. according to the method described in claim 2, it is characterized in that, being supervised by the switch value variation in listening key's value list The step of listening the database data to update, comprising:
The switch value in the switch value list is periodically read with the preset time cycle;
The switch value read and the local switch value deposited are compared, such as the two compares inconsistent, then listens to the data Library data update.
4. according to the method described in claim 2, it is characterized in that, being supervised by the switch value variation in listening key's value list Before the step of listening the database data to update, comprising:
The latest data is received, and the switch value in the switch value list is modified according to the latest data;
The database data is updated to the latest data.
5. the method according to claim 1, wherein by calling preset database service interface from the data Library obtains the latest data.
6. data cached being cached in local memory the method according to claim 1, wherein described.
7. a kind of data synchronization updating device characterized by comprising
Module is obtained, for obtaining the caching from database when listening to the update of data cached corresponding database data The corresponding latest data of data;
Update module, it is described data cached for being updated according to the latest data got.
8. device according to claim 7, which is characterized in that the acquisition module includes monitoring submodule, is used for:
It is updated by the switch value variation in listening key's value list to monitor the database data.
9. device according to claim 8, which is characterized in that the monitoring submodule is also used to:
The switch value in the switch value list is periodically read with the preset time cycle;
The switch value read and the local switch value deposited are compared, such as the two compares inconsistent, then listens to the data Library data update.
10. device according to claim 8, which is characterized in that further include management module, be used for:
The latest data is received, and the switch value in the switch value list is modified according to the latest data;
The database data is updated to the latest data.
11. device according to claim 7, which is characterized in that the acquisition module is also used to:
By calling preset database service interface to obtain the latest data from the database.
12. device according to claim 7, which is characterized in that the update module is also used to:
The described data cached of local memory is updated according to the latest data got.
13. a kind of electronic equipment characterized by comprising
One or more processors;
Memory, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors Realize such as method as claimed in any one of claims 1 to 6.
14. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor Such as method as claimed in any one of claims 1 to 6 is realized when row.
CN201810181865.0A 2018-03-06 2018-03-06 A kind of data synchronization updating method and apparatus Pending CN110309157A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810181865.0A CN110309157A (en) 2018-03-06 2018-03-06 A kind of data synchronization updating method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810181865.0A CN110309157A (en) 2018-03-06 2018-03-06 A kind of data synchronization updating method and apparatus

Publications (1)

Publication Number Publication Date
CN110309157A true CN110309157A (en) 2019-10-08

Family

ID=68073649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810181865.0A Pending CN110309157A (en) 2018-03-06 2018-03-06 A kind of data synchronization updating method and apparatus

Country Status (1)

Country Link
CN (1) CN110309157A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111694868A (en) * 2020-06-16 2020-09-22 北京同邦卓益科技有限公司 Data caching method and device, electronic equipment and storage medium
CN113542326A (en) * 2020-04-17 2021-10-22 上海际链网络科技有限公司 Data caching method and device for distributed system, server and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942259A (en) * 2014-03-21 2014-07-23 浙江大学 Method for achieving data caching in database synchronization process
CN104580522A (en) * 2015-01-30 2015-04-29 宁波凯智信息科技有限公司 Client-server data synchronization method and system
CN105335170A (en) * 2014-06-05 2016-02-17 阿里巴巴集团控股有限公司 Distributed system and incremental data updating method
CN106980625A (en) * 2016-01-18 2017-07-25 阿里巴巴集团控股有限公司 A kind of method of data synchronization, apparatus and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942259A (en) * 2014-03-21 2014-07-23 浙江大学 Method for achieving data caching in database synchronization process
CN105335170A (en) * 2014-06-05 2016-02-17 阿里巴巴集团控股有限公司 Distributed system and incremental data updating method
CN104580522A (en) * 2015-01-30 2015-04-29 宁波凯智信息科技有限公司 Client-server data synchronization method and system
CN106980625A (en) * 2016-01-18 2017-07-25 阿里巴巴集团控股有限公司 A kind of method of data synchronization, apparatus and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113542326A (en) * 2020-04-17 2021-10-22 上海际链网络科技有限公司 Data caching method and device for distributed system, server and storage medium
CN111694868A (en) * 2020-06-16 2020-09-22 北京同邦卓益科技有限公司 Data caching method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109413127B (en) Data synchronization method and device
CN109542445A (en) A kind of method and apparatus that Android plug-in unit melts hair
CN109274731A (en) Deployment, call method and the device of web services based on multi-tenant technology
CN109189835A (en) The method and apparatus of the wide table of data are generated in real time
CN112417051A (en) Container arrangement engine resource management method and device, readable medium and electronic equipment
CN110019539A (en) A kind of method and apparatus that the data of data warehouse are synchronous
CN110134427A (en) A kind of method and apparatus generating code file
CN110377416A (en) Distributed subregion method for scheduling task and device
CN110309157A (en) A kind of data synchronization updating method and apparatus
CN110795741A (en) Method and device for carrying out security processing on data
CN112084254A (en) Data synchronization method and system
CN113778565A (en) Interface data processing method and device
CN109933484A (en) Big data cluster quasi real time container resource allocation monitoring analysis method
CN117609226A (en) Information stream data storage method and device, electronic equipment and readable medium
CN111429127A (en) Service management method and device applied to payment
CN112953719A (en) Token authentication method and device
CN110019525A (en) A kind of method and apparatus of data-base capacity-enlarging
CN110019059A (en) A kind of method and apparatus of Timing Synchronization
CN110147285A (en) Message treatment method and device based on message queue
CN109117339A (en) A kind of method and system that daily record data saves
CN110851192B (en) Method and device for responding to degraded switch configuration
CN110244975A (en) A kind of generation method and device of static resource version number
CN110347654A (en) A kind of method and apparatus of online cluster features
CN114756227A (en) Resource release processing method and device
CN109788010A (en) A kind of method and apparatus of data localization access

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