Request processing system

By introducing routers and message queue clusters into the request processing system to control the execution order of data operation instructions, the problem of inconsistency between cache and database in high-concurrency environments is solved, and the accuracy and consistency of data operations are achieved.

CN115794298BActive Publication Date: 2026-01-13SOUNDAI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211339217.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-28
Publication Date
2026-01-13
Estimated Expiration
2042-10-28

AI Technical Summary

Technical Problem

In a high-concurrency environment, if the server does not update the database in a timely manner after deleting the cache, it can lead to inconsistencies between the cache and the database, especially when there are concurrent read and update requests, resulting in the old data being read and put into the cache.

Method used

A request processing system is adopted, including routers, message queue clusters, and business server clusters. The routers send the target operation instructions to the target queue in the message queue cluster. The message queue cluster sends the instructions to the associated business servers. The business servers retrieve the execution results from the cache or database and do not send the next instruction until the data operation instruction is completed, thus avoiding parallel execution of read and update operations.

Benefits of technology

It effectively avoids inconsistencies between caching and databases, ensures that data operation instructions are executed sequentially, and improves the accuracy and consistency of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115794298B_ABST
    Figure CN115794298B_ABST
Patent Text Reader

Abstract

The application provides a request processing system, belonging to the technical field of Internet. The request processing system comprises a router, a message queue cluster, a business server cluster and a database. The router is used for obtaining a target operation instruction of target data from a data request of a terminal, and sending the target operation instruction to a target queue in the message queue cluster. The message queue cluster is used for sending the target operation instruction in the target queue to a target business server. The target business server is used for obtaining an execution result of the target operation instruction from a cache of the database or the database based on the target operation instruction, and returning the execution result to the router. The router is further used for sending the execution result to the terminal, and displaying the execution result based on the target object by the terminal. The request processing system avoids the inconsistency problem of the cache and the database.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Internet, in particular to a request processing system. BACKGROUND

[0002] With the development of Internet technology, shopping through an e-commerce platform is becoming more and more popular. In the e-commerce field, the amount of requests accepted by the background server of the e-commerce platform is very large. In order to improve the reading speed of data, the background server usually caches the data in the database, so that the terminal can directly read the data from the cache without accessing the database, thereby reducing the pressure on the database and improving the performance of the server. Although the cache can improve the performance of the server, improper use of the cache can cause cache avalanche, cache penetration, and cache and database double-write consistency problems. Therefore, how to correctly use the cache is a technical problem to be solved.

[0003] In the related art, the server usually uses the method of deleting the cache first and then updating the database to solve the inconsistency between the cache and the database data. Accordingly, when the data in the database changes, the server first deletes the cache, then modifies the database, and then stores the updated data in the cache, thereby avoiding the inconsistency between the cache and the database data.

[0004] However, in a high-concurrency environment, the server will concurrently process a large number of data requests. In the case of concurrently reading data requests and updating data requests for any data, after the server deletes the cache, it immediately reads the cache. At this time, the cache read is empty and the database has not been updated, so a query in the database will get the old data before the update and put the old data into the cache, thereby causing the inconsistency between the cache and the database data. SUMMARY

[0005] The embodiment of the present application provides a request processing system, which can avoid the inconsistency between the cache and the database. The technical solution is as follows:

[0006] According to an aspect of the embodiment of the present application, a request processing system is provided, which comprises a router, a message queue cluster, a business server cluster and a database;

[0007] The router is configured to obtain a target operation instruction of target data from a data request of a terminal; and send the target operation instruction to a target queue in the message queue cluster, the target data being attribute data of a target object displayed by the terminal, the target queue being configured to store data operation instructions of the target data, the data operation instructions comprising data reading instructions and data updating instructions;

[0008] The message queue cluster is configured to send the target operation instruction in the target queue to a target service server, the target service server being a service server associated with the target queue in the service server cluster;

[0009] The target service server is configured to obtain an execution result of the target operation instruction from a cache of the database or the database based on the target operation instruction, and return the execution result to the router;

[0010] The router is further configured to send the execution result to the terminal, and display the execution result based on the target object by the terminal.

[0011] In some embodiments, the router is further configured to obtain a data type of the target data from the data request of the terminal;

[0012] The sending of the target operation instruction to the target queue in the message queue cluster comprises:

[0013] In a case where the data type is a first data type, the target operation instruction is sent to a first queue, the first data type representing a read-only attribute of the target object, and the first queue being configured to store a data read instruction for the read-only attribute;

[0014] In a case where the data type is a second data type, a target operation instruction of target data carried in the data request is sent to a second queue, the second data type representing an editable attribute of the target object, and the second queue being configured to store a data operation instruction for the editable attribute.

[0015] In some embodiments, the target operation instruction is a data update instruction;

[0016] The sending of the target operation instruction to the target queue in the message queue cluster comprises:

[0017] A related object associated with the target object is determined, and attributes of the related object and attributes of the target object influence each other;

[0018] The target operation instruction is sent to a third queue, and the third queue is configured to store a data operation instruction for attribute data of the related object.

[0019] In some embodiments, the target operation instruction is a data update instruction;

[0020] The obtaining of the execution result of the target operation instruction from the cache of the database or the database based on the target operation instruction comprises:

