Data query method, device, computer equipment and storage medium

By prioritizing data requests from the update server in a high concurrency environment, the problem of high latency of data query is solved and the efficiency of data query is improved.

CN113672640BActive Publication Date: 2025-04-29SHENZHEN YUNZHIJIA NETWORK CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202110720645.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-28
Publication Date
2025-04-29
Estimated Expiration
2041-06-28

AI Technical Summary

Technical Problem

In the case of a large number of user terminal requests with high concurrency, existing data query methods can easily cause serious timeout of user requests, resulting in low data query efficiency.

Method used

By receiving the query request, the query request carries user identification information, query data corresponding to the query request from the update server, and the update server is used to record incremental data within the preset time period. If the data is queried, it will be returned to the user terminal; if it is not queried, it will be queried from the baseline service cluster and return the data.

Benefits of technology

Separate incremental data into the update server, and read data from the update server when querying, which can efficiently hit data and quickly query data corresponding to the query request, solving the problem of high latency in data queries under a large number of data, effectively improving the efficiency of data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113672640B_ABST
    Figure CN113672640B_ABST
Patent Text Reader

Abstract

The present application relates to a data query method, device, computer equipment and storage medium. The method comprises: receiving a query request; the query request carries user identification information; querying data corresponding to the query request from an update server; the update server is used to record incremental data within a preset time period; if data corresponding to the query request is queried, the data is returned to a user terminal corresponding to the user identification information. The use of this method can effectively improve the efficiency of data query.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data query method, device, computer equipment and storage medium. Background Art

[0002] With the development of computer technology, the number of users of Internet products has increased sharply, and the number of concurrent accesses is very high. A single server can no longer serve a huge number of users at the same time. Therefore, the server can build a server cluster to improve the system throughput and ensure service redundancy.

[0003] However, in the current data query method, a master-slave replication mechanism is usually used to synchronize data from the master server to the slave server. The slave server can provide services to users instead of the master server, but in the case of high-concurrency requests from a large number of user terminals, there will still be serious timeout problems for user requests, which can easily lead to low data query efficiency. Summary of the invention

[0004] Based on this, it is necessary to provide a data query method, device, computer equipment and storage medium that can improve data query efficiency in response to the above technical problems.

[0005] A data query method, the method comprising:

[0006] receiving a query request, wherein the query request carries user identification information;

[0007] Querying data corresponding to the query request from an update server; the update server is used to record incremental data within a preset time period;

[0008] If data corresponding to the query request is found, the data is returned to the user terminal corresponding to the user identification information.

[0009] In one embodiment, after querying the update server for data corresponding to the query request, the method further includes:

[0010] If no data corresponding to the query request is found, the data corresponding to the query request is found from the baseline service cluster, and the data found in the baseline service cluster is returned to the user terminal corresponding to the user identification information.

[0011] In one embodiment, receiving the query request includes:

[0012] Receive query requests distributed by load balancing servers in the server cluster.

[0013] In one embodiment, the update server includes an update master server and an update slave server; the update master server is used to write data; the update slave server is used to read data;

[0014] The querying of data corresponding to the query request from the update server includes:

[0015] The update slave server is queried for data corresponding to the query request.

[0016] A data query device, comprising:

[0017] A receiving module, used to receive a query request; the query request carries user identification information;

[0018] A query module, used to query data corresponding to the query request from an update server; the update server is used to record incremental data within a preset time period;

[0019] The sending module is used for returning the data to the user terminal corresponding to the user identification information if the data corresponding to the query request is found.

[0020] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0021] receiving a query request, wherein the query request carries user identification information;

[0022] Querying data corresponding to the query request from an update server; the update server is used to record incremental data within a preset time period;

[0023] If data corresponding to the query request is found, the data is returned to the user terminal corresponding to the user identification information.

[0024] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0025] receiving a query request, wherein the query request carries user identification information;

[0026] Querying data corresponding to the query request from an update server; the update server is used to record incremental data within a preset time period;

[0027] If data corresponding to the query request is found, the data is returned to the user terminal corresponding to the user identification information.

