A request processing method, apparatus, system, device, and storage medium
By using local caching and dynamic threshold judgment, the pressure problem of caching servers under high concurrency is solved, thereby reducing latency and improving user experience.
Patent Information
- Application Number
- CN202211457868.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-11-21
AI Technical Summary
When the concurrency of write requests is high, the processing pressure on the cache server increases, leading to a decrease in the efficiency of cache server reads and a decline in user experience.
The number of operations on the target machine is determined by the current number of operations on the local cache server. The current number of operations threshold is dynamically determined based on the pre-configured operation count display range and the number of server clusters. If the number of operations on the target machine is greater than or equal to the threshold, it is written to the cache server.
This reduced the write concurrency of the cache server, decreased latency, and improved the user experience.
Smart Images

Figure CN115729703B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to computer technology, and more particularly to a request processing method, apparatus, system, device, and storage medium. Background Technology
[0002] With the rapid development of computer technology, server clusters can be used to process requests sent by numerous clients, thereby improving request processing efficiency.
[0003] When a user triggers an operation that requires counting on the client side, such as a "like" action, the client needs to send a write request to the server cluster to record the number of likes. Currently, when a server in the cluster receives a write request, it directly writes the number of operations to be written from the request to the cache server.
[0004] However, in the process of realizing this invention, the inventors discovered at least the following problems in the prior art:
[0005] When the concurrency of write requests is high, it increases the processing pressure on the cache server, leading to hotspot issues and reducing the efficiency of reading from the cache server, thereby degrading the user experience. Summary of the Invention
[0006] This invention provides a request processing method, apparatus, system, device, and storage medium to solve the problem of excessive write concurrency in cache servers, thereby improving user experience.
[0007] In a first aspect, embodiments of the present invention provide a request processing method, including:
[0008] Obtain the number of write requests sent by the client, wherein the number of write requests includes the number of write operations to be performed corresponding to a preset operation triggered on the client;
[0009] Based on the current number of local operations cached locally, the number of write operations to be cached locally to determine the target number of local operations;
[0010] Based on the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count cached locally, the current operation count threshold corresponding to the target server is determined, wherein the current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the operation count read request;
[0011] If the number of operations performed on the target local machine is greater than or equal to the current operation count threshold, then the number of operations performed on the target local machine is written into the cache server.
[0012] Secondly, embodiments of the present invention also provide a request processing apparatus, comprising:
[0013] The write count request acquisition module is used to acquire write count requests sent by the client, wherein the write count request includes the number of write operations to be performed corresponding to a preset operation triggered on the client;
[0014] The local caching module is used to cache the number of write operations locally based on the current number of local operations, and determine the target number of local operations.
[0015] The current operation count threshold determination module is used to determine the current operation count threshold corresponding to the target server based on the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count cached locally. The current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the count read request.
[0016] The server write module is used to write the target local operation count into the cache server if the target local operation count is greater than or equal to the current operation count threshold.
[0017] Thirdly, embodiments of the present invention also provide a request processing system, the system comprising: a client, a server cluster, and a cache server;
[0018] The target server in the server cluster is used to implement the request processing method provided in any embodiment of the present invention.
[0019] Fourthly, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0020] One or more processors;
[0021] Memory, used to store one or more programs;
[0022] When the one or more programs are executed by the one or more processors, the one or more processors implement the request processing method as provided in any embodiment of the present invention.
[0023] Fifthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the request processing method as provided in any embodiment of the present invention.
[0024] One embodiment of the above invention has the following advantages or beneficial effects:
[0025] The target server in the server cluster receives the client's write request and, based on the current local operation count cached locally, caches the number of operations to be written in the write request to determine the target local operation count. According to the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count cached locally, a current operation count threshold corresponding to the target server is determined. The current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the read request. If the target local operation count is greater than or equal to the current operation count threshold, it is written to the cache server. This local caching reduces the write concurrency of the cache server. Furthermore, by dynamically writing the target local operation count to the cache server when the target local operation count after detecting local caching is greater than or equal to the dynamically determined current operation count threshold (i.e., the maximum number of cached operations), concurrency can be reduced while minimizing latency caused by local caching, thereby improving user experience. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a flowchart of a request processing method provided in one embodiment of the present invention;
[0028] Figure 2 This is an example diagram of a request processing procedure according to an embodiment of the present invention;
[0029] Figure 3 This is a flowchart of another request processing method provided in one embodiment of the present invention;
[0030] Figure 4 This is a schematic diagram of the structure of a request processing device provided in one embodiment of the present invention;
[0031] Figure 5 This is a schematic diagram of the structure of a request processing system provided in one embodiment of the present invention;
[0032] Figure 6 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present invention. Detailed Implementation
[0033] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0034] Figure 1 This is a flowchart illustrating a request processing method according to an embodiment of the present invention. This embodiment is applicable to processing write count requests sent by clients, particularly in live streaming scenarios where users trigger a "like" operation on the client, and the client sends a write count request. This method can be executed by a request processing device, which can be implemented in software and / or hardware and integrated into a target server within a server cluster. The target server refers to the server in the server cluster used to process the write count request currently sent by the client. For example, when a distribution server receives a write count request from a client, it can determine the optimal server (i.e., the target server) for processing the request based on the load information of each server in the server cluster, and distribute the write count request to the target server for processing. It should be noted that each server in the server cluster can serve as a target server. Figure 1 As shown, the method specifically includes the following steps:
[0035] S110. Obtain the number of write requests sent by the client. The number of write requests includes the number of write operations to be performed corresponding to the preset operation triggered on the client.
[0036] The preset operations can be operations that need to be counted based on pre-set business requirements. For example, preset operations can be, but are not limited to, liking, following, or favorited. By counting the number of preset operations triggered on all clients, each client can display the total number of preset operations triggered across all clients. For example, if a user triggers a liking operation on a client, that client can display the total number of likes from all users at that time. The number of pending write operations refers to the number of preset operations triggered by the user on the client in the current write request. For example, if the client generates a count write request for each preset operation triggered by the user, the number of pending write operations in that count write request is 1. If the client generates a count write request based on the predicted number of operations triggered by the user within a preset time period, the number of pending write operations in that count write request is a value greater than or equal to 1.
[0037] Specifically, each client can detect whether the user has triggered a preset operation, generate a corresponding write request based on the number of times the user has triggered the predicted operation, and send the write request to the distribution server. The distribution server can determine the target server in the server cluster that can be processed quickly based on the load information in the server cluster, and send the currently received write request to the target server, so that the target server can obtain the write request currently sent by the client.
[0038] It's important to note that using a server cluster can quickly handle a large number of concurrent write requests, reducing server processing load. For example, when a live stream is popular, many users trigger the "like" action, resulting in a large number of clients sending write requests, leading to high concurrency. A server cluster can quickly process all write requests, improving processing efficiency. Each server in the cluster handling write requests can act as a target server to execute steps S110-S140 to perform the write operation. For example... Figure 2 An example diagram of a request processing procedure is provided. Figure 2 As shown, the server cluster may include server A, server B, etc. Each server can act as a target server to perform the operations of steps S110-S140 to implement the count write operation.
[0039] S120. Based on the current number of local operations cached locally, cache the number of write operations to be performed locally and determine the target number of local operations.
[0040] The current local operation count can refer to the number of operations already cached locally on the target server at the current moment. The current local operation count can be dynamically updated as operations are performed in the local cache. The target local operation count can refer to the local operation count obtained after caching the number of operations to be written locally.
[0041] Specifically, based on the current local operation count cached locally, the number of write operations to be written can be further cached locally and accumulated to obtain the target local operation count, which is the current local operation count after this cache. By caching the number of write operations locally, instead of directly writing the write operations to the cache server, the target server can reduce the write concurrency of the cache server and reduce the write pressure on the cache server without increasing the number of cache servers.
[0042] For example, step S120 may include: adding the current local operation count and the number of write operations to be cached locally, and using the sum as the target local operation count. Specifically, by accumulating the current local operation count and the number of write operations to be cached locally, the number of write operations to be cached locally can be achieved, and the accumulated count is used as the target local operation count, that is, the total number of operations currently cached locally on the target server.
[0043] S130. Based on the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total number of operations cached locally, determine the current operation count threshold corresponding to the target server.
[0044] The current total number of operations is the total number of operations corresponding to the server cluster, obtained by the target server from the cache server based on the operation count read request. The operation count read request refers to a request sent by the client to read the total number of preset operations triggered by all users. For example, in a live streaming scenario, the client can periodically send like count read requests to the server to obtain the total number of likes from all users in the live stream. Figure 2 As shown, when the target server receives a request to read the total number of operations from the client via the distribution server, it can check if it has a local cache of the current total number of operations. If so, it can directly send the locally cached total number of operations to the client for display. If not, it can read the current total number of operations from the cache server and send it to the client, while simultaneously caching it locally. This allows it to directly return the locally cached total number of operations later without having to read it from the cache server, thus reducing the concurrent read load on the cache server. It should be noted that the local cached total number of operations has a validity period. When this period expires, the locally cached total number of operations can be deleted to reduce data latency.
[0045] The cache server can be used to accumulate and store the total number of preset operations triggered by all users. For example, the cache server can be, but is not limited to, a Reids server. In this embodiment, the cache server can also correspond to a distributed cache server cluster, which includes multiple cache servers to support the storage of large amounts of data and improve storage efficiency. For example, the same live stream room can correspond to the same cache server so that all likes written to that live stream room are written to the same cache server, thereby ensuring the accuracy of the count.
[0046] The operation count display range refers to the range of operations displayed using the same display method. There can be one or more operation count display ranges. Each operation count display method corresponds to one operation count display range. Different operation count display methods can correspond to different display step sizes. When the number of operations to be displayed is small, a smaller step size can be used. As the number of operations increases, the display step size can also be increased accordingly to improve display efficiency. For example, when the operation count display range is 1-1000, the display step size is 1; when the operation count display range is 10,000-100,000, the display step size is 1,000, etc. The operation count display range can be pre-configured based on the client's display logic. The current operation count threshold refers to the maximum number of operations allowed to be cached locally on the target server within an acceptable latency range. The current operation count threshold can dynamically change with the current total number of operations. For example, the larger the current total number of operations, the larger the display step size, and the larger the determined current operation count threshold.
[0047] Specifically, the display intervals for each operation count displayed on the client can be pre-configured. These intervals have different display step sizes; for example, interval a1 = {1-10000}, interval a2 = {10,000-100,000}, interval a3 = {100,000-1,000,000}, and interval ai = {Xn-Xn+1}. The target server can dynamically determine a current operation count threshold that matches the current total operation count based on the pre-configured display intervals, the number of servers in the server cluster, and the currently cached total operation count.
[0048] S140. If the number of operations on the target local machine is greater than or equal to the current operation count threshold, then the number of operations on the target local machine is written to the cache server.
[0049] Specifically, such as Figure 2As shown, the target server (i.e., server A or server B) can compare the number of local operations with the current operation count threshold. If the number of local operations is greater than or equal to the current operation count threshold, it indicates that the target server cannot continue to cache the number of local operations. At this time, the number of local operations can be synchronously written to the cache server. For example, the cache server can add the currently cached total number of operations to the number of local operations written by the target server, and use the sum as the updated total number of operations, thereby achieving cumulative caching of the total number of operations. By writing the number of local operations to the cache server when the number of local operations is greater than or equal to the current operation count threshold, the situation of large delays in reading the number of operations from the cache server due to long-term caching on the target server can be avoided. This avoids the user perceiving the delay caused by local caching, such as a user triggering a like operation, but the like count not being updated. Thus, this embodiment can reduce the concurrency while minimizing the delay caused by local caching, so that the user will not perceive the delay caused by local caching, greatly improving the user experience.
[0050] In this embodiment, the target server in the server cluster obtains the client's write request and, based on the current local operation count in the local cache, caches the number of operations to be written in the write request to determine the target local operation count. According to the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count in the local cache, a current operation count threshold corresponding to the target server is determined. The current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the read request. If the target local operation count is greater than or equal to the current operation count threshold, the target local operation count is written to the cache server. This local caching reduces the write concurrency of the cache server. Furthermore, by dynamically writing the target local operation count to the cache server when the target local operation count after detecting local caching is greater than or equal to the dynamically determined current operation count threshold (i.e., the maximum number of times currently allowed to be cached), the concurrency can be reduced while minimizing the latency impact caused by local caching, thereby improving the user experience.
[0051] Based on the above technical solution, S120 may include: if the current number of local operations in the local cache is greater than a first preset number and the current total number of operations is greater than a second preset number, then based on the current number of local operations, the number of write operations to be local cached to determine the target number of local operations.
[0052] The first preset number of operations can be a pre-set number of local operations when local caching is not allowed. The second preset number of operations can be a pre-set number of the total number of operations when local caching is not allowed. The first and second preset numbers can be the same or different. For example, both the first and second preset numbers can be 0.
[0053] Specifically, after the target server retrieves the write request count, it can check whether the current local operation count in the local cache is greater than a first preset count, and whether the current total operation count in the local cache is greater than a second preset count, in order to determine whether local caching can be performed on the target server. When the current local operation count in the local cache is greater than the first preset count and the current total operation count is greater than the second preset count—for example, when both the current local operation count and the current total operation count are non-empty data, i.e., values greater than 0—it indicates that write and read operations have already been performed. In this case, the write operation count can be locally cached to further reduce the latency impact caused by local caching.
[0054] For example, if the current local operation count in the local cache is less than or equal to a first preset count, or the current total operation count is less than or equal to a second preset count, then the number of operations to be written is written to the cache server. Specifically, when the current local operation count in the local cache is less than or equal to the first preset count, or the current total operation count is less than or equal to the second preset count, it indicates that no write or read operation has been performed yet. In this case, the number of operations to be written can be directly written to the cache server, so that the operation count can be read when a read operation is performed subsequently. This avoids the situation where the user triggers the preset operation but the operation count is not displayed, and also avoids the situation where the total number of operations read varies greatly due to different target servers, further improving the user experience.
[0055] Based on the above technical solution, the method further includes: if the current time is greater than or equal to the pre-configured cache validity period, then the current number of local operations in the local cache is written into the cache server.
[0056] The cache validity period can be a pre-configured latest time for data to be valid in the target server's local cache. Specifically, the target server can check if the current time is greater than the cache validity period. If so, it indicates that the maximum allowed caching time has been reached. At this point, the current local operation count can be synchronously written to the cache server, and the current local operation count can be deleted. This further ensures the timeliness of the operation count, and thus avoids the situation where write operation requests cannot be synchronously written to the cache server due to not reaching the current operation count threshold when the concurrency drops from high to low, such as after the popularity decreases.
[0057] Based on the above technical solution, the method further includes: obtaining the count read request sent by the client; if there is a local cache of the current total number of operations, then determining the target total number of operations based on the local cache of the current total number of operations and the current local operation count, and sending the target total number of operations to the client.
[0058] Specifically, when the target server obtains a count read request through the distribution server, it can check whether the current total number of operations is cached locally. If so, since the current total number of operations does not yet include the current local operation count, the current total number of operations and the current local operation count can be added together. The result of the addition is determined as the target total number of operations, and the target total number of operations is sent to the client so that the client can display the target total number of operations. This allows for a more accurate read of the number of operations, further improving the accuracy of the read operation.
[0059] Figure 3 This is a flowchart of another request processing method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment describes in detail the process of determining the current operation count threshold. Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.
[0060] See Figure 3 Another request processing method provided in this embodiment specifically includes the following steps:
[0061] S310. Obtain the number of write requests sent by the client. The number of write requests includes the number of write operations to be performed corresponding to the preset operation triggered on the client.
[0062] S320: Based on the current local operation count, cache the number of write operations to be performed locally, and determine the target local operation count.
[0063] S330. Match the current total number of operations in the local cache with the pre-configured range of operation counts for display, and determine the current display step size corresponding to the current total number of operations based on the matching result.
[0064] The current display step size can be the display step size corresponding to the operation count display interval that matches the current total number of operations. For example, Table 1 provides an example of operation count display information.
[0065] Table 1 shows an example of how to display the number of operations.
[0066] Operation count display range Display method Show step length Show maximum value 1-10000 1,2,3,…9999 1 9999 10,000 - 100,000 10,000, 11,000, 12,000, ..., 99,000 0.1 million 99,000 100,000 - 1,000,000 100,000, 110,000, 120,000, ..., 990,000 10,000 990,000 1 million - 10 million 1 million, 1.1 million, ..., 9.99 million 100,000 9.9 million
[0067] Specifically, the target server can perform interval matching between the locally cached current total number of operations and each pre-configured operation count display interval, and determine the current display step size corresponding to the operation count display interval in which the current total number of operations falls based on the matching result. It should be noted that the smaller the display step size, the more sensitive the user is to changes in the number of operations.
[0068] For example, S330 may include: matching the current total number of operations cached locally with each pre-configured operation count display interval to determine the target operation count display interval in which the current total number of operations is located; determining the target display step size corresponding to the target operation count display interval, and setting the target display step size as the current display step size corresponding to the current total number of operations.
[0069] Specifically, the current total number of operations can be compared with the two endpoints of each operation count display interval. If the current total number of operations is greater than or equal to the left endpoint of an operation count display interval and less than or equal to the right endpoint, then that operation count display interval is determined as the target operation count display interval. In this embodiment, the right endpoint of the target operation count display interval can be divided by a preset value, such as 10, and the result is used as the target display step size. If the result is less than 1, then the target display step size is determined to be 1. This embodiment can also pre-configure the mapping relationship between operation count display intervals and display step sizes, so that the target display step size corresponding to the target operation count display interval can be determined more quickly based on this mapping relationship, and the target display step size can be used as the current display step size corresponding to the current total number of operations.
[0070] S340. Based on the current display step size and the number of servers corresponding to the server cluster, determine the current operation count threshold corresponding to the target server.
[0071] Specifically, the current display step size can be divided into average or weighted segments based on the number of servers in the server cluster to determine the threshold number of current operations for the target server.
[0072] For example, step S340 may include: determining the ratio between the current display step size and the number of servers corresponding to the server cluster as the current operation count threshold for the target server. Specifically, the current display step size may be divided equally so that each server in the server cluster has an equal operation count threshold.
[0073] S350. If the number of operations on the target local machine is greater than or equal to the current operation count threshold, then the number of operations on the target local machine is written to the cache server.
[0074] The technical solution of this embodiment matches the current total number of operations in the local cache with the pre-configured display range of the number of operations, and determines the current display step size corresponding to the current total number of operations based on the matching result; according to the current display step size and the number of servers corresponding to the server cluster, the current operation threshold corresponding to the target server is determined. Thus, the current operation threshold can be determined more reasonably through the current display step size, which reduces the concurrency and further reduces the latency impact caused by local caching, thereby further improving the user experience.
[0075] The following are embodiments of the request processing apparatus provided in this invention. This apparatus and the request processing methods in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the request processing apparatus, please refer to the embodiments of the above request processing methods.
[0076] Figure 4 This is a schematic diagram of a request processing device provided in an embodiment of the present invention. This embodiment is applicable to processing requests for writing the number of likes sent by a client, especially in live streaming scenarios where a user triggers a like operation on the client, and requests for writing the number of likes sent by the client are processed. Figure 4 As shown, the device specifically includes: a write request acquisition module 410, a local cache module 420, a current operation count threshold determination module 430, and a server write module 440.
[0077] The system includes a write request acquisition module 410, which acquires write requests sent by the client, including the number of write operations to be performed corresponding to a preset operation triggered on the client; a local cache module 420, which caches the number of write operations to be performed locally based on the current local operation count in the local cache, and determines the target local operation count; a current operation count threshold determination module 430, which determines the current operation count threshold corresponding to the target server based on a pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count in the local cache, wherein the current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the read request; and a server write module 440, which writes the target local operation count into the cache server if the target local operation count is greater than or equal to the current operation count threshold.
[0078] In this embodiment, the target server in the server cluster obtains the client's write request and, based on the current local operation count in the local cache, caches the number of operations to be written in the write request to determine the target local operation count. According to the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count in the local cache, a current operation count threshold corresponding to the target server is determined. The current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the read request. If the target local operation count is greater than or equal to the current operation count threshold, the target local operation count is written to the cache server. This local caching reduces the write concurrency of the cache server. Furthermore, by dynamically writing the target local operation count to the cache server when the target local operation count after detecting local caching is greater than or equal to the dynamically determined current operation count threshold (i.e., the maximum number of cached operations), the concurrency can be reduced while minimizing latency caused by local caching, thereby improving the user experience.
[0079] Optionally, the local cache module 420 is specifically used to: add the current number of local operations and the number of operations to be written in the local cache, and use the sum as the target number of local operations.
[0080] Optionally, the local cache module 420 is further configured to: if the current number of local operations in the local cache is greater than a first preset number and the current total number of operations is greater than a second preset number, then based on the current number of local operations, locally cache the number of operations to be written to determine the target number of local operations.
[0081] Optionally, the server writing module 440 is further configured to: write the number of operations to be written into the cache server if the current number of local operations in the local cache is less than or equal to a first preset number, or the current total number of operations is less than or equal to a second preset number.
[0082] Optionally, the current operation count threshold determination module 430 includes:
[0083] The current display step size determination unit is used to match the current total number of operations cached locally with the pre-configured operation count display range, and determine the current display step size corresponding to the current total number of operations based on the matching result;
[0084] The current operation count threshold determination unit is used to determine the current operation count threshold corresponding to the target server based on the current display step size and the number of servers corresponding to the server cluster.
[0085] Optionally, the currently displayed step size determination unit is specifically used for:
[0086] The current total number of operations cached locally is matched with each pre-configured operation count display interval to determine the target operation count display interval in which the current total number of operations falls; the target display step size corresponding to the target operation count display interval is determined, and the target display step size is set as the current display step size corresponding to the current total number of operations.
[0087] Optionally, the current operation count threshold determination unit is specifically used for:
[0088] The ratio between the current display step size and the number of servers corresponding to the server cluster is determined as the threshold for the current number of operations corresponding to the target server.
[0089] Optionally, the local cache module is further configured to: if the current time is greater than or equal to the pre-configured cache validity period, write the current number of local operations in the local cache into the cache server.
[0090] Optionally, the device further includes:
[0091] The count read request acquisition module is used to acquire count read requests sent by the client;
[0092] The target total number of operations sending module is used to determine the target total number of operations based on the local cached current total number of operations and the current local operation count if a local cached current total number of operations exists, and then send the target total number of operations to the client.
[0093] The request processing apparatus provided in the embodiments of the present invention can execute the request processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the request processing method.
[0094] It is worth noting that in the embodiments of the above request processing device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0095] Figure 5 This is a schematic diagram of the structure of a request processing system provided in one embodiment of the present invention. Figure 5 As shown, the system includes: a client 510, a server cluster 520, and a cache server 530. Each server in the server cluster can serve as a target server to execute the request processing method provided in any embodiment of the present invention.
[0096] The request processing system provided in this embodiment obtains the number of write requests from clients in the server cluster and caches the number of operations to be written in the write request based on the current local operation count in the local cache to determine the target local operation count. Based on the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count in the local cache, a current operation count threshold corresponding to the target server is determined. The current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the number of read requests. If the target local operation count is greater than or equal to the current operation count threshold, the target local operation count is written to the cache server. This local caching reduces the write concurrency of the cache server. Furthermore, by dynamically writing the target local operation count to the cache server when the target local operation count after detecting local caching is greater than or equal to the dynamically determined current operation count threshold (i.e., the maximum number of times currently allowed to be cached), the system can reduce concurrency while minimizing the latency impact caused by local caching, thereby improving the user experience.
[0097] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 6 A block diagram is shown of an exemplary electronic device 12 suitable for implementing embodiments of the present invention. Figure 6 The electronic device 12 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0098] like Figure 6 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0099] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0100] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0101] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 6 Not shown; usually referred to as a "hard drive"). Although Figure 6 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0102] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0103] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 12, and / or with any device that enables electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0104] Processing unit 16 executes various functional applications and data processing by running programs stored in system memory 28, such as implementing the steps of a request processing method provided in this embodiment, the method including:
[0105] Obtain the number of write requests sent by the client, wherein the number of write requests includes the number of write operations to be performed corresponding to a preset operation triggered on the client;
[0106] Based on the current number of local operations cached locally, the number of write operations to be cached locally to determine the target number of local operations;
[0107] Based on the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count cached locally, the current operation count threshold corresponding to the target server is determined, wherein the current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the operation count read request;
[0108] If the number of operations performed on the target local machine is greater than or equal to the current operation count threshold, then the number of operations performed on the target local machine is written into the cache server.
[0109] Of course, those skilled in the art will understand that the processor can also implement the technical solutions of the request processing method provided in any embodiment of the present invention.
[0110] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the program implements the request processing method steps provided in any embodiment of the present invention, the method comprising:
[0111] Obtain the number of write requests sent by the client, wherein the number of write requests includes the number of write operations to be performed corresponding to a preset operation triggered on the client;
[0112] Based on the current number of local operations cached locally, the number of write operations to be cached locally to determine the target number of local operations;
[0113] Based on the pre-configured operation count display range, the number of servers corresponding to the server cluster, and the current total operation count cached locally, the current operation count threshold corresponding to the target server is determined, wherein the current total operation count is the total operation count corresponding to the server cluster obtained by the target server from the cache server based on the operation count read request;
[0114] If the number of operations performed on the target local machine is greater than or equal to the current operation count threshold, then the number of operations performed on the target local machine is written into the cache server.
[0115] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0116] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0117] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0118] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0119] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0120] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A request processing method, characterized in that, The target servers applied to the server cluster include: Obtain the number of write requests sent by the client, wherein the number of write requests includes the number of write operations to be performed corresponding to a preset operation triggered on the client; Based on the current number of local operations cached locally, the number of write operations to be cached locally to determine the target number of local operations; The current total number of operations in the local cache is matched with the pre-configured operation count display range, and the current display step size corresponding to the current total number of operations is determined based on the matching result; the ratio between the current display step size and the number of servers corresponding to the server cluster is determined as the current operation count threshold corresponding to the target server, wherein the current total number of operations is the total number of operations corresponding to the server cluster obtained by the target server from the cache server based on the count read request; If the number of operations performed on the target local machine is greater than or equal to the current operation count threshold, then the number of operations performed on the target local machine is written into the cache server.
2. The method according to claim 1, characterized in that, The process of determining the target number of local operations based on the local cache, including caching the number of write operations locally, and determining the target number of local operations, includes: The current number of local operations in the local cache and the number of operations to be written are added together, and the result is used as the target number of local operations.
3. The method according to claim 2, characterized in that, The process of determining the target number of local operations based on the local cache, including caching the number of write operations locally, and determining the target number of local operations, includes: If the current number of local operations in the local cache is greater than a first preset number and the current total number of operations is greater than a second preset number, then based on the current number of local operations, the number of operations to be written is locally cached to determine the target number of local operations.
4. The method according to claim 3, characterized in that, The method further includes: If the current number of local operations in the local cache is less than or equal to a first preset number, or the current total number of operations is less than or equal to a second preset number, then the number of operations to be written is written to the cache server.
5. The method according to claim 1, characterized in that, The step of matching the current total number of operations cached locally with the pre-configured operation count display range, and determining the current display step size corresponding to the current total number of operations based on the matching result, includes: The current total number of operations cached locally is matched with each pre-configured operation count display interval to determine the target operation count display interval in which the current total number of operations falls; Determine the target display step size corresponding to the target operation count display interval, and set the target display step size as the current display step size corresponding to the current total operation count.
6. The method according to claim 1, characterized in that, The method further includes: If the current time is greater than or equal to the pre-configured cache validity period, the current number of local operations in the local cache is written to the cache server.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Get the number of read requests sent by the client; If a local cached total number of operations exists, the target total number of operations is determined based on the local cached total number of operations and the current local operation count, and the target total number of operations is sent to the client.
8. A request processing apparatus, characterized in that, The target servers integrated into the server cluster include: The write count request acquisition module is used to acquire write count requests sent by the client, wherein the write count request includes the number of write operations to be performed corresponding to a preset operation triggered on the client; The local caching module is used to cache the number of write operations locally based on the current number of local operations, and determine the target number of local operations. The current operation count threshold determination module is used to match the current total number of operations cached locally with the pre-configured operation count display range, and determine the current display step size corresponding to the current total number of operations based on the matching result; the ratio between the current display step size and the number of servers corresponding to the server cluster is determined as the current operation count threshold corresponding to the target server, wherein the current total number of operations is the total number of operations corresponding to the server cluster obtained by the target server from the cache server based on the count read request; The server write module is used to write the target local operation count into the cache server if the target local operation count is greater than or equal to the current operation count threshold.
9. A request processing system, characterized in that, The system includes: a client, a server cluster, and a cache server; The target server in the server cluster is used to implement the request processing method as described in any one of claims 1-7.
10. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the request processing method as described in any one of claims 1-7.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the request processing method as described in any one of claims 1-7.
Citation Information
Patent Citations
Write-in method and device for count data
CN105095423A