[0021] in response to the data update instruction, deleting the target data from the cache of the database;

[0022] updating the target data in the database to obtain updated target data;

[0023] storing the updated target data into the cache of the database.

[0024] In some embodiments, the router is further configured to obtain an object identifier of the target object from the data request of the terminal.

[0025] The sending of the target operation instruction to the target queue in the message queue cluster comprises:

[0026] sending the target operation instruction to a target queue corresponding to the object identifier.

[0027] In some embodiments, the target operation instruction is a data read instruction.

[0028] The message queue cluster is further configured to, in a case where there is a repeated operation instruction repeated with the target operation instruction in the target queue, and there is a data update instruction between the target operation instruction and the repeated operation instruction, remove the repeated operation instruction from the target queue; and in a case where there is no data update instruction between the target operation instruction and the repeated operation instruction, remove the target operation instruction from the target queue.

[0029] In some embodiments, the target operation instruction is a data update instruction.

[0030] The message queue cluster is further configured to, in a case where there is a repeated operation instruction repeated with the target operation instruction in the target queue, remove the target operation instruction from the target queue.

[0031] In some embodiments, for any service server, the router is further configured to determine a weight of the service server based on state information of the service server, the state information being used to indicate a working state of the service server; and determine at least one message queue associated with the service server from the message queue cluster based on the weight of the service server.

[0032] In some embodiments, the router is further configured to determine a time interval at which the service server updates state information based on a service type of the service server; obtain the state information of the service server every time interval; and update a message queue associated with the service server in response to a change in the state information of the service server.

[0033] In some embodiments, the message queue cluster is further configured to, in response to an update of the data operation instruction in the target queue, persist the updated data operation instruction of the target queue.

[0034] In some embodiments, the router is further configured to, in a case that a first service server is added to the service server cluster, determine at least one second service server in a first state from the service server cluster, the first state being used to indicate that the load of the service server is greater than a load threshold; determine at least one message queue associated with the at least one second service server; and associate the at least one message queue with the first service server.

[0035] In some embodiments, the service server cluster is further configured to, in a case that a third service server in the service server cluster is in an unavailable state, remove the third service server from the service server cluster.

[0036] The router is further configured to distribute at least one message queue associated with the third service server to other service servers in the service server cluster.

[0037] Embodiments of the present application provide a request processing system, which comprises a router, a message queue cluster, a plurality of service servers and a database. The target operation instruction in the target data obtained is sent to a target queue in the message queue cluster through the router, and the target operation instruction in the target queue is sent to a service server associated with the target queue by the message queue cluster, so that when a plurality of data operation instructions are performed on any data concurrently, the service server can execute each data operation instruction in turn, obtain an execution result of the data operation instruction from a cache or a database, and return the execution result to the router, which is distributed to a terminal. Since the next data operation instruction is not sent to the service server before the previous data operation instruction is executed, the inconsistency between the cache and the database caused by the old data that has not been updated being put into the cache when the data read instruction is executed in parallel before the data update instruction is executed is avoided. BRIEF DESCRIPTION OF DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.

[0039] Figure 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application;

[0040] Figure 2 is an interactive flowchart of a request processing system provided by an embodiment of the present application for processing a request;

[0041] Figure 3 is a schematic diagram of a request processing system provided by an embodiment of the present application;

[0042] Figure 4 is a structural block diagram of a terminal provided by an embodiment of the present application;

[0043] Figure 5 is a structural block diagram of a server provided by an embodiment of the present application. DETAILED DESCRIPTION

[0044] To make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0045] It can be understood that the terms "first", "second" and the like used in the present application can be used herein to describe various concepts, but unless specifically stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another.

[0046] The terms "at least one", "multiple", "each", "any" and the like used in the present application include one, two or more than two, multiple includes two or more than two, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0047] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals involved in the present application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0048] Figure 1 is a schematic diagram of an implementation environment of a request processing system provided by an embodiment of the present application. Referring to Figure 1 , the implementation environment includes a terminal 101 and a request processing system 102, the request processing system 102 includes a router 1021, a message queue cluster 1022, a service server cluster 1023 and a database 1024. The terminal 101 and the router 1021 are connected through a wireless or wired network.

[0049] The router 1021 is configured to obtain a target operation instruction of target data from the data request of the terminal 101, and send the target operation instruction to a target queue in the message queue cluster 1022, the target data being attribute data of a target object displayed by the terminal, the target queue being configured to store a data operation instruction of the target data, the data operation instruction including a data reading instruction and a data updating instruction.

[0050] The message queue cluster 1022 is configured to send the target operation instruction in the target queue to a target business server, the target business server being a business server associated with the target queue in the business server cluster 1023.

[0051] The target business server is configured to obtain an execution result of the target operation instruction from a cache of the database 1024 or the database 1024 based on the target operation instruction, and return the execution result to the router.

[0052] The router 1021 is further configured to send the execution result to the terminal 101, and the terminal 101 displays the execution result based on the target object.

[0053] Optionally, the terminal 101 is a mobile phone, a desktop computer, a notebook computer, a tablet computer, a smart watch or the like. Optionally, the request processing system 102 can be a server cluster composed of multiple physical servers or a distributed system, and can also be a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platform.

