A server and a method for providing data query service for application program

By giving priority to connecting to the distributed cache master node when the application is expanded, and switching to the cache slave node after data synchronization is completed, the problem of insufficient performance and bandwidth of the distributed cache cluster under high request volume is solved, and fast and efficient are achieved. Data query service.

CN114138825BActive Publication Date: 2024-08-23青岛聚看云科技有限公司
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202111404520.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-24
Publication Date
2024-08-23
Estimated Expiration
2041-11-24

AI Technical Summary

Technical Problem

Existing distributed cache clusters suffer from insufficient server performance, insufficient bandwidth, and low expansion efficiency under high request volume. Especially when traffic surges, the cache slave node data synchronization speed is lower than required for expansion, which may cause system failure.

Method used

When the application is expanding, it will first connect to the distributed cache master node to provide data query services, and switch to the cache slave node after data synchronization is completed, reducing dependence on cache and improving expansion efficiency and performance.

Benefits of technology

In this way, the problems of insufficient server performance and insufficient bandwidth usage are solved. At the same time, while using cache to improve application performance, it reduces the dependence on cache when capacity expansion is started, and realizes fast and efficient provision of data query services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114138825B
    Figure CN114138825B
Patent Text Reader

Abstract

The present application provides a server and a method for providing data query services for applications. When the expansion conditions of an application are triggered, the application node will preferentially connect to the distributed cache master node, so that the distributed cache master node provides data query services for the application node. When the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the application node is disconnected from the distributed cache master node and connected to the distributed cache slave node, so that the distributed cache slave node provides data query services for the application node. The above method not only solves the problems of insufficient server performance and insufficient bandwidth occupancy, but also can use the cache to improve application performance while minimizing the dependence on the cache when the application expansion is started, so as to achieve the purpose of providing data query services quickly and efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of servers, and in particular to a server and a method for providing data query services for an application program. Background Art

[0002] Distributed cache is a common processing method for improving application performance. Cache data is stored in memory. When an application obtains data, it first queries the cache. If the target data exists in the cache, the data is returned to the application. This prevents the application from querying the backend database. Since cache data is stored in memory and database data is stored in the hard disk, the memory speed is much higher than the hard disk, so application cache can greatly improve application performance.

[0003] The common distributed cache usage scheme in related technologies is to deploy a distributed cache cluster and connect the application to the cache cluster. The deployment mode is as follows: Figure 1 However, this solution has its drawbacks: when the application QPS (requests per second) is too large, the burden on the distributed cache cluster server will continue to increase. Especially in the scenario where a large amount of data information is returned each time the cache is accessed, the impact on the network bandwidth is very large as the QPS increases. Bandwidth expansion is usually more complicated and costly.

[0004] In order to solve the problems of insufficient server performance and bandwidth caused by the increase in access volume, some manufacturers have optimized this solution. Each application server has a distributed cache slave node mounted inside it. The slave node data is synchronized from the master node. When the application accesses the cache, it does not need to access the remote distributed cache server, but only access the local cache service. After this optimization, each application accesses a unique local cache service without network overhead, which improves access performance. The architecture diagram is shown below. Figure 2 As shown in the figure. This solution solves the access performance problem, but it brings the following defects: When the current application is an Internet service for end users, the application request volume is very large, so a cache layer must be provided to cope with the impact of large traffic. At this time, when this solution is used, when the application needs to be expanded due to a surge in traffic, it is necessary to ensure that the local distributed cache slave node data is synchronized before providing services. At this time, it is possible that the synchronization speed of the local cache slave node data is lower than the expansion requirement, causing system failure. Summary of the invention

[0005] The present application provides a server and a method for providing data query services for an application, which uses cache to improve application performance and minimizes the reliance on cache when the application is expanded and started, so as to achieve the purpose of providing services quickly and efficiently.

[0006] In a first aspect, the present application provides a server configured to:

[0007] When the expansion conditions of the application are triggered, expand the application nodes;