[0028] The above-mentioned data query method, device, computer equipment and storage medium receive a query request, the query request carries user identification information, and queries the data corresponding to the query request from the update server, and the update server is used to record the incremental data within a preset time period. If the data corresponding to the query request is queried, the data is returned to the user terminal corresponding to the user identification information. As a result, the incremental data is separated into the update server, and the data is read from the update server first during the query, which can efficiently hit the data and quickly query the data corresponding to the query request, thereby solving the problem of high latency in data query in the case of a large amount of data and effectively improving the efficiency of data query.

[0029] A data synchronization method, the method comprising:

[0030] Get incremental data within a preset time period;

[0031] The incremental data is written to the first server in the baseline service cluster according to a preset time period to instruct the second server to synchronize the incremental data through a preset replication mechanism; wherein the first server is used to write data and the second server is used to read data.

[0032] In one embodiment, the method further comprises:

[0033] Detecting the operating status of the baseline service cluster;

[0034] If the baseline service cluster is in an idle state, the incremental data is written to a first server in the baseline service cluster.

[0035] A data synchronization device, comprising:

[0036] An acquisition module is used to acquire incremental data within a preset time period;

[0037] A writing module is used to write the incremental data to the first server in the baseline service cluster according to a preset time period to instruct the second server to synchronize the incremental data through a preset replication mechanism; wherein the first server is used to write data and the second server is used to read data.

[0038] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0039] Get incremental data within a preset time period;

[0040] The incremental data is written to the first server in the baseline service cluster according to a preset time period to instruct the second server to synchronize the incremental data through a preset replication mechanism; wherein the first server is used to write data and the second server is used to read data.

[0041] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0042] Get incremental data within a preset time period;

[0043] The incremental data is written to the first server in the baseline service cluster according to a preset time period to instruct the second server to synchronize the incremental data through a preset replication mechanism; wherein the first server is used to write data and the second server is used to read data.

[0044] The above-mentioned data synchronization method, apparatus, computer equipment and storage medium obtain the incremental data within a preset time period, write the incremental data to the first server in the baseline service cluster according to the preset time period, and instruct the second server to synchronize the incremental data through a preset replication mechanism. The first server is used to write data, and the second server is used to read data. As a result, the updated server data is written to the baseline service cluster according to the preset time period, and the time when high latency occurs is also controlled during the business slack period, which greatly reduces the impact on users. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 An application environment diagram of a data query method in an embodiment;

[0046] Figure 2 A schematic diagram of a flow chart of a data query method in an embodiment;

[0047] Figure 3 A schematic diagram of a flow chart of a data synchronization method in an embodiment;

[0048] Figure 4A is a flow chart of a data query method in another embodiment;

[0049] Figure 4B A schematic diagram of a server cluster processing a query request sent by a user terminal in one embodiment;

[0050] Figure 4C An architectural diagram of data query processing in one embodiment;

[0051] Figure 5 is a structural block diagram of a data query device in an embodiment;

[0052] Figure 6is a structural block diagram of a data synchronization device in an embodiment;

[0053] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] The data query method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the user terminal 102 communicates with the server cluster 104 through the network, and the server cluster 104 can communicate with the update server 106 through the network. The server cluster 104 receives the query request sent by the user terminal 102, and the query request carries the user identification information. The server cluster 104 queries the data corresponding to the query request from the update server 106, and the update server is used to record the incremental data within a preset time period. If the server cluster 104 queries the data corresponding to the query request, the data is returned to the user terminal 102 corresponding to the user identification information. Among them, the user terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, the server 104 can be implemented by a server cluster composed of multiple servers, and the update server 106 can be implemented by a server cluster composed of multiple independently deployed servers.

[0056] In one embodiment, Figure 2 As shown, a data query method is provided, which is applied to Figure 1 Take the service node in the server cluster in as an example to illustrate, including the following steps:

[0057] Step 202: Receive a query request, which carries user identification information.

[0058] Solr is an independent enterprise-level search application server that provides an API interface similar to Web-service. Users can submit XML files in a certain format to the search engine server through http requests to generate indexes; they can also make search requests through Http Get operations and get XML-formatted return results. That is, Solr is a high-performance, Java-developed, Lucene-based full-text search server. At the same time, it has been extended to provide a richer query language than Lucene, while achieving configurability, extensibility, and optimizing query performance, and providing a complete functional management interface. Solr components provide similar database aggregation statistics query functions. Solr storage consists of multiple Cores (i.e., index libraries), a logical instance is a Core, and each Core corresponds to an index directory, similar to a table in a database. An index contains multiple Documents (i.e., document objects), similar to a record in a database. A Document has multiple fields, and each field corresponds to multiple Terms (i.e., word segmentation).