[0054] Optionally, the terminal 101 is installed with an application provided by the request processing system 102, and the terminal 101 interacts with the request processing system 102 through the application.

[0055] Optionally, the request processing system provided in the embodiments of the present application can be applied to a scenario of a flash sale activity in an e-commerce field. For example, when a user participates in a flash sale activity through the terminal 101, the user needs to obtain the inventory quantity of a product. The terminal 101 sends a data request to the router 1021 in response to a view operation of the product triggered by the user, the router 1021 obtains the data request, processes the data request through the message queue cluster 1022, the business server cluster 1023 and the database 1023, obtains the inventory quantity of the product, and returns the result to the terminal 101, and the terminal 101 displays the inventory quantity of the product to the user.

[0056] Of course, the request processing system provided in the embodiments of the present application can also be applied to other scenarios, which are not limited in the embodiments of the present application.

[0057] The embodiment of the present application provides a request processing system, which comprises a router, a message queue cluster, a service server cluster and a database. Figure 2 The embodiment of the present application provides an interactive flowchart of a request processing system for processing a request. Referring to Figure 2 The interactive flowchart of the request processing system is as follows:

[0058] 201. The router obtains a target operation instruction of target data from a data request of a terminal, and the target data is attribute data of a target object displayed by the terminal.

[0059] In the embodiment of the present application, the router is a hardware device connecting two or more networks, and functions as a gateway between the networks. The router can receive a data request sent by a terminal, and then parse a target operation instruction of target data from the data request. The terminal is a mobile phone, a desktop computer, a notebook computer, a tablet computer or the like. The target object is content displayed based on the terminal, which can be a webpage displayed by the terminal or a commodity in a shopping interface displayed by the terminal. The terminal sends a data request to the router in response to a processing operation of a user on the target data. The data request carries a target operation instruction of the target data, and the target operation instruction is a data operation instruction for instructing a server to process the target data.

[0060] In some embodiments, the target object can be a commodity, a webpage or a game character. When the target object is a commodity, the target data can be attribute data such as a price, a quantity or a size of the commodity; when the target object is a game character, the target data can be attribute data such as a blood volume, a skill or an appearance of the game character; and when the target object is a webpage, the target data can be attribute data such as an appearance or a type of the webpage.

[0061] 202. The router sends the target operation instruction to a target queue in the message queue cluster, and the target queue is used for storing a data operation instruction of the target data, and the data operation instruction comprises a data reading instruction and a data updating instruction.

[0062] In the embodiment of the present application, the router can send the parsed target operation instruction to a target queue in the message queue cluster. The message queue cluster comprises a plurality of message queues, and the target queue is a message queue used for storing a data operation instruction of the target data. In a data transmission process, the message queue is a container used for storing a data operation instruction of data.

[0063] In some embodiments, the router can send the target operation instruction of the target data to a corresponding message queue based on a data type of the target data. Accordingly, the router obtains the data type of the target data from the data request of the terminal, and performs the following step (1) in a case where the data type is a first data type; performs the following step (2) in a case where the data type is a second data type.

[0064] (1) In a case where the data type is the first data type, the router sends the target operation instruction to a first queue, the first data type represents a read-only attribute of the target object, and the first queue is used to store a data read instruction for the read-only attribute.

[0065] In the embodiments of the present application, the router first obtains the target operation instruction of the target data from the data request of the terminal, and then obtains the data type of the target data by analyzing the data request. In a case where the data type is the first data type, the router sends the target operation instruction of the target data to a first queue, and the first queue is the target queue. Since the first data type represents the read-only attribute of the target object, in a case where the data type of the target data is the first data type, the target operation instruction is a data read instruction, and is not a data update instruction.

[0066] (2) In a case where the data type is the second data type, the router sends the target operation instruction of the target data carried in the data request to a second queue, the second data type represents an editable attribute of the target object, and the second queue is used to store a data operation instruction for the editable attribute.

[0067] In the embodiments of the present application, the router first obtains the target operation instruction of the target data from the data request of the terminal, and then obtains the data type of the target data by analyzing the data request. In a case where the data type is the second data type, the router sends the target operation instruction of the target data to a second queue, and the second queue is the target queue. Since the second data type represents the editable attribute of the target object, in a case where the data type of the target data is the second data type, the target operation instruction can be a data read instruction or a data update instruction.

[0068] In some embodiments, the attribute data of the target object is affected by the attribute data of other objects, and the router can send the target operation instruction to a corresponding message queue by determining a related object associated with the target object, and the attributes of the related object and the target object affect each other. Accordingly, in a case where the target operation instruction is a data update instruction, the router determines a related object associated with the target object; and sends the target operation instruction to a third queue, and the third queue is used to store a data operation instruction for the attribute data of the related object.