[0008] Control the application node to connect with the distributed cache master node so that the distributed cache master node provides data query services for the application node, and at the same time, synchronizes the data of the distributed cache master node to the distributed cache slave node;

[0009] If the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the application node is controlled to disconnect from the distributed cache master node and connect to the distributed cache slave node so that the distributed cache slave node provides data query services for the application node.

[0010] In one implementation, the conditions for triggering the expansion of the application include:

[0011] The current time reaches the preset time, or

[0012] The current user data request volume exceeds the preset value, or

[0013] The current user data request volume exceeds the maximum user data request volume that all current application nodes can handle.

[0014] In one implementation, the server is configured as follows:

[0015] The expansion quantity of the application node is determined according to the current user data request quantity, the maximum user data request quantity that can be processed by all current application nodes, and the maximum user data request quantity that can be processed by a single application node.

[0016] In one implementation, the server is configured as follows:

[0017] Regularly detect whether the data of the distributed cache slave node and the distributed cache master node are synchronized.

[0018] In one implementation, the server is configured as follows:

[0019] Regularly detect whether there is log information in the log file of the distributed cache slave node indicating that data synchronization between the distributed cache slave node and the distributed cache master node is completed;

[0020] If the log file contains log information indicating that the data synchronization is completed, it is determined that the data synchronization between the distributed cache slave node and the distributed cache master node is completed.

[0021] In a second aspect, the present application provides a method for providing data query services for an application, which is applied to a server, and the method comprises:

[0022] When the expansion conditions of the application are triggered, expand the application nodes;

[0023] Control the application node to connect with the distributed cache master node so that the distributed cache master node provides data query services for the application node, and at the same time, synchronizes the data of the distributed cache master node to the distributed cache slave node;

[0024] If the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the application node is controlled to disconnect from the distributed cache master node and connect to the distributed cache slave node so that the distributed cache slave node provides data query services for the application node.

[0025] In one implementation, the conditions for triggering the expansion of the application include:

[0026] The current time reaches the preset time, or

[0027] The current user data request volume exceeds the preset value, or

[0028] The current user data request volume exceeds the maximum user data request volume that all current application nodes can handle.

[0029] In one implementation, the method further includes:

[0030] The expansion quantity of the application node is determined according to the current user data request quantity, the maximum user data request quantity that can be processed by all current application nodes, and the maximum user data request quantity that can be processed by a single application node.

[0031] In one implementation, the method further includes:

[0032] Regularly detect whether the data of the distributed cache slave node and the distributed cache master node are synchronized.

[0033] In one implementation, the method further includes:

[0034] Regularly detect whether there is log information in the log file of the distributed cache slave node indicating that data synchronization between the distributed cache slave node and the distributed cache master node is completed;

[0035] If the log file contains log information indicating that the data synchronization is completed, it is determined that the data synchronization between the distributed cache slave node and the distributed cache master node is completed.

[0036] It can be seen from the above technical solution that when the expansion condition of the application is triggered, the application node will preferentially connect to the distributed cache master node, so that the distributed cache master node provides data query services for the application node. When the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the application node is disconnected from the distributed cache master node and connected to the distributed cache slave node, so that the distributed cache slave node provides data query services for the application node. The above method not only solves the problems of insufficient server performance and insufficient bandwidth occupancy, but also can use the cache to improve application performance while minimizing the dependence on the cache when the application expansion is started, so as to achieve the purpose of providing data query services quickly and efficiently. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0038] Figure 1 This is a diagram of the deployment model for the distributed cache cluster solution;

[0039] Figure 2 Improved deployment pattern diagram for distributed cache cluster;

[0040] Figure 3 A flow chart of a method for providing data query services for an application program in an embodiment of the present application;

[0041] Figure 4 A schematic diagram of establishing a cache connection between a distributed cache master node and a distributed cache slave node in an embodiment of the present application;