[0059] Internet products have a huge number of users and a high number of concurrent accesses. A single server cannot serve such a huge number of users at the same time, so a server cluster needs to be built to improve the system throughput and ensure service redundancy. Solr Server provides a master-slave replication mechanism to implement the cluster solution. Its core idea is to use read-write separation to provide service redundancy and performance expansion. That is, through HTTP replication between the internal servers of the cluster, the incremental data in server A is copied to server B and more read servers, so that server B has a data backup consistent with server A. For the Internet scenario with more reads and less writes, server A focuses on data updates and does less work without having to deal with a large number of user read requests. Server B replaces server A to provide services to users. Server A only does a small amount of work, and the possibility of downtime is greatly reduced. If server B fails, there are other machines to replace it to serve users, so that users hardly feel the abnormality of the service.

[0060] Specifically, a service node in a server cluster is used as an example for explanation. In an environment of distributed services and high concurrent requests, the server cluster can provide services to the outside world through LBS (load balancing server). The user does not perceive the existence of the cluster. The user request is sent to a unified service address. The LBS distributes the user request to one of the machines for response according to the load status of the cluster server, that is, distributes the user request to one of the service nodes in the service cluster for response. The service node in the server cluster receives the query request sent by the distributed user terminal, wherein the query request refers to the query request corresponding to the business function initiated by the user in different business scenario systems according to different needs. The user can log in to the business system of a specific scenario by entering the user name and password in the mobile application or the browser web page. The user can initiate a specific query request through the app (Application) client or the web client, that is, the web browser. The service node in the server cluster can receive the query request sent by the client through the gateway, and the query request carries the corresponding user identification information, which is used to identify the unique user. For example, the user can initiate a query order request through a trigger operation and send it to the server cluster through the service gateway. The server cluster can provide services to the outside world through LBS (load balancing server), that is, LBS distributes the query order request sent by the user terminal to one of the machines for response according to the load status of the cluster server, that is, distributes the query order request to one of the service nodes in the service cluster for response. When the server cluster receives the query order request sent by the user terminal, the server cluster can obtain the available service list corresponding to the identification information from the service registration center according to the identification information in the query order request, and call the corresponding service node for processing.

[0061] Step 204: query the update server for data corresponding to the query request, where the update server is used to record incremental data within a preset time period.

[0062] After the service node in the server cluster receives the query request, the service node in the server cluster can query the data corresponding to the query request from the update server according to the user identification information carried in the query request, and the update server is used to record the incremental data within the preset time period. Among them, the update server refers to an independently deployed server (cluster) specifically used to record the modification increment within the preset time period. The previous data remains unchanged, and the previous data can be called baseline data. Each time a query is performed, the baseline data and the incremental data need to be integrated and returned to the client. The incremental data in the update server can be written to the write server in the original service cluster (baseline service cluster) regularly according to the preset time (for example, the preset time period can be set to one day), and the other read servers in the original service cluster (baseline service cluster) synchronize the data (one day) through the original replication mechanism (i.e., the master-slave replication mechanism). In this way, the number of replications from the node changes from once per minute to once a day, and the time of high latency is also controlled during the time when the business is cold, which greatly reduces the impact on users. In addition, the update server in the present application can be an independently deployed service cluster, not in the baseline service cluster, that is, an independently deployed master-slave service cluster.

[0063] Step 206: If data corresponding to the query request is found, the data is returned to the user terminal corresponding to the user identification information.