[0069] In the method, the router first acquires the target operation instruction of the target data from the data request of the terminal. In a case where the target operation instruction is a data update instruction, the router determines a message queue for storing a data operation instruction of attribute data of a related object associated with the target object, i.e., a third queue, which is the target queue. The router sends the target operation instruction of the target data to the third queue. Since the attribute of the related object and the attribute of the target object influence each other, in a case where the target operation instruction of the attribute data of the target object is a data update instruction, i.e., the attribute data of the target object is changed, the attribute data of the related object will be influenced by the attribute data of the target object and will also be changed accordingly. By sending the target operation instruction to the third queue for storing the data operation instruction of the attribute data of the related object, it can be ensured that the attribute data of the related object associated with the target object is changed accordingly when the attribute data of the target object is changed. Correspondingly, in a case where the target operation instruction is a data read instruction, since the attribute data of the target object is not updated, the target operation instruction can be sent to the message queue corresponding to the target object or can be sent to the third queue.

[0070] In some embodiments, the router can send the target operation instruction to the target queue corresponding to the object identifier based on the object identifier of the target object. Correspondingly, the router acquires the object identifier of the target object from the data request of the terminal, and sends the target operation instruction to the target queue corresponding to the object identifier. In the embodiments of the present application, the router first acquires the target operation instruction of the target data from the data request of the terminal. Since the target data is the attribute data of the target object displayed by the terminal, based on the data request, the router can also acquire the object identifier of the target object. Then the router sends the target operation instruction of the attribute data of the target object to the target queue corresponding to the object identifier. The object identifier of the target object includes various types of identifiers. For example, when the object identifier of the target object is a page identifier, the page identifier is used to indicate the web page to which the target object belongs; when the object identifier of the target object is a commodity identifier, the commodity identifier is used to indicate the type of commodity to which the target object belongs; when the object identifier of the target object is a game object identifier, the game object identifier is used to indicate the type of game object to which the target object belongs.

[0071] 203、The message queue cluster sends the target operation instruction in the target queue to a target service server, and the target service server is a service server associated with the target queue in the service server cluster.

[0072] In the embodiments of the present application, the service server cluster includes a plurality of service servers. The service server is associated with a message queue, and the service server is configured to process data based on data operation instructions in the message queue. Since the target service server is associated with the target queue, the message queue cluster can sequentially send data operation instructions in the target queue to the target service server associated with the target queue. The target service server is configured to process target data based on the received data operation instructions.

[0073] In some embodiments, when the target operation instruction is inserted into the target queue, the message queue cluster can also deduplicate data operation instructions in the target queue. Correspondingly, in the case where the target operation instruction is a data read instruction, the message queue cluster performs step (1); in the case where the target operation instruction is a data update instruction, the message queue cluster performs step (2).

[0074] (1) In the case where there is a duplicate operation instruction that duplicates the target operation instruction in the target queue, and there is a data update instruction between the target operation instruction and the duplicate operation instruction, the message queue cluster removes the duplicate operation instruction from the target queue; in the case where there is no data update instruction between the target operation instruction and the duplicate operation instruction, the message queue cluster removes the target operation instruction from the target queue.

[0075] Wherein, after the router sends the target operation instruction of the target data to the target queue, since the target queue stores a plurality of data operation instructions, in the case where the plurality of data operation instructions are the same data operation instruction, in order to speed up the processing speed of the target service server, the message queue cluster can deduplicate the data operation instructions in the target queue. Therefore, in the case where the target operation instruction is a data read instruction, and there is a duplicate operation instruction that duplicates the target operation instruction in the target queue, since the insertion time of the duplicate operation instruction is earlier than that of the target operation instruction, the message queue cluster can deduplicate in different ways according to different situations. Mode one, in the case where there is a data update instruction between the target operation instruction and the duplicate operation instruction, the message queue cluster can remove the duplicate operation instruction from the target queue, so that the target service server can ensure that the target service server obtains the execution result of the target operation instruction from the cache or the database of the most recently updated database when executing the target operation instruction. Mode two, in the case where there is no data update instruction between the target operation instruction and the duplicate operation instruction, the target operation instruction is removed from the target queue. Since the execution results of these data read instructions are the same, in order to reduce the storage burden of the message queue cluster, the target operation instruction is removed from the target queue.

[0076] (2) In the case that there is a repeated operation instruction duplicated with the target operation instruction in the target queue, the message queue cluster removes the target operation instruction from the target queue.

[0077] In the case that the target operation instruction is a data update instruction and there is a repeated operation instruction duplicated with the target operation instruction in the target queue, since the insertion time of the repeated operation instruction is earlier than that of the target operation instruction, after the repeated operation instruction is executed, the target operation instruction does not need to be executed again, that is, the target operation instruction is a redundant data operation instruction, and thus the message queue cluster can remove the target operation instruction from the target queue. In this case, a plurality of repeated data update instructions are arranged together, and since the execution results of these data update instructions are the same, in order to reduce the storage burden of the message queue cluster, the target operation instruction is removed from the target queue.

[0078] It should be noted that, taking the data update instruction as an example, the data update instructions sent by the same terminal for the same data are repeated data operation instructions, and the data update instructions sent by different terminals for the same data are not repeated data operation instructions. The same applies to the data read instruction, which is not described here.

[0079] In some embodiments, in order to avoid the loss of data operation instructions in the message queue in the case of message queue exception, the message queue cluster can perform persistent processing on the data operation instructions in the target queue. Correspondingly, in response to the update of the data operation instructions in the target queue, the message queue cluster performs persistent processing on the data operation instructions of the updated target queue.