[0042] Figure 5 A schematic diagram of data query and data synchronization after the expansion condition is triggered in an embodiment of the present application;

[0043] Figure 6 A schematic diagram of the connection mode of application nodes after the expansion condition is triggered in an embodiment of the present application;

[0044] Figure 7 A schematic diagram of data query and data synchronization during data synchronization between a distributed cache master node and a distributed cache slave node in an embodiment of the present application;

[0045] Figure 8 A schematic diagram of detecting whether data synchronization between a distributed cache master node and a distributed cache slave node is completed in an embodiment of the present application;

[0046] Fig. 9This is a schematic diagram of the application node connection method after the distributed cache master node and the distributed cache slave node data synchronization are completed in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0048] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.

[0049] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0050] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0051] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.

[0052] Figure 1 The defect of the distributed cache cluster solution is that when the application has too many requests per second, the burden on the distributed cache cluster server will continue to increase. Especially in the scenario where a large amount of data information is returned each time the cache is accessed, the impact on the network bandwidth is very large as the number of requests per second increases. Bandwidth expansion is usually more complicated and costly. Figure 2 The defect of the distributed cache cluster improvement solution is that when the application needs to be expanded due to a surge in traffic, it is necessary to ensure that the local distributed cache slave node data synchronization is completed before providing data query services. At this time, it is possible that the synchronization speed of the local cache slave node data is lower than the expansion requirement, causing system failure. The above two solutions cannot simultaneously solve the problems of insufficient server cache performance, insufficient bandwidth usage and low expansion efficiency caused by the surge in traffic.

[0053] In order to simultaneously solve the problems of insufficient server cache performance, insufficient bandwidth occupancy and low expansion efficiency caused by traffic surge, the embodiment of the present application adopts the following Figure 3 The method shown is as follows:

[0054] A local distributed cache slave node is deployed inside each application server. The distributed cache slave node is used to connect with the application node so that the distributed cache slave node can provide data query services for the application.

[0055] The application creates two cache connections, one for the distributed cache slave node and the other for the distributed cache master node.

[0056] In some feasible embodiments, the distributed cache master node and the distributed cache slave node communicate with the application node through a specific communication protocol and provide data query services for the application.

[0057] In some feasible embodiments, the paging cache framework Redis uses the RESP protocol. Redis is an open source log-type, Key-Value database written in ANSI C language, supporting the network, memory-based and persistent, and provides application programming interfaces in multiple languages. The client and server of Redis use an independent protocol called RESP (Redis Serialization Protocol) as a standard way of communication on the upper layer of TCP (Transmission Control Protocol).

[0058] The data query service provided by the paging cache needs to be used through a communication protocol, so when an application uses the data query service provided by the paging cache, it needs to connect to the IP / port of the service. Figure 4 As shown in the figure, the IP / port of the distributed cache master node is: 192.168.1.110:6380, and the IP / port of the distributed cache slave node is: 127.0.0.1:6380. (Note: 127.0.0.1 is the local IP of the service where the application is located). At this point, the distributed cache master node and the distributed cache slave node have clear IP / ports. When the application is expanded and started, the application node can establish a connection with the distributed cache master node and the distributed cache slave node respectively through the specified IP / port.

[0059] Step S301: when the expansion condition of the application is triggered, the application node is expanded;

[0060] In some feasible embodiments, the condition for triggering the expansion of the application includes the current time reaching the preset time. For example, 8:00-11:00 p.m. every day is the peak period for the number of user requests for a certain application. You can choose to complete the expansion of the application node before 8:00 p.m., that is, trigger the expansion instruction of the application at 7:50 p.m. every day, so that the application node starts to expand when the time reaches 7:50 p.m. every day. The expansion amount of the application node can be a fixed value, or it can be slightly changed according to the average number of user requests in the period in the recent period.