[0064] The service node in the server cluster queries the data corresponding to the query request from the update server according to the user identification information carried in the query request. If the service node queries the data corresponding to the query request, the data is returned to the user terminal corresponding to the user identification information. That is, when the service node in the server cluster receives the query request sent by the user terminal, it first queries whether there is data corresponding to the query request from the independently deployed update server. If the service node queries the data corresponding to the query request from the update server, the queried hot data is directly returned to the user terminal corresponding to the user identification information. If the service node does not query the data corresponding to the query request from the independently deployed update server, the data corresponding to the query request is queried from the baseline service cluster, and the data queried in the baseline service cluster is returned to the user terminal corresponding to the user identification information. Since the update server is used to record the incremental data within the preset time period, that is, to specifically record the hot data, the query request sent by the user generally also needs to query the latest recent data, so the hot data is treated differently, and the incremental data is separated from the baseline data, that is, the incremental data (hot data) within the preset time period is recorded by the update server, which can solve the high query latency problem caused by the huge amount of data.

[0065] In the traditional data query method, when using Solr's master-slave replication mechanism to synchronize data from the master server to the slave server, it is necessary to go through the process of pulling incremental data from the slave node, merging data into the local index, and deleting the old data cache, loading the new data cache, opening a new query, etc. If the slave node has not completed the replication of the master node data, then the direct read will not be able to read the data on the slave node. If you wait for the slave node synchronization to complete before reading the data, it will take longer. If the data is sharded, although the time consumption of single-shard query can be solved by reducing the number of documents through sharding, the assembly of multi-shard data will also take more time. Due to too many shards, when reading data, the data comes from multiple shards, and the aggregation and assembly of data will take a lot of time, which is likely to cause slower response to query requests and high latency problems, affecting the processing efficiency of queries.

[0066] In this embodiment, by receiving a query request, the query request carries user identification information, and the data corresponding to the query request is queried from the update server, and the update server is used to record the incremental data within a preset time period. If the data corresponding to the query request is queried, the data is returned to the user terminal corresponding to the user identification information. As a result, the incremental data is separated into the update server, and the data is read from the update server first during the query, which can efficiently hit the data and quickly query the data corresponding to the query request, thereby solving the problem of high latency in data query in the case of a large amount of data and effectively improving the efficiency of data query.

[0067] In one embodiment, after querying the update server for data corresponding to the query request, the method further includes the step of querying the baseline service cluster for data corresponding to the query request, specifically including:

[0068] If no data corresponding to the query request is found, the data corresponding to the query request is found from the baseline service cluster, and the data found in the baseline service cluster is returned to the user terminal corresponding to the user identification information.

[0069] After receiving the query request, the service node in the server cluster can query the data corresponding to the query request from the update server according to the user identification information carried in the query request. Specifically, if the service node in the server cluster fails to query the data corresponding to the query request from the update server, it queries the data corresponding to the query request from the baseline service cluster, and returns the data queried in the baseline service cluster to the user terminal corresponding to the user identification information. That is, the service node preferentially queries the data from the update server, and only when the target data is not queried from the update server, the service node queries the data corresponding to the query request from the baseline service cluster.

[0070] For example, after receiving the query request 1 from user A, the service node in the server cluster queries the data corresponding to the query request 1 from the update server according to the user identification information A carried in the query request 1. If the corresponding target data is found, the service node directly returns the target data found in the update server to the user terminal A corresponding to the user identification information A. If the corresponding target data is not found, the service node queries the target data corresponding to the query request 1 from the baseline service cluster again, and returns the target data found in the baseline service cluster to the user terminal A corresponding to the user identification information A. Since most user requests can directly query the target data from the update server, only some user requests will reach the baseline service cluster for query, which can also effectively reduce the request volume of the baseline service cluster and effectively alleviate the high service pressure brought to the baseline service cluster by a large number of requests.

[0071] In one embodiment, the step of receiving a query request includes:

[0072] Receive query requests distributed by load balancing servers in the server cluster.

[0073] The service nodes in the server cluster receive query requests distributed by the load balancing server in the server cluster. Specifically, in an environment of distributed services and high concurrent requests, the server cluster can provide services to the outside world through LBS (load balancing server). Users are not aware of the existence of the cluster. User requests are sent to a unified service address. LBS distributes user requests to one of the machines for response based on the load status of the cluster server, that is, distributes user requests to one of the service nodes in the service cluster for response. Due to the large number of users of Internet products and the high number of concurrent accesses, a single server cannot serve such a large number of users at the same time. At the same time, 24 / 7 availability is a basic requirement for Internet products, so server clusters can be built to improve system throughput and ensure service redundancy.