[0080] In the case that the message queue appears an exception, the message queue cluster can also obtain the lost data operation instruction by replaying the data operation instruction in the target queue. Alternatively, the message queue cluster can use a third-party middleware to perform persistent processing on the data operation instruction in the target queue. For example, redis (remote dictionary server), rabbitmq (a message queue service software), kafka (a subscription message system), and the like all implement good persistent mechanisms. Among them, the kafka message queue naturally supports zero-copy of messages and disk sequential read-write mechanism, and the data processing capacity can reach tens of millions, greatly improving the data processing capacity. The high performance and high reliability of the request are guaranteed.

[0081] It should be noted that the embodiments of the present application take the target operation instruction inserting the target queue as an example to illustrate the de-duplication, optionally, the message queue cluster can de-duplicate any message queue when a data operation instruction is added to the message queue, or the message queue cluster can de-duplicate each message queue every certain period of time, and the embodiments of the present application do not limit this.

[0082] 204. The target service server obtains an execution result of the target operation instruction from the cache of the database or the database based on the target operation instruction.

[0083] In the embodiments of the present application, since the data operation instruction includes the data read instruction and the data update instruction, the target service server obtains the execution result of the target operation instruction from the cache of the database or the database based on different target operation instructions. In the case that the target operation instruction is the data update instruction, the target service server deletes the target data from the cache of the database in response to the data update instruction, updates the target data in the database to obtain updated target data, and stores the updated target data into the cache of the database. In the case that the target operation instruction is the data read instruction, the target service server can read the target data from the cache of the database based on the data read instruction. In the case that the cache of the database includes the target data, the target service server returns the target data to the router; in the case that the cache of the database does not include the target data, the target service server reads the target data from the database and puts the target data into the cache.

[0084] In some embodiments, the router associates the service server with at least one message queue based on the state information of the service server, and the state information is used to indicate the working state of the service server. Accordingly, for any service server, the router determines the weight of the service server based on the state information of the service server. The router determines at least one message queue associated with the service server from the message queue cluster based on the weight of the service server. By associating the service server with the message queue based on the weight, the message queue can be reasonably distributed according to the service processing capacity of the service server, the computing resources of the service server can be fully utilized, and the service processing efficiency can be improved.

[0085] In the embodiments of the present application, since the configurations of the service servers in the service server cluster can not be consistent, some service servers have high configurations and can process data operation instructions of the message queues at high speed, and some service servers have low configurations and can process data operation instructions of the message queues at low speed. Therefore, it is not a good processing manner to equally distribute the message queues to the service servers. The router can determine the weight of the service server based on the state information of the service server, and the weight can reflect the service processing capability of the service server, that is, the number of the message queues that can be processed by the service server. Based on the weight, the router can select at least one message queue from the message queue cluster and associate the at least one message queue with the service server. The weight of the service server is positively correlated with the number of the message queues associated with the service server, that is, the greater the weight, the greater the number of the message queues associated with the service server; and the smaller the weight, the smaller the number of the message queues associated with the service server.

[0086] In some embodiments, in the case that the state information of the service server changes, the router updates the message queues associated with the service server. Correspondingly, the router determines the time interval at which the service server updates the state information based on the service type of the service server; acquires the state information of the service server every time interval; and updates the message queues associated with the service server in response to the change of the state information of the service server.

[0087] Since the working state of the service server is not always unchanged, in the case that the state information of the service server changes, the service server cluster needs to regularly report the state information of the service server, so that the router can monitor the working state of the service server in real time. The time interval at which the state information of the service server is reported is not limited. The router can determine the time interval at which the service server updates the state information based on the service type of the service server, and acquire the state information of the service server every time interval. When the state information of the service server changes, the router updates the weight of the service server based on the changed state information. The router updates the message queues associated with the service server based on the updated weight. This enables the router to acquire the latest state information of the service server, and update the message queues associated with the service server when the state information changes, thereby avoiding congestion of the message queues and improving the service processing efficiency.

[0088] In some embodiments, the number of the service servers in the service server cluster can be dynamically expanded or scaled in different cases. Correspondingly, in the case that the service server cluster is expanded, the router performs the following step (1); and in the case that the service server cluster is scaled, the router and the service server cluster perform the following step (2).

[0089] (1) In a case where a first service server in idle is added to the service server cluster, the router determines at least one second service server in the first state from the service server cluster, the first state being used to indicate that the load of the service server is greater than the load threshold; determines at least one message queue associated with the at least one second service server; and associates the at least one message queue with the first service server.

[0090] In the embodiment of the present application, in a case where a first service server in idle is added to the service server cluster, the router can obtain the state information of the service server every time interval, so that the real-time state information of the service server cluster can be obtained. When the router obtains that the first service server in the service server cluster is in idle, at least one second service server in the first state can be determined from the service server cluster. The first state is used to indicate that the load of the service server is greater than the load threshold. The router can assign at least one message queue associated with the second service server to the first service server, that is, associate the at least one message queue associated with the second service server with the first service server.

[0091] (2) In a case where the state of a third service server in the service server cluster is unavailable, the service server cluster removes the third service server from the service server cluster; and the router assigns at least one message queue associated with the third service server to other service servers in the service server cluster, the third service server being any service server.

