Service sub-table query method, device and equipment for service request and storage medium

Through the time slice table rules and hash table rules, the routing table and business table are divided, ensuring that the data is on the same time table, solving the problem of exceeding the limit of routing table capacity in high concurrent systems, and improving query efficiency and system processing capabilities .

CN119088804APending Publication Date: 2024-12-06CHINA MERCHANTS BANK
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411192396.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In a high concurrency and large data volume business system, the single-table capacity limit of routing tables and service tables causes data to frequently switch sub-tables, reducing the efficiency of querying routing data when processing service requests.

Method used

Through the time slice table rules and hash table rules, the routing table and business table are divided into tables to ensure that the business data and routes are on the same set of time tables, and the routing tables are further divided into tables through the hash table rules. Avoid the maximum capacity of the routing subtable exceeds the upper limit and reduce the need to read routing data from the historic library.

Benefits of technology

It improves the efficiency of querying the required routes when processing business requests, avoids frequent recall of routing data from the history library, and improves the system's concurrent processing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088804A_ABST
    Figure CN119088804A_ABST
Patent Text Reader

Abstract

The invention discloses a service sub-table query method and device for a service request, equipment and a storage medium, relates to the technical field of computer systems, and discloses a service sub-table query method for a service request, which comprises the following steps: after obtaining the service request, identifying a routing key associated with a first request from the service request; querying a target routing sub-table containing a routing key from a preset routing table, wherein the preset routing table is a set composed of routing sub-tables obtained after table division through a time slice table division rule and a hash table division rule; and based on the target routing sub-table, querying a target service sub-table in which the service request needs to be written from service sub-tables corresponding to the target routing sub-table, the service sub-table being obtained after the service table is divided through a time slice sub-table rule. Namely, the service data and the corresponding route are ensured to be on the same time sub-table through the time slice sub-table rule, and then the route sub-table is further divided through the Hash sub-table rule, so that the efficiency of querying the required route when the service request is processed is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer systems, and in particular to a method, device, equipment and storage medium for querying a business sub-table for a business request. Background Art

[0002] A high-concurrency business system is a system that can handle a large number of user requests in a short period of time, so as to enhance the system's parallel processing capabilities, reduce response time, and improve user experience.

[0003] Business systems with high concurrency and large amounts of data usually use distributed routing tables to solve the problem of routing consistency for multiple related requests. However, as the volume of business continues to increase, the capacity of a single table has gradually become a performance bottleneck. In order to avoid the rigid business request concurrent processing capacity due to the increase in the capacity of a single table, the routing table and the business table in the business system are usually split according to certain rules to avoid the problem of excessive capacity of a single table by splitting the table. However, since both the routing table and the business table in a high-concurrency system have a single-table maximum capacity limit, and the rate of increase of data in the routing table is much faster than the rate of increase of data in the business table, the business table also needs to be replaced when the routing table is replaced. In order to avoid the data volume of a single table exceeding the maximum capacity of a single table, the split table will be frequently switched according to the growth rate of the data in the routing table and the data will be cleaned up to the historical database. When processing business requests, the corresponding routing data needs to be read from the historical database, thus reducing the efficiency of querying the required routes when processing business requests.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of this application is to provide a business sub-table query method for business requests, aiming to solve the technical problem that when processing business requests, the corresponding routing data needs to be read from the history library again, thereby reducing the efficiency of querying the required routing when processing business requests.

[0006] To achieve the above purpose, the present application proposes a method for querying a business table of a business request, the method comprising:

[0007] After obtaining the service request, identifying a routing key associated with the first request from the service request;

[0008] Querying a target routing subtable containing the routing key from a preset routing table, wherein the preset routing table is a set of routing subtables obtained by partitioning the table according to the time slice partitioning rule and the hash partitioning rule;

[0009] Based on the target routing sub-table, a target service sub-table into which the service request needs to be written is queried from the service sub-table corresponding to the target routing sub-table, wherein the service sub-table is obtained after the service table is divided according to the time slice division rule.

[0010] In one embodiment, after obtaining the service request, before the step of identifying the routing key associated with the first request from the service request, the step further includes:

[0011] After obtaining the first request, determining the working routing sub-table used when receiving the first request, and identifying the routing key from the first request;

[0012] Based on the routing key and the working routing sub-table, determining the routing sub-table where the route required for writing the first request into the working business sub-table is located, the working business sub-table being the business sub-table corresponding to the working routing sub-table;

[0013] Routing information is obtained based on the routing sub-table and the work service sub-table, and the routing information is written into the routing sub-table.

[0014] In one embodiment, the step of obtaining routing information based on the routing sub-table and the work service sub-table and writing the routing information into the routing sub-table further includes:

[0015] Querying the anti-duplicate end date obtained by adding the date of receiving the first request to the preset anti-duplicate days;

[0016] Based on the slice size in the time slice sub-table rule, determining whether the predicted service sub-table used on the anti-duplicate end date is a switching sub-table;

[0017] The step of obtaining routing information based on the routing sub-table and the work service sub-table, and writing the routing information into the routing sub-table comprises:

[0018] If it is determined that the predicted service sub-table is a switching sub-table, determining the synchronous service sub-table used for the anti-duplicate end date;