[0061] In some feasible embodiments, the conditions for triggering the expansion of the application include the operation and maintenance personnel issuing an expansion instruction. For example, when an application carries out certain activities or broadcasts certain programs at a certain time point, it may be foreseen that the amount of user data requests will increase sharply at that time point. The operation and maintenance personnel may issue an expansion instruction in advance before the time point, and expand the application node to a preset number in advance before the time point. The number of application node expansions can be the number estimated by the operation and maintenance personnel, or it can be set according to the amount of user data requests for the same activity in the past.

[0062] In some feasible embodiments, the condition for triggering the expansion of the application includes that the current user data request amount exceeds a preset value. For example, if it is detected that the user data request amount of the application exceeds a preset value at a certain moment, the condition for triggering the expansion of the application is met.

[0063] In some feasible embodiments, if the current user data request volume of an application exceeds a first preset value and does not exceed a second preset value, the conditions for triggering the expansion of the application are met, and the first number of application nodes can be expanded; if the current user data request volume of the application exceeds a second preset value and does not exceed a third preset value, the conditions for triggering the expansion of the application are also met. At this time, the second number of application nodes is expanded, and so on. The number of application nodes to be expanded is determined based on the current user data request volume. For example: if the number of user data requests for an application at a certain moment is 960, and the number of user data requests of 960 does not exceed the first preset value of 1000, the condition for triggering the expansion of the application is not met, that is, there is no need to expand the application nodes; if the number of user data requests for an application at a certain moment is 1560, and the number of user data requests of 1560 exceeds the first preset value of 1000 and does not exceed the second preset value of 2000, the application nodes can be expanded, and the number of nodes expanded for the application is the first number of 20; if the number of user data requests for an application at a certain moment is 2479, and the number of user data requests of 2479 exceeds the second preset value of 2000 and does not exceed the third preset value of 3000, the application nodes can be expanded, and the number of application nodes expanded is the second number of 40, and so on, the number of application nodes to be expanded is determined according to the current number of user data requests.

[0064] In some feasible embodiments, the condition for triggering the expansion of the application includes that the current user data request volume exceeds the maximum user data request volume that can be processed by all current application nodes.

[0065] In some feasible embodiments, the number of current application nodes and the maximum amount of user data requests that can be processed by a single application node are obtained; the maximum amount of user data requests that can be processed by all current application nodes is determined according to the number of current application nodes and the maximum amount of user data requests that can be processed by each application node;

[0066] Determine whether the current actual user data request volume exceeds the maximum user data request volume that can be processed by all current application nodes;

[0067] If the current actual user data request volume does not exceed the maximum user data request volume processed by all current application nodes, the application expansion conditions are not met, that is, the current application node does not need to be expanded.

[0068] If the current actual user data request volume exceeds the maximum user data request volume that can be processed by all current application nodes, the application expansion condition is met, that is, the application node needs to be expanded. The number of application node expansions is determined based on the current actual user data request volume, the maximum user data request volume that can be processed by all current application nodes, and the maximum user data request volume that can be processed by a single application node. The details are as follows:

[0069] The expansion amount of application nodes = Roundup [(the current actual user data request amount - the maximum user data request amount that all current application nodes can handle) / the maximum user data request amount that a single application node can handle, 0].

[0070] In some feasible embodiments, the actual user data request volume changes in real time, and the number of application nodes continues to grow during the expansion process. Therefore, the actual user data request volume and the current number of application nodes can be obtained regularly to determine whether the current application node needs to continue to expand. If the application node still needs to be expanded, the expansion number of the current application node is re-determined according to the current actual user data request volume.

[0071] For example: the current number of application nodes is 20, and the maximum number of user data requests that a single application node can handle is 50; based on the current number of application nodes and the maximum number of user data requests that each application node can handle, the maximum number of user data requests that all current application nodes can handle is determined, that is, 20×50=1000.

[0072] Determine whether the current actual user data request volume exceeds the maximum user data request volume of 1,000 that can be processed by all current application nodes;