[0074] In one embodiment, the update server includes an update master server and an update slave server, the update master server is used to write data, and the update slave server is used to read data, and the step of querying data corresponding to the query request from the update server includes:

[0075] The update query server retrieves the data corresponding to the query request.

[0076] After receiving the query request, the service node in the server cluster can query the data corresponding to the query request from the update server according to the user identification information carried in the query request. Among them, the update server includes an update master server and an update slave server, the update master server is used to write data, and the update slave server is used to read data. The update server can be an independently deployed service cluster, not in the baseline service cluster, that is, an independent master-slave deployed service cluster. The update server can only store the latest data of the day, and give priority to querying when querying. That is, the service node in the server cluster can query the data corresponding to the query request from the update slave server according to the user identification information carried in the query request. The update server can write the latest data in the update server to the baseline service cluster through the application according to the preset time point every day (such as the low peak of service requests in the middle of the night). For example, the update server (cluster) includes the Update server master (update master server) and the Update server standby (update slave server), that is, the update service deployed by the master and slave, which is used to record the data updated on the day. When reading data, it is read from the update slave server first, and the data is synchronized to the baseline service cluster according to the preset fixed time.

[0077] The core of cluster service is to ensure the consistency of user data. In the process of replication based on the master-slave replication mechanism of Solr Server (baseline service cluster), serious timeout problems will occur in user requests. The traditional solution is to reduce the number of documents in the Core (i.e., index library) and create multiple logical Cores by data sharding. However, the current business data is in the hundreds of millions and is increasing at a rate of at least 40 million per month. If a single slice is too small, the number of slices will be too large, which will also bring greater latency to the query.

[0078] In this embodiment, by analyzing the data volume of the business, it is found that although the data volume is very large, the amount of modification in the recent period (for example, one day) is often not much, usually millions, which is less than 1% compared to hundreds of millions of data. Therefore, in this embodiment, an independently deployed update server can be used to record the modification increments in the recent period, while the previous baseline data remains unchanged, and the incremental data is regularly written to the write server in the original baseline service cluster according to the preset time, and other read servers synchronize the data through the original replication mechanism. In this way, the number of replications from the node is changed from once per minute to once a day, and the time when high latency occurs is also controlled during the time when the business is cold, which greatly reduces the impact on users and effectively improves data query efficiency.

[0079] In one embodiment, Figure 3 As shown, a data synchronization method is provided, which is applied to Figure 1 The update server in the example is used to illustrate the following steps:

[0080] Step 302: Obtain incremental data within a preset time period.

[0081] Step 304, write the incremental data to the first server in the baseline service cluster according to a preset time period to instruct the second server to synchronize the incremental data through a preset replication mechanism; wherein the first server is used to write data and the second server is used to read data.

[0082] The update server obtains the incremental data within a preset time period, and writes the incremental data to the first server in the baseline service cluster according to the preset time period, so as to instruct the second server to synchronize the incremental data through the preset replication mechanism. Among them, the first server is used to write data, and the second server is used to read data. That is, the update server can be an independently deployed service cluster, not in the baseline service cluster, that is, in this implementation, two sets of service clusters can be independently deployed in a master-slave manner, one for the baseline service cluster and the other for the update service cluster. The baseline service cluster includes the first server and the second server, that is, the master server is used to write data, and the slave server is used to synchronize data from the master server through the master-slave replication mechanism. The update service cluster also includes the Update server master (update master server) and the Update server standby (update slave server), that is, the update service deployed in a master-slave manner, which is used to record the data updated on the day, and the data is read from the update slave server first when reading the data, and the data is synchronized to the write server in the baseline service cluster according to the preset time. As a result, the incremental data (hot data) is separated from the update service, and the data can be efficiently hit when querying, and the required data can be quickly queried, which effectively improves the data query efficiency. In addition, the updated server data is written to the baseline service cluster through the application at regular intervals every day (such as late at night when service requests are low), and the time when high latency occurs is also controlled during the time when business is slow, which greatly reduces the impact on users.

[0083] In one embodiment, the method further includes the step of detecting the operating status of the baseline service cluster, specifically including:

[0084] Check the running status of the baseline service cluster.

[0085] If the baseline service cluster is in an idle state, the incremental data is written to the first server in the baseline service cluster.