[0019] Determine a synchronization routing sub-table corresponding to the synchronization service sub-table;

[0020] The routing information is synchronously written into the working routing sub-table and the synchronization routing sub-table.

[0021] In one embodiment, after obtaining the first request, determining the working routing table used when receiving the first request, and identifying the routing key from the first request also includes:

[0022] Obtaining the number of service requests in a preset time period, the maximum supported data volume of a single table in the routing table or the service table, and the required usage time of each single table;

[0023] Based on the number of requests and the usage duration, determining a total amount of data that needs to be stored in the routing table or the service table within the usage duration;

[0024] Based on the total data volume and the maximum supported data volume, determining the number of service sub-tables or routing sub-tables required within the usage time;

[0025] Determine the required slice size of each of the business sub-table and the routing sub-table based on the time slice sub-table rule and the number of sheets;

[0026] The routing sub-table is divided based on a preset multiple and the hash sub-table rule to determine the number of routing sub-tables required to be included in each routing sub-table. The preset multiple is the multiple of the data increase rate in the routing table and the data increase rate in the business table.

[0027] In one embodiment, after obtaining the first request, the step of determining the working routing table used when receiving the first request includes:

[0028] After receiving the first request, read the slice size and table partitioning mode in the time slice table partitioning rule;

[0029] A working routing sub-table to be used when receiving the first request is determined based on the slice size and the sub-table mode.

[0030] In one embodiment, the step of searching the target service sub-table to be written into the service request from the service sub-table corresponding to the target routing sub-table based on the target routing sub-table includes:

[0031] Query the routing information corresponding to the routing key from the target routing subtable;

[0032] Reading the sub-table index in the routing information;

[0033] Based on the sub-table index, the target service sub-table into which the service request needs to be written is queried from the service sub-table corresponding to the target routing sub-table.

[0034] In addition, to achieve the above purpose, the present application also proposes a service sub-table query device for a service request, and the service sub-table query device for a service request includes:

[0035] An acquisition module, configured to, after acquiring the service request, identify a routing key associated with the first request from the service request;

[0036] A first query module, used to query a target routing sub-table containing the routing key from a preset routing table, wherein the preset routing table is a set of routing sub-tables obtained by partitioning the table according to a time slice partitioning rule and a hash partitioning rule;

[0037] The second query module is used to query the target business sub-table where the business request needs to be written from the business sub-table corresponding to the target routing sub-table based on the target routing sub-table, wherein the business sub-table is obtained after the business table is divided according to the time slice division rule.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a business sub-table query device for business requests, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the business sub-table query method for business requests as described above.

[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the business sub-table query method for the business request as described above are implemented.

[0040] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the business sub-table query method for business requests as described above are implemented.

[0041] One or more technical solutions proposed in this application have at least the following technical effects:

[0042] In order to route the service request to the service sub-table containing the first request after obtaining the service request, the present application needs to identify the routing key associated with the first request from the service request, so as to find the target routing sub-table containing the routing key from the set of routing sub-tables obtained after the time slice sub-table rule and the hash sub-table rule are used to divide the service request, and then query the target service sub-table to be written into the service request from the target routing sub-table, wherein the target service sub-table is a sub-table in the service sub-table obtained after the service table is divided by the time slice sub-table rule set. Since the data volume in the routing table increases much faster than the data volume in the service table, Therefore, dividing the routing table and the business table through the time slice partitioning rule can ensure that the business data and the corresponding routes are on the same set of time slice partitioning tables. The logical routing partitioning table obtained after the time slice partitioning is further partitioned through the hash partitioning rule, so that each routing partitioning table contains multiple routing sub-tables to avoid the maximum capacity of each routing partitioning table exceeding the upper limit, and the total data capacity of each routing partitioning table is the same as the total data capacity of the corresponding business partitioning table. Therefore, it is avoided that the corresponding routing data needs to be frequently retrieved from the historical database when processing business requests because the routing partitioning table needs to be processed in a short period of time, thereby improving the efficiency of querying the required routes when processing business requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0045] Figure 1 A flowchart of a method for querying a business table for a business request provided in Embodiment 1 of the present application;

[0046] Figure 2 A flow chart of a route query request provided in Example 1 of the present application;

[0047] Figure 3 A flowchart diagram of a second embodiment of a method for querying a business table for a business request of this application;

[0048] Figure 4 A flowchart of the first request routing write provided in Example 2 of the present application;

[0049] Figure 5 A flowchart diagram of a second embodiment of a method for querying a business table for a business request of this application;

[0050] Figure 6 A schematic diagram of the overall architecture of the sub-table provided in Example 3 of the present application;

[0051] Figure 7 A schematic diagram of the module structure of a device for querying a business table for a business request according to an embodiment of the present application;

[0052] Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the business sub-table query method for business requests in the embodiments of the present application.

[0053] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0054] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0055] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0056] The main solution of the embodiment of the present application is: after obtaining the business request, the business processing platform identifies the routing key associated with the first request from the business request; queries the target routing sub-table containing the routing key from the preset routing table, and the preset routing table is a set of routing sub-tables obtained after partitioning by time slice partitioning rules and hash partitioning rules; based on the target routing sub-table, query the target business sub-table into which the business request needs to be written from the business sub-table corresponding to the target routing sub-table, and the business sub-table is obtained after the business table is partitioned by time slice partitioning rules.