[0092] In the embodiment of the present application, in a case where the state of a third service server in the service server cluster is unavailable, the service server cluster removes the third service server. When the router obtains that the state of the third service server is unavailable, at least one message queue associated with the third service server is assigned to other service servers in the service server cluster. That is, the message queue associated with the third service server is reassigned.

[0093] 205. The target service server returns the execution result of the target operation instruction to the router.

[0094] In the embodiment of the present application, after the target service server obtains the execution result of the target operation instruction, the target service server can directly return the execution result of the target operation instruction to the router, and the router forwards the execution result. The target service server can also return the execution result of the target operation instruction to the router through the message queue, so as to avoid that the router simultaneously receives too many execution results and causes downtime.

[0095] 206. The router sends the execution result to the terminal, which then displays the result based on the target object.

[0096] In this embodiment, the router receives the execution result of the target operation instruction sent by the target service server and sends the execution result to the terminal. The terminal can then display the execution result based on the target object.

[0097] For example: if the target object is a product and the target operation instruction is to update the inventory quantity or the discounted price, the terminal can display the inventory quantity of the product or the discounted price of the product; if the target object is a game character and the target operation instruction is to update the remaining health or skills, the terminal can display the remaining health of the game character or the skills of the character after upgrading.

[0098] This application provides a request processing system comprising a router, a message queue cluster, multiple service servers, and a database. The router sends target operation instructions from acquired target data to a target queue in the message queue cluster. The message queue cluster then sends the target operation instructions from the target queue to the service servers associated with that target queue. This allows the service servers to execute each data operation instruction sequentially when multiple data operation instructions are concurrently executed on any given data. The service servers retrieve the execution results from the cache or database and return them to the router, which then distributes them to the terminals. Since the next data operation instruction is not sent to the service server until the previous one has been completed, this avoids inconsistencies between the cache and the database caused by executing data read instructions in parallel before data update instructions have been completed, thus preventing the inconsistency between the cache and the database.

[0099] This application also provides a schematic diagram of a request processing system, such as... Figure 3 As shown, the request processing system includes a router, a message queue cluster, and a service server cluster. The router obtains data operation instructions for the target data from the terminal's data request and sends these instructions to a message queue in the message queue cluster. The message queue cluster then sends the data operation instructions from its message queue to the service server associated with that message queue. The service server can execute each data operation instruction sequentially. The service server cluster can also report the status information of the service servers to the router. Based on this status information, the router determines at least one message queue associated with each service server.

[0100] The embodiment of the present application provides a computer device, which comprises a processor and a memory, and the memory stores at least one program code, the at least one program code is loaded and executed by the processor to realize the process of data request processing in the above embodiment.

[0101] When the computer device is provided as a terminal, Figure 4 FIG. 4 is a structural block diagram of a terminal 400 according to an embodiment of the present application. The terminal 400 comprises a processor 401 and a memory 402.

[0102] The processor 401 can comprise one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 401 can be implemented in the form of at least one of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 401 can also comprise a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 401 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing content required to be displayed by a display screen. In some embodiments, the processor 401 can further comprise an AI (Artificial Intelligence) processor for processing machine learning related computing operations.

[0103] The memory 402 can comprise one or more computer-readable storage media, which can be non-transitory. The memory 402 can further comprise a high-speed random access memory, and a non-volatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one program code for being executed by the processor 401 to implement the control method provided by the method embodiment of the present application.

[0104] In some embodiments, terminal 400 can further include a peripheral device interface 403 and at least one peripheral device. Processor 401, memory 402, and peripheral device interface 403 can be connected through a bus or signal line. Each peripheral device can be connected to peripheral device interface 403 through a bus, signal line, or circuit board. Specifically, the peripheral devices include at least one of radio frequency circuit 404, display screen 405, camera component 406, audio circuit 407, positioning component 408, and power supply 409.

[0105] Peripheral device interface 403 can be used to connect at least one peripheral device related to input / output to processor 401 and memory 402. In some embodiments, processor 401, memory 402, and peripheral device interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 401, memory 402, and peripheral device interface 403 can be implemented on a separate chip or circuit board, and the present embodiments are not limited in this regard.

[0106] Radio frequency circuit 404 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. Radio frequency circuit 404 communicates with communication networks and other communication devices through electromagnetic signals. Radio frequency circuit 404 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, radio frequency circuit 404 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, an object identity module card, and the like. Radio frequency circuit 404 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, radio frequency circuit 404 can also include NFC (Near Field Communication) related circuitry, and the present application is not limited in this regard.

[0107] The display screen 405 is configured to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 405 is a touch display screen, the display screen 405 is further configured to capture touch signals on or above the surface of the display screen 405. The touch signals can be input to the processor 401 as control signals for processing. In this case, the display screen 405 can also be configured to provide virtual buttons and / or virtual keyboard, also known as soft buttons and / or soft keyboard. In some embodiments, the display screen 405 can be one, arranged on the front panel of the terminal 400; in other embodiments, the display screen 405 can be at least two, arranged on different surfaces of the terminal 400 or in a folding design; in other embodiments, the display screen 405 can be a flexible display screen, arranged on a curved surface or a folding surface of the terminal 400. Even, the display screen 405 can also be arranged in an irregular shape, i.e. a special-shaped screen. The display screen 405 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc.