[0086] The update server can detect the operating status of the baseline service cluster in real time. If it is detected that the baseline service cluster is in an idle state, the update server can write the incremental data to the first server in the baseline service cluster. That is, when the baseline service cluster is in an idle state or the service request volume is low, the update server can write the incremental data to the write server in the baseline service cluster, so that the number of replications from the node is changed from once per minute to data replication and synchronization in an idle state or when the service request volume is low. The time of high latency is also controlled during the business slack period, which greatly reduces the impact on users.

[0087] In one embodiment, Figure 4A As shown, a data query method is provided, which is applied to Figure 1 Take the service node in the server cluster in as an example to illustrate, including the following steps:

[0088] Step 402: Receive a query request, which carries user identification information.

[0089] Step 404: query the update server for data corresponding to the query request, where the update server is used to record incremental data within a preset time period.

[0090] Step 406: If data corresponding to the query request is found, the data is returned to the user terminal corresponding to the user identification information.

[0091] Step 408: If no data corresponding to the query request is found, the baseline service cluster is searched for data corresponding to the query request, and the data found in the baseline service cluster is returned to the user terminal corresponding to the user identification information.

[0092] In an environment with distributed services and high concurrent requests, such as Figure 4B As shown in the figure, it is a schematic diagram of the server cluster processing the query request sent by the user terminal. The server cluster can provide services to the outside world through LBS (load balancing server). The user request is sent to a unified service address. LBS distributes the user request to one of the machines for response according to the load status of the cluster server, that is, distributes the user request to one of the service nodes in the service cluster for response. Figure 4CAs shown, it is an architecture diagram of data query processing. After the service node in the server cluster receives the query request sent by the distributed user terminal (client), the service node in the server cluster can query the data corresponding to the query request from the Update server (update slave server) of the update service cluster according to the user identification information carried in the query request. The update service cluster is used to record the incremental data within a preset time period. If the service node queries the data corresponding to the query request from the Update server (update slave server), the queried hot data is directly returned to the user terminal corresponding to the user identification information. If the service node does not query the data corresponding to the query request from the independently deployed update slave server, the data corresponding to the query request is queried from the Solr Server (baseline service cluster), and the data queried in the baseline service cluster is returned to the user terminal corresponding to the user identification information. As a result, the incremental data is separated into the update server, and the data is read from the update server first during the query, which can efficiently hit the data and quickly query the data corresponding to the query request, solving the problem of high latency in data query in the case of a large amount of data, and effectively improving the efficiency of data query.

[0093] It should be understood that although Figure 1 The steps in the flowchart of -4 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 -At least part of the steps in 4 may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0094] In one embodiment, Figure 5 As shown, a data query device is provided, including: a receiving module 502, a query module 504 and a sending module 506, wherein:

[0095] The receiving module 502 is used to receive a query request, where the query request carries user identification information.

[0096] The query module 504 is used to query data corresponding to the query request from the update server, and the update server is used to record incremental data within a preset time period.

[0097] The sending module 506 is configured to return the data to the user terminal corresponding to the user identification information if the data corresponding to the query request is found.

[0098] In one embodiment, the query module is further configured to query the data corresponding to the query request from the baseline service cluster if no data corresponding to the query request is found, and return the data found in the baseline service cluster to the user terminal corresponding to the user identification information.

[0099] In one embodiment, the receiving module is further used to receive a query request distributed by a load balancing server in the server cluster.

[0100] In one embodiment, the query module is further used to query data corresponding to the query request from the update slave server.

[0101] In one embodiment, Figure 6 As shown, a data synchronization device is provided, including: an acquisition module 602 and a writing module 604, wherein:

[0102] The acquisition module 602 is used to acquire incremental data within a preset time period.

[0103] The writing module 604 is used to write the incremental data to the first server in the baseline service cluster according to a preset time period to instruct the second server to synchronize the incremental data through a preset replication mechanism; wherein the first server is used to write data and the second server is used to read data.

[0104] In one embodiment, the device further includes: a detection module.

[0105] The detection module is used to detect the running state of the baseline service cluster. If the baseline service cluster is in an idle state, the incremental data is written to the first server in the baseline service cluster.