[0057] In this embodiment, for ease of description, the following description is made with the business processing platform as the execution entity.

[0058] Due to the existing technology, high-concurrency and large-data-volume business systems usually use distributed routing tables to solve the problem of routing consistency of multiple related requests. However, as the business volume continues to increase, the capacity of a single table has gradually become a performance bottleneck. In order to avoid the rigid business request concurrent processing capacity due to the increase in the capacity of a single table, the routing table and the business table in the business system are usually split according to certain rules to avoid the problem of excessive capacity of a single table by splitting the table. However, since both the routing table and the business table have a single-table maximum capacity limit in a high-concurrency system, and the rate of increase of data in the routing table is much faster than the rate of increase of data in the business table, the business table also needs to be replaced when the routing table is replaced. In order to avoid the data volume of a single table exceeding the maximum capacity of a single table, the split table will be frequently switched according to the growth rate of the data in the routing table and the data will be cleaned up to the historical database. When processing business requests, the corresponding routing data needs to be read from the historical database, thereby reducing the efficiency of querying the required routes when processing business requests.

[0059] The present application provides a solution. In order to route the business request to the business sub-table containing the first request after obtaining the business request, it is necessary to identify the routing key associated with the first request from the business request, so as to find the target routing sub-table containing the routing key from the set of routing sub-tables obtained after the time slice sub-table rule and the hash sub-table rule are used, and then query the target business sub-table to be written into the business request from the target routing sub-table, wherein the target business sub-table is a sub-table in the business sub-table obtained after the business table is sub-tabled by the time slice sub-table rule set. Since the data volume in the routing table increases much faster than the data volume in the business table, the target business sub-table is a sub-table in the business sub-table obtained after the business table is sub-tabled by the time slice sub-table rule set. Acceleration, therefore, dividing the routing table and the business table by the time slice table rules can ensure that the business data and the corresponding routes are on the same set of time slice tables, and further divide the logical routing table obtained after the time slice table by the hash table rules, so that each routing table contains multiple routing sub-tables to avoid the maximum capacity of each routing table exceeding the upper limit, and make the total data capacity of each routing table the same as the total data capacity of the corresponding business table. Therefore, it is avoided that the routing table needs to be processed in a short time, and the corresponding routing data needs to be frequently retrieved from the historical library when processing business requests, thereby improving the efficiency of querying the required routes when processing business requests.

[0060] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a business processing platform, etc. The following takes the business processing platform as an example to illustrate this embodiment and the following embodiments.

[0061] Based on this, the embodiment of the present application provides a method for querying a business table of a business request, referring to Figure 1, Figure 1 This is a flow chart of the first embodiment of the business sub-table query method for the business request of this application.

[0062] In this embodiment, the service sub-table query method for the service request includes steps S10 to S40:

[0063] Step S10, after obtaining the service request, identifying the routing key associated with the first request from the service request;

[0064] It should be noted that a business request can be the second request for a business or a subsequent associated request after the first request. For example, a collection business can include an order request (first request), a payment request (subsequent associated request), and a refund request (subsequent associated request). The first request can be a request to start a business, that is, the first request for a business. The routing key can be a unique identifier that specifies the message routing path, that is, the routing information of the first request associated with the business request can be queried through the routing key to write the business request to the storage location of the first request. Among them, the routing key can be a hash routing key.

[0065] It is understandable that since the same business needs to be operated on the same set of business tables, in order to ensure that the received business request can be accurately written into the business table saved by the first request, and because the routing key is the association key between the business request and the corresponding first request, the routing information when the first request is written to the business table can be queried through the routing key. Therefore, after obtaining the business request, it is necessary to identify the routing key associated with the corresponding first request from the business request, so as to facilitate the subsequent accurate query of the routing information when the first request was written to the business table according to the routing key.

[0066] Step S20, querying a target routing sub-table containing the routing key from a preset routing table, wherein the preset routing table is a set of routing sub-tables obtained by partitioning the table according to the time slice partitioning rule and the hash partitioning rule;

[0067] It should be noted that the preset routing table may be mainly responsible for the positioning and guidance of data, ensuring that the data can quickly and accurately find the corresponding target processing point. Among them, the preset routing table adopts a strategy that combines the time slice table partitioning rule and the hash table partitioning rule to obtain the routing sub-table that constitutes the preset routing table, so as to increase the total data volume upper limit of the preset routing table through the routing sub-table. The routing sub-table can be a sub-table determined after the theoretical routing sub-table is obtained by partitioning the preset routing table according to the time slice table partitioning rule, and then the theoretical routing sub-table is partitioned by the hash table partitioning rule. The hash table partitioning rule can map data to different tables through a hash function, thereby achieving uniform distribution of data and load balancing.

[0068] It can be understood that since the amount of data stored in each single table reaches the maximum specified data amount, the data in the single table needs to be transferred to the historical database for storage. By dividing the preset routing table through time slice partitioning rules and hash partitioning rules, the maximum data amount of the preset routing table can be increased, avoiding frequent cleaning of data in the routing table to the historical database, and further avoiding the need to read the required data from the historical database when writing business requests to the business table. Therefore, the efficiency of querying the required routes when processing business requests is improved.