[0073] If the current actual user data request volume is 900, that is, the current actual user data request volume of 900 does not exceed the maximum user data request volume of 1000 that all current application nodes can handle, then the application expansion conditions are not met, that is, the current application node does not need to be expanded.

[0074] If the current actual user data request volume is 1490, that is, the current actual user data request volume of 1490 exceeds the maximum user data request volume of 1000 that all current application nodes can process, then the application expansion condition is met, that is, the current application node needs to be expanded, and the number of application nodes to be expanded is determined based on the current actual user data request volume of 1490, the maximum user data request volume of 1000 that all current application nodes can process, and the maximum user data request volume that each application node can process, which is 50.

[0075] The number of application nodes to be expanded = Roundup[(the current actual user data request amount - the maximum user data request amount currently processed by all application nodes) / the maximum user data request amount that each application node can process, 0] = Roundup[(1490-1000) / 50, 0] = Roundup[9.8, 0] = 10.

[0076] The application is set to obtain the actual user data request volume and the number of current application nodes every 2 minutes. After 2 minutes, the number of current application nodes is obtained again, which is 24, and the actual user data request volume is 1520. Therefore, the maximum user data request volume processed by all current application nodes is 24×50=1200.

[0077] The current actual user data request volume of 1520 exceeds the maximum user data request volume of 1200 that all current application nodes can handle, which satisfies the application expansion condition, that is, the current application node needs to be expanded.

[0078] The number of application nodes to be expanded = Roundup[(the current actual user data request amount - the maximum user data request amount currently processed by all application nodes) / the maximum user data request amount that each application node can process, 0] = Roundup[(1520-1200) / 50, 0] = Roundup[6.4, 0] = 7.

[0079] Step S302: Control the application node to connect to the distributed cache master node so that the distributed cache master node provides data query services for the application node, and at the same time, synchronizes the data of the distributed cache master node to the distributed cache slave node, such as Figure 5 As shown;

[0080] In some feasible embodiments, when the application node starts to expand, the application node is connected to the distributed cache master node by default. At this time, when the user requests data, the distributed cache master node can provide data query services for the application node. At this time, the application status is already available and can provide data query services to users, such as Figure 6 shown.

[0081] In some feasible embodiments, when the application node starts to expand, the data of the distributed cache master node and the distributed cache slave node are synchronized. When the distributed cache slave node synchronizes data from the distributed cache master node, the synchronization process is written to the log file. When the synchronization is completed, a log message indicating the completion of the synchronization is clearly written in the log file of the distributed cache slave node.

[0082] Step S303: Detect whether the data of the distributed cache slave node and the distributed cache master node are synchronized.

[0083] In some feasible embodiments, while the distributed cache slave node is synchronizing data from the distributed cache master node, the application background starts a thread to periodically check whether the distributed cache slave node of the application is synchronized, such as Figure 7 shown.

[0084] In some feasible embodiments, the application periodically detects the log files of the distributed cache slave nodes, and determines whether the data of the distributed cache slave nodes and the distributed cache master nodes are synchronized by determining whether there is log information in the log files indicating that the data synchronization of the distributed cache slave nodes with the distributed cache master nodes is completed, such as Figure 8 shown.

[0085] If the data of the distributed cache slave node and the distributed cache master node are not synchronized, that is, the log file of the distributed cache slave node does not contain log information indicating that the data synchronization of the distributed cache slave node from the distributed cache master node is completed, no operation is performed, and the distributed cache slave node and the distributed cache master node are detected at the next time point to continue to detect whether the data synchronization is completed, that is, to detect whether the log file of the distributed cache slave node at the next time point contains log information indicating that the data synchronization of the distributed cache slave node from the distributed cache master node is completed.

[0086] If data synchronization between the distributed cache slave node and the distributed cache master node is completed, that is, the log file of the distributed cache slave node contains log information indicating that data synchronization between the distributed cache slave node and the distributed cache master node is completed, step S304 is executed.