[0106] For the specific definition of the data query device, please refer to the definition of the data query method above, which will not be repeated here. Each module in the above-mentioned data query device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0107] For the specific definition of the data synchronization device, please refer to the definition of the data synchronization method above, which will not be repeated here. Each module in the above-mentioned data synchronization device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0108] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data query data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data query method is implemented.

[0109] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0110] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above-mentioned method embodiments when executing the computer program.

[0111] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0112] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0113] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A data query method, characterized in that: Applied to a server cluster, the method comprises: Receive a query request distributed by a load balancing server in a server cluster; the query request carries user identification information; the query request is distributed by the load balancing server to one of the service nodes in the server cluster according to the load status of the server cluster; the query request refers to a query request corresponding to a business function initiated by a user in different business scenario systems according to different needs; Obtaining the available service list corresponding to the user identification information from the service registration center, calling the corresponding service node, and querying the incremental data corresponding to the query request from the update slave server of the update service cluster through the service node; the update service cluster refers to an independently deployed server cluster specifically used to record the modification increments within a preset time period; the update service cluster includes an update master server and the update slave server; the update master server is used to write data; the update slave server is used to read data; If the incremental data corresponding to the query request is found, the incremental data is returned to the user terminal corresponding to the user identification information through the service node; wherein each time a query is made, the local baseline data of the service node and the incremental data need to be integrated and returned to the user terminal; If no incremental data corresponding to the query request is found, the incremental data corresponding to the query request is preferentially queried from the slave servers of the baseline service cluster through the service node, and the incremental data queried from the slave servers of the baseline service cluster is returned to the user terminal corresponding to the user identification information; wherein, the incremental data is written by the update service cluster to the master server in the baseline service cluster at a preset time periodically, so that each slave server in the baseline service cluster synchronizes data through a replication mechanism; the method also includes: detecting the running status of the baseline service cluster; if the baseline service cluster is in an idle state, writing the incremental data to the master server in the baseline service cluster.

2. The method according to claim 1, characterized in that The query request includes an order query request.

3. The method according to claim 1, characterized in that The incremental data is hotspot data.

4. The method according to claim 1, characterized in that: Each slave server in the baseline service cluster synchronizes data through a master-slave replication mechanism.

5. The method according to claim 1, characterized in that The baseline service cluster includes the slave server and the master server.

6. The method according to claim 1, characterized in that The master server is used for writing data, and the slave server is used for reading data.

7. A data query device, characterized in that: Applied to a server cluster, the device comprises: A receiving module, used to receive a query request distributed by a load balancing server in a server cluster; the query request carries user identification information; the query request is distributed by the load balancing server to one of the service nodes in the server cluster according to the load status of the server cluster; the query request refers to a query request corresponding to a business function initiated by a user in different business scenario systems according to different needs; A query module is used to obtain an available service list corresponding to the user identification information from a service registration center, call a corresponding service node, and query the incremental data corresponding to the query request from an update slave server of an update service cluster through the service node; the update service cluster refers to an independently deployed server cluster specifically used to record modification increments within a preset time period; the update service cluster includes an update master server and the update slave server; the update master server is used to write data; the update slave server is used to read data; A sending module, configured to return the incremental data to the user terminal corresponding to the user identification information through the service node if the incremental data corresponding to the query request is found; wherein each time a query is performed, the local baseline data of the service node and the incremental data need to be integrated and then returned to the user terminal; The query module is also used to, if no incremental data corresponding to the query request is found, preferentially query the incremental data corresponding to the query request from the slave server of the baseline service cluster through the service node, and return the incremental data queried from the slave server of the baseline service cluster to the user terminal corresponding to the user identification information; wherein the incremental data is written to the master server in the baseline service cluster by the update service cluster at a preset time periodically, so that the slave servers in the baseline service cluster synchronize data through a replication mechanism; a detection module is used to detect the operating status of the baseline service cluster; if the baseline service cluster is in an idle state, the incremental data is written to the master server in the baseline service cluster.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Database system and data synchronization method thereof

    CN103139308A

  • Distributed data processing method and device

    CN105373746A

  • Method and system for implementing index in file storage

    CN106649403A

  • Method and device for displaying user summarized data, and server

    CN106874316A

  • Database log-based real-time data query method and system

    CN107038162A