[0069] It can be understood that since the preset routing table is a table in which users record routing information for each business, after obtaining the routing key, the routing key can be used to accurately query from the preset routing table in which routing sub-table the routing record of the first request corresponding to the business request is located, and the target routing sub-table containing the routing key can be queried from the preset routing table to reduce the number of routing sub-tables that need to be queried and improve the efficiency of querying the routes required to write business requests to the business table.

[0070] Step S30, based on the target routing sub-table, query the target business sub-table where the business request needs to be written from the business sub-table corresponding to the target routing sub-table, wherein the business sub-table is obtained after the business table is divided according to the time slice division rule.

[0071] It should be noted that the business sub-table is responsible for the data processing of specific businesses, including the processing of business logic and the recording of data status. For example, the order table not only records the basic information of the order, but also may include the order status, processing log, etc. The time slice sub-table rule can improve query efficiency and reduce the pressure of a single table by dividing the data into different segments according to time and storing them in different tables.

[0072] It should be noted that the routing table and the business table are strongly correlated, that is, the routing information recorded in each routing sub-table represents the routing of the corresponding business sub-table. For example, if there are two routing sub-tables A and B at the same time, there are also two business sub-tables A and B. Among them, the routing sub-table A stores the routing information located in the A business sub-table, and the routing sub-table B stores the routing information located in the B business sub-table. When the A routing sub-table is switched to the B routing sub-table, the business sub-table is also switched to the B business sub-table. Therefore, after determining the target routing sub-table, the business sub-table where the business request needs to be written can be determined.

[0073] It can be understood that since the target routing table contains the routing information of the first request when the first request is written to the business table, that is, the routing information corresponding to the routing key, therefore, when determining the target business sub-table according to the target routing sub-table, the specific location where the business request needs to be written can be further determined based on the obtained routing information, so as to avoid writing the business request to the non-corresponding first request, thereby improving the efficiency of querying the required route when processing the business request by avoiding the error rate.

[0074] Optionally, the step S30 may further include:

[0075] Query the routing information corresponding to the routing key from the target routing subtable;

[0076] Reading the sub-table index in the routing information;

[0077] Based on the sub-table index, the target service sub-table into which the service request needs to be written is queried from the service sub-table corresponding to the target routing sub-table.

[0078] It should be noted that the sub-table index can be an index for locating a business sub-table, and can also be accurate to a specific location in the business sub-table. Routing information may include sub-library indexes, sub-table indexes, and routing sub-table indexes. Among them, the sub-library index can be an index for locating the database to which the business request needs to be written. Since the database is usually divided into multiple independent sub-libraries in high-concurrency and big data business systems, in order to write the business request to the correct database, it is necessary to record the sub-library index in the routing information.

[0079] It can be understood that in order to quickly locate the target business sub-table, the routing information can include a sub-table index, so that after querying the routing information corresponding to the routing key from the target routing sub-table, the data sub-table to be queried can be accurately determined according to the sub-table index in the routing information, and then the target business sub-table to be queried in the data sub-table can be determined according to the sub-table index, which simplifies the query process and improves the efficiency of querying the required routes when processing business requests.

[0080] The present embodiment provides a method for querying a business sub-table for a business request. In order to route the business request to the business sub-table containing the first request after obtaining the business request, it is necessary to identify the routing key associated with the first request from the business request, so as to find the target routing sub-table containing the routing key from the set of routing sub-tables obtained after the time slice sub-table rule and the hash sub-table rule are used to query the target business sub-table to be written into the business request from the target routing sub-table, wherein the target business sub-table is a sub-table in the business sub-table obtained after the business table is sub-tabled by the time slice sub-table rule set. Since the data volume in the routing table increases much faster than that in the business table, The data volume increases at a rate of speed. Therefore, dividing the routing table and the business table through the time slice partitioning rule can ensure that the business data and the corresponding routes are on the same set of time slice partitioning tables. The logical routing partitioning table obtained after the time slice partitioning is further partitioned through the hash partitioning rule, so that each routing partitioning table contains multiple routing sub-tables to avoid the maximum capacity of each routing partitioning table exceeding the upper limit, and the total data capacity of each routing partitioning table is the same as the total data capacity of the corresponding business partitioning table. Therefore, it is avoided that the routing partitioning table needs to be processed in a short time, and the corresponding routing data needs to be frequently retrieved from the historical database when processing business requests, thereby improving the efficiency of querying the required routes when processing business requests.

[0081] For example, in order to help understand the implementation process of the business sub-table query method for business requests obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 2 , Figure 2 A brief flow chart of a method for querying a business table of a business request is provided, specifically:

[0082] Business requests mainly include non-first requests such as business query requests, business reverse processing requests, and business final status notification requests. These types of requests need to query routing information first, and then index to the corresponding sub-library and sub-table for processing. Usually, a business request for a business will arrive in a short period of time. If the sub-table is switched monthly, in most cases, the sub-table has not been switched when the subsequent related requests come. Therefore, the subsequent related request routing query will first check the sub-table calculated on the current date. If no query is found, it means that the sub-table has been switched and it is necessary to poll the remaining sub-tables.