[0087] Step S304: Control the application node to disconnect from the distributed cache master node and connect to the distributed cache slave node, so that the distributed cache slave node provides data query service for the application node.

[0088] In some feasible embodiments, after the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the cache service connection of the application is switched to the distributed cache slave node local to the application, and the connection of the distributed cache master node is closed, such as Figure 2 As shown. That is, the application node is connected to the distributed cache slave node by default. At this time, when the user requests data, the distributed cache slave node can provide data query services for the application. At this time, the application status is available and can provide data query services for users, such as Fig. 9 shown.

[0089] Assume that it takes 5 minutes for the application's local distributed cache slave node to synchronize data with the distributed cache master node. When the number of user data query requests surges, it is necessary to expand 10 application nodes within 10 minutes, with 2 application nodes being expanded in parallel each time. Figure 2 The improvement scheme shown in the figure expands one application node in 5 minutes. If two application nodes are expanded together, only four application nodes can be expanded within 10 minutes. This cannot meet the number of application nodes that need to be expanded due to the surge in user data query requests.

[0090] In an embodiment of the present application, when the amount of user data query requests surges, faced with the need to expand 10 application nodes within 10 minutes, 2 are expanded in parallel each time, the application expansion takes 1 minute to start, and the application distributed cache slave node and distributed cache master node data synchronization takes 5 minutes. Under the conditions, the 10 application nodes can be expanded in just 5 minutes using the solution of the present application. Since the distributed cache master node used by default after the application expansion is started provides data query services, data query services can be provided after the startup is completed, and there is no need to wait for the local cache slave node to complete the data synchronization with the distributed cache master node before providing data query services. In addition, two application nodes are expanded each time, so the distributed cache master node only needs to provide data query services for a maximum of two application nodes at the same time, and the connection will be disconnected after the expansion is completed. The requirements for server cache performance and bandwidth are both non-linear and controllable.

[0091] In some embodiments, after the distributed cache slave node provides data query services for the application in step S304, when the distributed cache master node has a large amount of data that needs to be synchronized with the distributed cache slave node, the data synchronization time may be too long, resulting in the distributed cache slave node being unable to provide data query services in a timely manner. If the distributed cache master node has data that needs to be synchronized with the distributed cache slave node, and the estimated data synchronization time exceeds a preset value, the application node can be controlled to disconnect from the distributed cache slave node and connect to the distributed cache master node so that the distributed cache master node provides data query services for the application. While the distributed cache slave node is synchronizing data from the distributed cache master node, a thread is started in the background of the application to periodically check whether the synchronization of the local distributed cache slave node of the application is complete.

[0092] If the data of the distributed cache slave node and the distributed cache master node are not synchronized, no operation is performed, and the distributed cache slave node and the distributed cache master node are detected at the next time point to see whether the data are synchronized.

[0093] If the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the control application node is disconnected from the distributed cache master node and connected to the distributed cache slave node, so that the distributed cache slave node provides data query services for the application.

[0094] Since the distributed cache master node provides data query services when the distributed cache master node and the distributed cache slave node are synchronized, the data query services can be provided without waiting for the distributed cache master node and the distributed cache slave node to complete data synchronization. Therefore, when the distributed cache master node has a large amount of data that needs to be synchronized with the distributed cache slave node, data query services can still be provided efficiently and quickly. When the distributed cache master node and the distributed cache slave node complete data synchronization, the distributed cache slave node continues to provide data query services for the application.

[0095] It can be seen from the above technical solution that when the expansion condition of the application is triggered, the application node will preferentially connect to the distributed cache master node, so that the distributed cache master node provides data query services for the application node. When the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the application node is disconnected from the distributed cache master node and connected to the distributed cache slave node, so that the distributed cache slave node provides data query services for the application node. The above method not only solves the problems of insufficient server performance and insufficient bandwidth occupancy, but also can use the cache to improve application performance while minimizing the dependence on the cache when the application expansion is started, so as to achieve the purpose of providing data query services quickly and efficiently.