[0108] The camera assembly 406 is configured to capture images or videos. Optionally, the camera assembly 406 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, the rear camera is at least two, which are any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, to realize the background blur function by fusing the main camera and the depth-of-field camera, the panoramic shooting and VR (Virtual Reality) shooting function by fusing the main camera and the wide-angle camera, or other fusion shooting functions. In some embodiments, the camera assembly 406 can further include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. The dual-color temperature flash refers to the combination of a warm light flash and a cold light flash, which can be used for light compensation under different color temperatures.

[0109] The audio circuit 407 can include a microphone and a speaker. The microphone is used to collect sound waves of an object and an environment, and convert the sound waves into an electrical signal input to the processor 401 for processing, or input to the radio frequency circuit 404 to realize voice communication. For the purpose of stereo sound collection or noise reduction, the microphone can be multiple, respectively arranged at different parts of the terminal 400. The microphone can also be an array microphone or an omnidirectional collection type microphone. The speaker is used to convert the electrical signal from the processor 401 or the radio frequency circuit 404 into sound waves. The speaker can be a conventional diaphragm speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only can the electrical signal be converted into a sound wave audible to humans, but also can be converted into a sound wave inaudible to humans for ranging purposes. In some embodiments, the audio circuit 407 can also include a headphone jack.

[0110] The positioning component 408 is used to position the current geographic position of the terminal 400 to realize navigation or LBS (Location Based Service). The positioning component 408 can be a positioning component based on the GPS (Global Positioning System) of the United States, the Beidou system of China, the Glonass system of Russia or the Galileo system of the European Union.

[0111] The power supply 409 is used to supply power to each component in the terminal 400. The power supply 409 can be alternating current, direct current, disposable battery or rechargeable battery. When the power supply 409 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0112] In some embodiments, the terminal 400 further includes one or more sensors 410. The one or more sensors 410 include but are not limited to: an acceleration sensor 411, a gyroscope sensor 412, a pressure sensor 413, an optical sensor 414 and a proximity sensor 415.

[0113] The acceleration sensor 411 can detect the acceleration in three coordinate axes of the coordinate system established by the terminal 400. For example, the acceleration sensor 411 can be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 401 can control the display screen 405 to display the object interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 411. The acceleration sensor 411 can also be used for game or motion data collection of the object.

[0114] The gyroscope sensor 412 can detect the body direction and rotation angle of the terminal 400, and can collect 3D motions of the object to the terminal 400 in cooperation with the acceleration sensor 411. The processor 401 can realize the following functions according to the data collected by the gyroscope sensor 412: motion sensing (such as changing the UI according to the tilt operation of the object), image stabilization during shooting, game control, and inertial navigation.

[0115] The pressure sensor 413 can be arranged on the side frame of the terminal 400 and / or the lower layer of the display screen 405. When the pressure sensor 413 is arranged on the side frame of the terminal 400, the holding signal of the object to the terminal 400 can be detected, and the left-hand or right-hand recognition or shortcut operation can be performed by the processor 401 according to the holding signal collected by the pressure sensor 413. When the pressure sensor 413 is arranged on the lower layer of the display screen 405, the controllable control on the UI interface can be controlled by the processor 401 according to the pressure operation of the object to the display screen 405. The controllable control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0116] The optical sensor 414 is used to collect the ambient light intensity. In an embodiment, the processor 401 can control the display brightness of the display screen 405 according to the ambient light intensity collected by the optical sensor 414. Specifically, when the ambient light intensity is high, the display brightness of the display screen 405 is increased; when the ambient light intensity is low, the display brightness of the display screen 405 is decreased. In another embodiment, the processor 401 can also dynamically adjust the shooting parameters of the camera assembly 406 according to the ambient light intensity collected by the optical sensor 414.

[0117] The proximity sensor 415, also known as a distance sensor, is arranged on the front panel of the terminal 400. The proximity sensor 415 is used to collect the distance between the object and the front of the terminal 400. In an embodiment, when the proximity sensor 415 detects that the distance between the object and the front of the terminal 400 gradually decreases, the display screen 405 is switched from the bright screen state to the screen-off state by the processor 401; when the proximity sensor 415 detects that the distance between the object and the front of the terminal 400 gradually increases, the display screen 405 is switched from the screen-off state to the bright screen state by the processor 401.

[0118] Those skilled in the art can understand that the structure shown in the above embodiments is not a limitation on the terminal 400, and the terminal 400 can include more or fewer components than those shown in the figure, or combine certain components, or adopt a different component arrangement. Figure 4

[0119] When the computer device is provided as a server, the server can be a router, a message queue cluster, or a business server cluster. Figure 5 ​is a structural block diagram of a server 500 provided by an embodiment of the present application. The server 500 can have great differences due to different configurations or performances, and can include one or more processors (Central Processing Units, CPUs) 501 and one or more memories 502. The memory 502 stores at least one piece of program code, which is loaded and executed by the processor 501 to implement the process of data request processing in the above-described embodiments. Of course, the server 500 can also have a wired or wireless network interface, a keyboard, an input and output interface, and the like, so as to perform input and output. The server 500 can also include other components for implementing device functions, which are not described herein.