[0083] (1) Calculate the sub-database to be queried based on the routing key;

[0084] (2) Calculate the currently used sub-table based on the current date and the sub-table slice size;

[0085] (3) Calculate the subtable number of the route based on the hash (routing key) modulo 4+1;

[0086] (4) The route subtable calculated by (2) and (3) is preferentially used to search for the route. If the route is found, it is returned. If the route is not found, the remaining subtables are searched until the route is found.

[0087] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 3 Before step S10, the business sub-table query method for the business request further includes steps S01 to S03:

[0088] Step S01, after obtaining the first request, determining the working routing sub-table used when receiving the first request, and identifying the routing key from the first request;

[0089] It should be noted that the working routing table is a routing table that records the routing path of the first request when the first request is received. Since the business will automatically determine the subsequent requests that may be required when the business starts processing, when the first request is generated, the routing key required for the subsequent business request, that is, the identification identifier, will be bound to the first request.

[0090] Step S02, based on the routing key and the working routing sub-table, determining the routing sub-table where the route required for writing the first request into the working business sub-table is located, the working business sub-table being the business sub-table corresponding to the working routing sub-table;

[0091] It is understandable that since there is no routing information guidance when the first request is written into the work business sub-table, in order for subsequent business requests to accurately find the work business sub-table, it is necessary to write the route of the first request into the routing sub-table in the work routing sub-table according to the routing key.

[0092] In the specific implementation, when the first request is written to the working routing sub-table, the route of the first request is recorded in real time, and the routing key is associated and written into a routing sub-table in the working routing sub-table to facilitate writing subsequent business requests into the business table. The corresponding routing information can be queried from the routing sub-table according to the routing key to facilitate writing the business request into the same business sub-table as the first request.

[0093] Step S03, obtaining routing information based on the routing sub-table and the work service sub-table, and writing the routing information into the routing sub-table.

[0094] It can be understood that after determining the work business sub-table that is being used when the first request is received, it is possible to determine the data sub-library to which the work business sub-table belongs, and then obtain the sub-library index of the data sub-library, and determine the sub-table index of the work business sub-table based on the work business sub-table. In order to quickly determine the target business sub-table to which the business request needs to be written based on the routing information, it is necessary to simplify the query process. Therefore, the routing information can be determined based on the sub-library index and the sub-table index.

[0095] It can be understood that since the routing information is obtained by querying from the routing subtable based on the routing key, in order to simplify the process of querying the routing information, the routing information can also be obtained in combination with the subtable index of the routing subtable, so that after obtaining the routing key, the corresponding routing information can be found according to the routing index, thereby improving the query efficiency of the routing information.

[0096] Furthermore, before step S03, the following steps may also be included:

[0097] Querying the anti-duplicate end date obtained by adding the date of receiving the first request to the preset anti-duplicate days;

[0098] Based on the slice size in the time slice sub-table rule, it is determined whether the predicted service sub-table used on the anti-duplicate end date is a switching sub-table.

[0099] It should be noted that the preset anti-duplicate days can be a time period to prevent repeated processing of the same business request. For example, a payment request is received immediately after processing an order request, and the payment request is processed in business sub-table A. The business table used in this time period may be switched to business sub-table B. Since the payment request is not recorded in business sub-table B for processing, the payment request may be processed again after business sub-table B receives it.

[0100] Optionally, step S03 may further include:

[0101] If it is determined that the predicted service sub-table is a switching sub-table, determining the synchronous service sub-table used for the anti-duplicate end date;

[0102] Determine a synchronization routing sub-table corresponding to the synchronization service sub-table;

[0103] The routing information is synchronously written into the working routing sub-table and the synchronization routing sub-table.

[0104] It should be noted that the synchronized routing sub-table may be a routing sub-table for routing information of the first request that needs to be synchronized, and the routing sub-table is a routing sub-table used for the anti-duplicate end date.

[0105] It can be understood that after the sub-table is switched on the anti-duplicate end date, the routing information of the first request is synchronously written to the working routing sub-table and the synchronous routing sub-table, which can ensure that after the sub-table is switched, although the sub-table sequence number calculated for the repeated request is inconsistent with the sub-table sequence number calculated for the first request, the routing record of the first request can be found in the routing sub-table, and finally routed to the same business table for business processing, thereby achieving the purpose of anti-duplicate.

[0106] Furthermore, step S01 may also include:

[0107] After receiving the first request, read the slice size and table partitioning mode in the time slice table partitioning rule;

[0108] A working routing sub-table to be used when receiving the first request is determined based on the slice size and the sub-table mode.

[0109] It is understandable that the business table is divided according to time slices, and the table partitioning mode and table slice size can be dynamically adjusted to achieve adaptive switching, and the table can be dynamically expanded as the request volume increases.

[0110] For example, in order to help understand the implementation process of the business sub-table query method for business requests obtained by combining this embodiment with the above-mentioned embodiment 2, please refer to Figure 4 , Figure 4 A flowchart for writing the first request routing is provided, specifically:

[0111] The first request needs to select the associated key that will be carried by subsequent requests as the routing key, calculate the sub-library and sub-table according to the sub-library routing rules and shard switching rules, write the route, and then request the corresponding sub-library for business processing.

[0112] (1) First, the request partition is calculated according to the partition routing rule;

[0113] (2) Calculate the currently used sub-table according to the sub-table mode and the set slice size;

[0114] (3) According to the number of business anti-duplicate days, calculate the current date + the date after the number of anti-duplicate days, and determine whether a table switch has occurred during this period. If no switch has occurred, there is no need to synchronously write the routing A / B table; if a switch has occurred, the business requests during this period need to synchronously write the routing A / B table;

[0115] (4) Based on the request sub-table and routing key calculated in (2), calculate the sub-table where the route is located by hashing (routing key) modulo 4+1;

[0116] (5) Write the routing information including the sub-library index, sub-table index and routing sub-table index into the corresponding sub-library sub-table.

[0117] It is understandable that by adopting the method of "synchronous double writing" of each routing table, the problem of business duplication prevention during table switching can be solved.

[0118] Specifically, taking daily switching as an example, the table is configured to be split once every X days, the number of split tables is Y, and the calculation logic of the current split table can be:

[0119] (1) The sub-meter cycle is set at one year, and starting from the next year, it is mandatory to start from sub-meter A;

[0120] (2) Calculate the current date to be the current day N, divide N by X, round up the quotient and subtract 1, then divide by Y and take the remainder;

[0121] (3) The remainder + 65 is the corresponding table.

[0122] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 Before step S01, the service sub-table query method for the service request further includes steps S1 to S5:

[0123] Step S1, obtaining the number of service requests in a preset time period, the maximum supported data volume of a single table in the routing table or the service table, and the required usage time of each single table;

[0124] Step S2, based on the number of requests and the usage duration, determining the total amount of data that needs to be stored in the routing table or the service table within the usage duration;

[0125] Step S3, determining the number of service sub-tables or routing sub-tables required within the usage time based on the total data volume and the maximum supported data volume;

[0126] Step S4, determining the slice size required for each of the service sub-table and the routing sub-table based on the time slice sub-table rule and the number of sheets;

[0127] Step S5, dividing the routing sub-table based on a preset multiple and the hash table rule, and determining the number of routing sub-tables that need to be included in each routing sub-table, wherein the preset multiple is the multiple of the data increase rate in the routing table and the data increase rate in the business table.

[0128] It should be noted that the number of business requests can be the number of requests for in-store business by the business system within a preset time. Since the routing table is strongly related to the business table, and the growth rate of data in the routing table is a multiple of the growth rate of data in the business table, determining the maximum supported data volume of each single routing sub-table in the routing table is equivalent to determining the maximum supported data volume of each single business sub-table in the business table. The maximum supported data volume is the maximum amount of data that can be stored in a single sub-table. The usage time can be how long the data needs to be saved. The preset multiple can be set by the user according to the business. The slice size can be the time interval for switching sub-tables.

[0129] It can be understood that the total amount of data that will be generated within the time period is determined based on the number of requests and the duration of use of a single table, and then the number of sub-tables required is determined based on the data volume and the maximum supported data volume of a single table. The number of sub-tables required can be flexibly determined and adjusted based on the amount of data.

[0130] It is understandable that using the same time slice table partitioning rules to partition the business table and the routing table can ensure that the business data and the corresponding routes are on the same set of time slice tables. And determine the slice size of the time required to switch the partition table, so as to switch adaptively and dynamically expand the table as the request volume increases.

[0131] It can be understood that by using the hash table rule to divide the routing table again, it can be determined that the growth rate of the data in the routing table relative to the maximum supported amount of the routing table is equal to the growth rate of the data in the business table. The routing table requires a number of routing sub-tables to reduce the total amount of data in the single-row table through the routing sub-tables, ensure the concurrent processing capability of business requests, and ensure that the total data capacity of the routing table can be equal to the total data capacity of the business table, thereby avoiding frequent switching of sub-tables due to the total data capacity of the routing table being insufficient to support the growth of data, so as to clean up the data in the routing table.

[0132] For example, in order to help understand the implementation process of the business sub-table query method for business requests obtained by combining this embodiment with the above-mentioned embodiment 3, please refer to Figure 6 , Figure 6 A schematic diagram of the overall architecture of the sharding table is provided, specifically:

[0133] First, it is necessary to determine the number of sub-tables according to the actual situation of the business system. This patent uniformly takes the A / B table as an example. The business-related table adopts the time-slice A / B table, where the business-related table is a collection of a group of business tables. The routing table adopts the strategy of time-slice A / B table + hash division n (4) sub-tables (here it is assumed that the data growth rate of the routing table is n times that of the business table). The routing A table and B table are logical concepts. The routing A table actually corresponds to the routing A1, A2, ..., An table, and the routing B table actually corresponds to the routing B1, B2, ..., Bn table. The routing A / B table switching strategy is the same as the business A / B table, and the routing sub-tables are evenly distributed using the business routing key hash.

[0134] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the business sub-table query method for the business request of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0135] This application also provides a business sub-table query device for business requests, please refer to Figure 7 , the business sub-table query device for the business request includes:

[0136] The acquisition module 10 is used to identify the routing key associated with the first request from the business request after acquiring the business request;

[0137] A first query module 20 is used to query a target routing sub-table containing the routing key from a preset routing table, wherein the preset routing table is a set of routing sub-tables obtained by partitioning the table according to the time slice partitioning rule and the hash partitioning rule;

[0138] The second query module 30 is used to query the target business sub-table where the business request needs to be written from the business sub-table corresponding to the target routing sub-table based on the target routing sub-table, wherein the business sub-table is obtained after the business table is divided according to the time slice division rule.

[0139] Optionally, the acquisition module 10 is also used to determine the working routing sub-table used when receiving the first request after obtaining the first request, and identify the routing key from the first request; based on the routing key and the working routing sub-table, determine the routing sub-table where the route required to write the first request into the working business sub-table is located, and the working business sub-table is the business sub-table corresponding to the working routing sub-table; obtain routing information based on the routing sub-table and the working business sub-table, and write the routing information into the routing sub-table.

[0140] Optionally, the service sub-table query device for the service request further includes:

[0141] The anti-duplicate processing module is used to query the anti-duplicate end date after the date of receiving the first request is added to the preset anti-duplicate days; based on the slice size in the time slice table rule, determine whether the predicted business sub-table used on the anti-duplicate end date is a switching sub-table;

[0142] The acquisition module 10 is also used to determine the synchronous business sub-table used for the anti-duplicate end date if it is determined that the predicted business sub-table is a switching sub-table; determine the synchronous routing sub-table corresponding to the synchronous business sub-table; and synchronously write the routing information into the working routing sub-table and the synchronous routing sub-table.

[0143] Optionally, the acquisition module 10 is also used to obtain the number of business requests in a preset time period, the maximum supported data volume of a single table in the routing table or the business table, and the usage time required for each of the single tables; based on the number of requests and the usage time, determine the total amount of data that needs to be stored in the routing table or the business table within the usage time; based on the total data volume and the maximum supported data volume, determine the number of business sub-tables or routing sub-tables required within the usage time; based on the time slice sub-table rule and the number of sheets, determine the required slice size of each of the business sub-table and the routing sub-table; divide the routing sub-table based on a preset multiple and the hash sub-table rule, and determine the number of routing sub-tables that need to be included in each routing sub-table, wherein the preset multiple is the multiple of the data increase rate in the routing table and the data increase rate in the business table.

[0144] Optionally, the acquisition module 10 is further used to read the slice size and the table mode in the time slice table rule after obtaining the first request; and determine the working routing table used when receiving the first request based on the slice size and the table mode.

[0145] Optionally, the second query module 30 is also used to query the routing information corresponding to the routing key from the target routing subtable; read the sub-table index in the routing information; and query the target business sub-table in which the business request needs to be written from the business sub-table corresponding to the target routing subtable based on the sub-table index.

[0146] The service sub-table query device for service requests provided by the present application adopts the service sub-table query method for service requests in the above-mentioned embodiment, which can solve the technical problem that the corresponding routing data needs to be read from the history library again when processing service requests, thereby reducing the efficiency of querying the required routing when processing service requests. Compared with the prior art, the beneficial effects of the service sub-table query device for service requests provided by the present application are the same as the beneficial effects of the service sub-table query method for service requests provided by the above-mentioned embodiment, and other technical features in the service sub-table query device for service requests are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.

[0147] The present application provides a business sub-table query device for business requests, and the business sub-table query device for business requests includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the business sub-table query method for business requests in the above-mentioned embodiment 1.

[0148] Reference below Figure 8 , which shows a schematic diagram of the structure of a service sub-table query device suitable for implementing the service request of the embodiment of the present application. The service sub-table query device for the service request in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The business sub-table query device for the business request shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0149] like Figure 8As shown, the service sub-table query device for service requests may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the service sub-table query device for service requests are also stored in the RAM 1004. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems may be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 may allow the business sub-table query device for business requests to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a business sub-table query device for business requests with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.

[0150] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0151] The business sub-table query device for business requests provided by the present application adopts the business sub-table query method for business requests in the above embodiment, which can solve the technical problem that the corresponding routing data needs to be read from the history library again when processing the business request, thereby reducing the efficiency of querying the required routing when processing the business request. Compared with the prior art, the beneficial effects of the business sub-table query device for business requests provided by the present application are the same as the beneficial effects of the business sub-table query method for business requests provided by the above embodiment, and other technical features in the business sub-table query device for business requests are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0152] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0153] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0154] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the business sub-table query method for the business request in the above-mentioned embodiment.

[0155] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0156] The computer-readable storage medium may be included in the service sub-table query device for the service request; or may exist independently without being assembled into the service sub-table query device for the service request.

[0157] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by a business sub-table query device for a business request, the business sub-table query device for the business request: after obtaining the business request, identifies the routing key associated with the first request from the business request; queries a target routing sub-table containing the routing key from a preset routing table, wherein the preset routing table is a set of routing sub-tables obtained after table partitioning by time slice table partitioning rules and hash table partitioning rules; based on the target routing sub-table, queries a target business sub-table to be written into the business request from a business sub-table corresponding to the target routing sub-table, wherein the business sub-table is obtained after the business table is partitioned by time slice table partitioning rules.