[0096] Similar parts between the embodiments provided in this application can be referenced to each other. The specific implementation methods provided above are only a few examples under the general concept of this application and do not constitute a limitation on the protection scope of this application. For those skilled in the art, any other implementation methods expanded based on the scheme of this application without creative work belong to the protection scope of this application.

Claims

1. A server, characterized in that: is configured as: Controlling the connection between the application node and the distributed cache slave node so that the distributed cache slave node provides data query service for the application node; When the expansion conditions of the application are triggered, expand the application nodes; Control the application node to disconnect from the distributed cache slave node and connect to the distributed cache master node, so that the distributed cache master node provides data query services for the application node, and at the same time, synchronizes the data of the distributed cache master node to the distributed cache slave node; If the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the application node is controlled to disconnect from the distributed cache master node and connect to the distributed cache slave node so that the distributed cache slave node provides data query services for the application node.

2. The server according to claim 1, characterized in that: The conditions for triggering the expansion of the application program include: The current time reaches the preset time, or The current user data request volume exceeds the preset value, or The current user data request volume exceeds the maximum user data request volume that all current application nodes can handle.

3. The server according to claim 2, characterized in that: The server is configured to: The expansion quantity of the application node is determined according to the current user data request quantity, the maximum user data request quantity that can be processed by all current application nodes, and the maximum user data request quantity that can be processed by a single application node.

4. The server according to claim 1, characterized in that: The server is configured to: Regularly detect whether the data of the distributed cache slave node and the distributed cache master node are synchronized.

5. The server according to claim 1, characterized in that: The server is configured to: Regularly detect whether there is log information in the log file of the distributed cache slave node indicating that data synchronization between the distributed cache slave node and the distributed cache master node is completed; If the log file contains log information indicating that the data synchronization is completed, it is determined that the data synchronization between the distributed cache slave node and the distributed cache master node is completed.

6. A method for providing data query services for an application, characterized in that: Applied to a server, the method comprises: Controlling the connection between the application node and the distributed cache slave node so that the distributed cache slave node provides data query service for the application node; When the expansion conditions of the application are triggered, expand the application nodes; Control the application node to disconnect from the distributed cache slave node and connect to the distributed cache master node, so that the distributed cache master node provides data query services for the application node, and at the same time, synchronizes the data of the distributed cache master node to the distributed cache slave node; If the data synchronization between the distributed cache slave node and the distributed cache master node is completed, the application node is controlled to disconnect from the distributed cache master node and connect to the distributed cache slave node so that the distributed cache slave node provides data query services for the application node.

7. The method according to claim 6, characterized in that The conditions for triggering the expansion of the application program include: The current time reaches the preset time, or The current user data request volume exceeds the preset value, or The current user data request volume exceeds the maximum user data request volume that all current application nodes can handle.

8. The method according to claim 7, characterized in that The method further comprises: The expansion quantity of the application node is determined according to the current user data request quantity, the maximum user data request quantity that can be processed by all current application nodes, and the maximum user data request quantity that can be processed by a single application node.

9. The method according to claim 6, characterized in that The method further comprises: Regularly detect whether the data of the distributed cache slave node and the distributed cache master node are synchronized.

10. The method according to claim 6, characterized in that The method further comprises: Regularly detect whether there is log information in the log file of the distributed cache slave node indicating that data synchronization between the distributed cache slave node and the distributed cache master node is completed; If the log file contains log information indicating that the data synchronization is completed, it is determined that the data synchronization between the distributed cache slave node and the distributed cache master node is completed.

Citation Information

Patent Citations

  • Method, system and device for controlling data migration of database

    CN103034664A

  • Node capacity expansion method, device and system

    CN105933391A

  • Cluster equipment performance synchronization statistical method and system

    CN106331047A

  • Data caching method, device and equipment for distributed cluster system

    CN109657005A

  • Database system and database updating and capacity expanding method and device

    CN110309156A