[0120] In an exemplary embodiment, a computer readable storage medium is also provided, which stores at least one piece of program code, which is loaded and executed by a processor to implement the process of data request processing in the above-described embodiments. The computer readable storage medium can be a memory. For example, the computer readable storage medium can be a ROM (Read-Only Memory), a RAM (Random Access Memory), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage terminal, and the like.

[0121] In an exemplary embodiment, a computer program product is also provided, which includes computer program code stored in a computer readable storage medium. A processor reads the computer program code from the computer readable storage medium, and executes the computer program code to implement the process of data request processing in the above-described embodiments.

[0122] Those of ordinary skill in the art can understand that all or part of the steps of the above-described embodiments can be completed by hardware, or by a program instructing related hardware, which can be stored in a computer readable storage medium. The storage medium mentioned above can be a ROM, a disk or an optical disk, and the like.

[0123] The above is only an optional embodiment of the present application, and is not used to limit the present application. Any modification, equivalent replacement, improvement, and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A request processing system, characterized by, The request processing system comprises a router, a message queue cluster, a service server cluster and a database; The router is configured to obtain a target operation instruction of target data from a data request of a terminal, and send the target operation instruction to a target queue in the message queue cluster, the target data being attribute data of a target object displayed by the terminal, the target queue being configured to store data operation instructions of the target data, the data operation instructions comprising data read instructions and data update instructions; The message queue cluster is configured to send the target operation instruction in the target queue to a target service server, the target service server being a service server associated with the target queue in the service server cluster; The target service server is configured to obtain an execution result of the target operation instruction from a cache of the database or the database based on the target operation instruction, and return the execution result to the router; The router is further configured to send the execution result to the terminal, and display the execution result based on the target object by the terminal; The router is further configured to obtain a data type of the target data from the data request of the terminal; The sending of the target operation instruction to the target queue in the message queue cluster comprises: In a case where the data type is a first data type, the target operation instruction is sent to a first queue, the first data type indicating read-only attributes of the target object, and the first queue being configured to store data read instructions for the read-only attributes; In a case where the data type is a second data type, the target operation instruction of the target data carried in the data request is sent to a second queue, the second data type indicating editable attributes of the target object, and the second queue being configured to store data operation instructions for the editable attributes.

2. The system of claim 1, wherein, The target operation instruction is a data update instruction; The sending of the target operation instruction to the target queue in the message queue cluster comprises: determining a related object associated with the target object, attributes of the related object and attributes of the target object influencing each other; sending the target operation instruction to a third queue, the third queue being configured to store data operation instructions for attribute data of the related object.

3. The system of claim 1, wherein, The target operation instruction is a data update instruction; The obtaining of the execution result of the target operation instruction from the cache of the database or the database based on the target operation instruction comprises: in response to the data update instruction, deleting the target data from the cache of the database; updating the target data in the database to obtain updated target data; storing the updated target data into the cache of the database.

4. The system of claim 1, wherein, The router is further configured to obtain an object identifier of the target object from the data request of the terminal; The sending of the target operation instruction to the target queue in the message queue cluster comprises: sending the target operation instruction to a target queue corresponding to the object identifier.

5. The system of claim 1, wherein, The target operation instruction is a data read instruction; The message queue cluster is further configured to remove the duplicate operation instruction from the target queue in a case that the target queue contains a duplicate operation instruction that is duplicated with the target operation instruction and there is a data update instruction between the target operation instruction and the duplicate operation instruction. remove the target operation instruction from the target queue in a case that there is no data update instruction between the target operation instruction and the duplicate operation instruction.

6. The system of claim 1, wherein, The target operation instruction is a data update instruction. The message queue cluster is further configured to remove the target operation instruction from the target queue in a case that the target queue contains a duplicate operation instruction that is duplicated with the target operation instruction.

7. The system of claim 1, wherein, For any service server, the router is further configured to determine a weight of the service server based on state information of the service server, the state information being used to indicate a working state of the service server. The router is further configured to determine at least one message queue associated with the service server from the message queue cluster based on the weight of the service server.

8. The system of claim 7, wherein, The router is further configured to determine a time interval at which the service server updates the state information based on a service type of the service server, to obtain the state information of the service server every time interval, and to update the message queue associated with the service server in response to a change in the state information of the service server.

9. The system of claim 1, wherein, The message queue cluster is further configured to persist the data operation instruction of the target queue in response to an update of the data operation instruction in the target queue.

10. The system of claim 1, wherein, The router is further configured to determine at least one second service server in a first state from the service server cluster in a case that a first service server is added to the service server cluster, the first state being used to indicate that a load of the service server is greater than a load threshold. The router is further configured to determine at least one message queue associated with the at least one second service server and to associate the at least one message queue with the first service server.

11. The system of claim 1, wherein, The service server cluster is further configured to remove a third service server from the service server cluster in a case that the third service server is in an unavailable state. The router is further configured to assign at least one message queue associated with the third service server to other service servers in the service server cluster.

Citation Information

Patent Citations

  • System, method and device for processing database operation request

    CN114547056A

  • Capacity scheduling in a data-processing cluster

    US20190227842A1