[0158] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0159] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0160] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0161] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the business sub-table query method for the above-mentioned business request, which can solve the technical problem that the corresponding routing data needs to be read from the history library again when processing the business request, thereby reducing the efficiency of querying the required route when processing the business request. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the business sub-table query method for the business request provided by the above-mentioned embodiment, which will not be repeated here.

[0162] The present application also provides a computer program product, including a computer program, which implements the steps of the business sub-table query method for business requests as described above when the computer program is executed by a processor.

[0163] The computer program product provided by the present application can solve the technical problem that the corresponding routing data needs to be read from the history library again when processing a service request, thereby reducing the efficiency of querying the required routing when processing a service request. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the service sub-table query method for the service request provided by the above embodiment, and will not be repeated here.

[0164] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for querying a business table of a business request, characterized in that: The method includes: After obtaining the service request, identifying a routing key associated with the first request from the service request; Querying a target routing subtable containing the routing key from a preset routing table, wherein the preset routing table is a set of routing subtables obtained by partitioning the table according to the time slice partitioning rule and the hash partitioning rule; Based on the target routing sub-table, a target service sub-table into which the service request needs to be written is queried from the service sub-table corresponding to the target routing sub-table, wherein the service sub-table is obtained after the service table is divided according to the time slice division rule.

2. The method according to claim 1, characterized in that After obtaining the service request, before the step of identifying the routing key associated with the first request from the service request, the method further includes: After obtaining the first request, determining the working routing sub-table used when receiving the first request, and identifying the routing key from the first request; Based on the routing key and the working routing sub-table, determining the routing sub-table where the route required for writing the first request into the working business sub-table is located, the working business sub-table being the business sub-table corresponding to the working routing sub-table; Routing information is obtained based on the routing sub-table and the work service sub-table, and the routing information is written into the routing sub-table.

3. The method according to claim 2, characterized in that The step of obtaining routing information based on the routing sub-table and the work service sub-table and writing the routing information into the routing sub-table also includes: Querying the anti-duplicate end date obtained by adding the date of receiving the first request to the preset anti-duplicate days; Based on the slice size in the time slice sub-table rule, determining whether the predicted service sub-table used on the anti-duplicate end date is a switching sub-table; The step of obtaining routing information based on the routing sub-table and the work service sub-table, and writing the routing information into the routing sub-table comprises: If it is determined that the predicted service sub-table is a switching sub-table, determining the synchronous service sub-table used for the anti-duplicate end date; Determine a synchronization routing sub-table corresponding to the synchronization service sub-table; The routing information is synchronously written into the working routing sub-table and the synchronization routing sub-table.

4. The method according to claim 2, characterized in that After obtaining the first request, determining the working routing table used when receiving the first request, and identifying the routing key from the first request also includes: Obtaining the number of service requests in a preset time period, the maximum supported data volume of a single table in the routing table or the service table, and the required usage time of each single table; Based on the number of requests and the usage duration, determining a total amount of data that needs to be stored in the routing table or the service table within the usage duration; Based on the total data volume and the maximum supported data volume, determining the number of service sub-tables or routing sub-tables required within the usage time; Determine the required slice size of each of the business sub-table and the routing sub-table based on the time slice sub-table rule and the number of sheets; The routing sub-table is divided based on a preset multiple and the hash table rule to determine the number of routing sub-tables required to be included in each routing sub-table. The preset multiple is the multiple of the data increase rate in the routing table and the data increase rate in the business table.

5. The method according to claim 2, characterized in that After the first request is obtained, the step of determining the working routing table used when receiving the first request includes: After receiving the first request, read the slice size and table partitioning mode in the time slice table partitioning rule; A working routing sub-table to be used when receiving the first request is determined based on the slice size and the sub-table mode.

6. The method according to claim 1, characterized in that The step of searching the target service sub-table that needs to write the service request from the service sub-table corresponding to the target routing sub-table based on the target routing sub-table includes: Query the routing information corresponding to the routing key from the target routing subtable; Reading the sub-table index in the routing information; Based on the sub-table index, the target service sub-table into which the service request needs to be written is queried from the service sub-table corresponding to the target routing sub-table.

7. A business sub-table query device for a business request, characterized in that: The device comprises: An acquisition module, configured to, after acquiring the service request, identify a routing key associated with the first request from the service request; A first query module, used to query a target routing sub-table containing the routing key from a preset routing table, wherein the preset routing table is a set of routing sub-tables obtained by partitioning the table according to a time slice partitioning rule and a hash partitioning rule; The second query module is used to query the target business sub-table where the business request needs to be written from the business sub-table corresponding to the target routing sub-table based on the target routing sub-table, wherein the business sub-table is obtained after the business table is divided according to the time slice division rule.

8. A business sub-table query device for business requests, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the service sub-table query method for a service request according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the service sub-table query method for a service request according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for querying a service sub-table for a service request according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Data access method and device

    CN107451202A

  • Database and table division routing method and system

    CN114817331A

  • Statistical report processing method and device

    CN116187288A

  • Registration framework for an analytics platform

    US10754838B1