Business data processing method and device

By splitting and storing numerical fields in shards, the problem of lock conflicts caused by data update hotspots in concurrent scenarios is solved, and the concurrent access performance of data updates is improved.

CN118747173AInactive Publication Date: 2024-10-08ASPIRE TECH (SHENZHEN) LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411232912.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-10-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In concurrent scenarios, data update hotspots in numerical fields cause data records to be locked, limiting other concurrent accesses and affecting concurrency performance.

Method used

By splitting numerical fields, multiple numerical fields are formed, and sharded storage is performed according to business attribute fields to reduce lock conflicts. Combined with automatic adjustment capabilities, it optimizes the concurrent access performance of data updates.

Benefits of technology

On the premise of ensuring data accuracy, the number of exclusive resources is increased, lock conflicts are reduced, and the concurrent access performance of data updates is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747173A_ABST
    Figure CN118747173A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and provides a business data processing method and device.The method comprises the steps that at least one piece of business data is obtained, and the business data comprises a numerical value field and a business attribute field; splitting the numerical value field into a plurality of sub-numerical value fields according to a preset number and in a preset distribution mode; and forming a plurality of sub-service data according to the service attribute field and the plurality of sub-value fields, and performing fragmentation storage on the plurality of sub-service data according to a preset storage mode. According to the method, the numerical field needing high-frequency updating in the numerical business data is split and adjusted, one data record is split into multiple pieces according to the numerical field, that is, one exclusive resource is split into multiple exclusive resources, the number of the exclusive resources is increased, lock conflicts can be reduced in a concurrent scene, and the automatic adjustment capability is combined, so that the user experience is improved. And the concurrent access performance of data updating is further improved on the premise of ensuring the data accuracy and not changing the original service rule.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a business data processing method and device. Background Art

[0002] Currently, for the storage and access of large quantities of data, in order to improve the performance efficiency of concurrent access to data, the main methods that can be used are database sharding, table sharding, or data striping, so as to split structured data records horizontally or vertically and store them in different places; or use master-slave databases and other methods to achieve read-write separation, thereby improving concurrent access capabilities and reducing IO read-write pressure.

[0003] For the design of large-scale data storage solutions, existing technical solutions such as database sharding, table sharding, data striping, and read-write separation have planned the distribution of data, solved the problem of excessive data concentration, optimized data storage and access, and improved concurrent access performance. These solutions redistribute the entire data record and perform high concurrent access to different records, which can significantly improve performance.

[0004] However, for data update scenarios containing numeric fields (such as account balances), in concurrent scenarios, if these data records themselves have write (numeric update) hotspots, in order to ensure data accuracy, the data records need to be locked and unlocked when the data is updated and written. When the data records are locked and updated, other concurrent accesses will be restricted, thereby affecting concurrent performance. Summary of the invention

[0005] Based on this, an object of the present invention is to provide a business data processing method and device to solve at least one technical problem in the background technology.

[0006] A business data processing method according to an embodiment of the present invention is applied to store and process business data containing a numeric field, and the method comprises the following steps: Acquire at least one piece of business data, wherein the business data includes a numerical field and a business attribute field; Splitting the numerical field into a plurality of sub-numerical fields according to a preset number of parts and in a preset distribution method; A plurality of sub-business data are formed according to the business attribute field and the plurality of sub-value fields, and the plurality of sub-business data are stored in segments according to a preset storage method.

[0007] In addition, a service data processing method according to the above embodiment of the present invention may also have the following additional technical features: Furthermore, before the step of splitting the numerical field into a plurality of sub-numerical fields according to a preset number and in a preset distribution manner, the method further includes: The preset number of copies is determined based on the value of the numerical field, the preset maximum number of split copies, and the numerical merging threshold. Furthermore, according to the value of the numerical field, the preset maximum number of splits and the numerical merging threshold, the step of determining the preset number of shares includes: Calculate the ratio of the value of the numerical field to the numerical merging threshold, and round the calculated ratio to obtain a rounding ratio, wherein the rounding ratio is ≥ 1. If the calculated ratio is less than 1, the rounding ratio is calculated as 1; The rounding ratio is compared with the maximum number of splits, and the smaller value is taken as the preset number of splits. Furthermore, it also includes: When the numerical field is updated, the value of at least one sub-numerical field of the sub-service data is selected for updating according to a preset update rule. Furthermore, the step of selecting the value of at least one sub-value field of the sub-service data for updating according to a preset update rule includes: When the value of the numerical field is increased or updated, the value of the sub-numerical field of the sub-business data that is currently unlocked and has the smallest sub-numerical field value is selected to increase or update the corresponding value; When the numerical value field is updated to decrease in value, the value of the sub-numerical field of the sub-business data that is currently unlocked and has the largest sub-numerical field value is selected to perform a corresponding numerical decrease update. Furthermore, after the step of selecting the value of the sub-numeric field of the sub-business data that is currently unlocked and has the largest sub-numeric field value to perform a corresponding numeric value reduction update, the step further includes: Determine whether the value of the sub-numeric field of the updated sub-business data is less than the numeric merging threshold; If so, at least one target sub-business data is selected from other sub-business data according to a preset merging rule, and the updated sub-business data is merged with the target sub-business data. Furthermore, the step of merging the updated sub-service data with the target sub-service data includes: Merging the updated sub-service data and the value of the sub-value field of the target sub-service data; The combined value is used as the value of the new sub-value field of the target sub-business data for updating, and the updated sub-business data is deleted.

[0008] Furthermore, it also includes: When accessing the service data, the values ​​of the sub-numeric fields of each of the sub-service data are merged, and the merged value is used as the current value of the numeric field of the service data; At least the current value of the numerical field of the business data is fed back as the result of this access.

[0009] Furthermore, the step of storing the plurality of sub-business data in segments according to a preset storage method includes: The multiple sub-business data are stored in fragments in the form of separate tables, separate libraries, or multiple records in a table. A business data processing device according to an embodiment of the present invention is used to store and process business data containing a numerical field, and the device includes: A data acquisition module, used to acquire at least one piece of business data, wherein the business data includes a numerical field and a business attribute field; A value splitting module, used for splitting the value field into multiple sub-value fields according to a preset number of parts and in a preset distribution method; The data storage module is used to form multiple sub-business data according to the business attribute field and the multiple sub-value fields, and to store the multiple sub-business data in segments according to a preset storage method.

[0010] The present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned business data processing method is implemented.

[0011] The present invention also proposes a business data processing device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the business data processing method as described above when executing the program.

[0012] Compared with the existing technology: by splitting and adjusting the numerical fields that need to be updated frequently in numerical business data, one data record is split into multiple records according to the numerical field, that is, one exclusive resource is split into multiple exclusive resources, which increases the number of exclusive resources and reduces lock conflicts in concurrent scenarios. Combined with the automatic adjustment capability, the concurrent access performance of data updates can be further improved while ensuring data accuracy and not changing the original business rules. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 It is a schematic diagram of the account balance table in the prior art; Figure 2 is a flow chart of a business data processing method in a first embodiment of the present invention; Figure 3 A schematic diagram of an account balance split record provided in an embodiment of the present invention; Figure 4 A schematic diagram of a business system architecture provided in an embodiment of the present invention; Figure 5 A schematic diagram of the structure of a service data processing device in a third embodiment of the present invention; Figure 6 FIG. 4 is a schematic diagram of the structure of a business data processing device in a fourth embodiment of the present invention.

[0013] The following specific implementations will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0014] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0015] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0016] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0017] In order to improve concurrent access capabilities and reduce IO read and write pressure, traditional methods such as database sharding, table sharding, data striping, or data read and write separation are generally used to plan data distribution, which solves the problem of excessive data concentration, optimizes data storage and access, and improves concurrent access performance. Among them: Sub-database: When the database is too large, you can use sub-databases according to business dimensions to reduce the size of a single database, such as product databases, order databases, etc. Table splitting: If the amount of data in the table is large and affects the access performance of the library table, you can split the table, including horizontal or vertical splitting. Horizontal splitting can generally be done by ID, time, etc., or by data range; vertical splitting is to divide a large table by column according to the relevance and usage association of each column (field), which can be divided into a main table and multiple sub-tables, etc.; Data striping: Distribute data to each node, store it separately and redundantly, which is a common technical method used in distributed database systems, disk arrays, etc. Data read-write separation: If the master-slave database mode is adopted, the master database provides read-write capabilities, and the slave database provides read-only capabilities. The slave database can share the read pressure of the master database.

[0018] The above-mentioned methods such as database sharding, table sharding, data striping, and data read-write separation are specifically for distribution planning of the entire data record to achieve performance improvements in data access, thereby achieving high concurrent access. However, for data update scenarios containing numerical fields (such as account balances), in concurrent scenarios, if these data records themselves have write (numerical update) hotspots, in order to ensure data accuracy, the data records need to be locked and unlocked when the data is updated and written. When the data records are locked and updated, other concurrent access will be restricted, thereby affecting concurrent performance. For example, Figure 1 As shown, a simplified account balance data table is used as an example (other sub-databases, data striping, etc. are similar and will not be explained one by one): Figure 1 In the database, the account balance data is divided into three sub-tables (Account Balance Table A, Account Balance Table B, Account Balance Table C). The simplified account balance table contains two fields: account ID and balance. The balance data of accounts 1 to n are recorded in Account Balance Table A, the balance data of accounts n+1 to n+m are recorded in Account Balance Table B, and the rest are recorded in Account Balance Table C. Its feature is that the balance data records are horizontally split into multiple tables by account ID for storage, thereby reducing the amount of data in a single table and improving database performance and concurrent access capabilities. However, when updating the balance of an account, it is necessary to lock the access to the balance of this account. Since the balance of an account is a hot data with high frequency updates, when other concurrent accesses occur, locking will significantly affect the concurrent performance.

[0019] To this end, in order to solve the above problems, an embodiment of the present invention proposes a business data processing method, which mainly automatically splits and adjusts the numerical fields that need to be updated frequently in numerical data records, and splits one data record into multiple records according to the numerical field, that is, splits one exclusive resource into multiple exclusive resources, thereby increasing the number of exclusive resources and reducing lock conflicts in concurrent scenarios. Combined with the automatic adjustment capability, the concurrent access performance of data updates can be further improved while ensuring data accuracy and not changing the original business rules.

[0020] Before elaborating on the business data processing method in the embodiment of the present invention, it should be noted in advance that the best adaptation scenario of the business data processing method in the embodiment of the present invention is business data with one and only one numerical field that needs to be frequently updated, while other business attribute fields are rarely updated. For example, an account balance table generally includes: account ID, balance, balance unit name, balance status, remarks, etc. The balance is a frequently updated numerical field, and the account ID, balance unit name, balance status, and remarks information belong to the business attribute field. The account ID is the primary key and cannot be updated, and the balance unit name, balance status, and remarks information are rarely updated. It should be noted that the above account balance scenario is only one type of scenario to which the present invention is applicable. Other business data similar to account balances that have one and only one numerical field that needs to be frequently updated can be applied, for example, it can also be applied to scenarios such as commodity inventory deductions and billing cumulative deductions.

[0021] In order to more clearly illustrate a business data processing method in an embodiment of the present invention, a specific embodiment will be given below.

[0022] Embodiment 1 See also Figure 2 , shown is a business data processing method in the first embodiment of the present invention, which can be specifically implemented by software and / or hardware, and is applied to store and process business data containing numerical fields. The method specifically includes steps S01 to S03.

[0023] Step S01, obtaining at least one piece of business data, wherein the business data includes a numerical field and a business attribute field.

[0024] Specifically, the business data involved in this step may be business data having one and only one numerical field that needs to be frequently updated. The numerical field is the numerical field that needs to be frequently updated, and the business attribute field is other descriptive attribute fields of the business data. For example, when the business data is the above account balance table, the business attribute field includes but is not limited to the account ID, balance unit name, balance status, remarks, etc., and the numerical field is the balance, and the value of the numerical field is the balance value.

[0025] Step S02: split the numerical field into multiple sub-numerical fields according to a preset number and in a preset distribution method.

[0026] Specifically, the preset number of copies can be pre-set, self-adjusted according to the amount of data, or automatically calculated according to other set parameters, and the preset distribution method includes but is not limited to average distribution, increasing distribution, decreasing distribution, or random distribution, etc. Therefore, in some preferred embodiments, the numerical field can be divided into N equal parts, that is, evenly divided into N parts, N is the preset number of copies. For example, in the account balance application scenario, a balance of 200 can be divided into 10 equal parts, and the balance of each part is 20.

[0027] Step S03, forming multiple sub-business data according to the business attribute field and the multiple sub-value fields, and storing the multiple sub-business data in segments according to a preset storage method.

[0028] In a specific implementation, the step of storing the plurality of sub-business data in segments according to a preset storage method may specifically include: The multiple sub-business data are stored in fragments in the form of separate tables, separate libraries, or multiple records in a table.

[0029] Among them, sub-tables and sub-libraries are both traditional shard storage methods that are often used. Sub-tables and sub-libraries have been explained above and will not be repeated here. Multiple records in a table refer to multiple records with the same ID in the same form. In order to ensure the uniqueness of the above multiple records, it is necessary to add a shard dimension as one of the primary keys on the basis of the original business uniqueness field. For example, a shard sequence number field is added, and the original ID + shard sequence number is used as a joint primary key to achieve the simultaneous recording of the balance, cumulative consumption amount and other records of the same account in the table, but the shard sequence numbers to which they belong are different, as shown in Table 1 below. In specific storage, redundant storage can be performed, but the business attribute field data stored in the first shard shall prevail, and the business attribute field data stored in other shards is only for the convenience of query reference. It is also possible to include the business attribute field data only in the first shard storage, and other shards do not need to store the business attribute field data, and only store the primary key and the numerical field data.

[0030] Specifically, for storage in a sub-table or sub-library manner, the business attribute fields of each sub-business data are the same, for example, they are the same as the first sub-business data or the same as the original business data, and the sub-table or sub-library name where the sub-business data is located can be distinguished by adding a serial number to the original table name or library name, for example Figure 3As shown, taking a simplified account balance table as an example, the simplified account balance table has fields account ID (primary key) and balance. Suppose there is account 1 with a balance of 200 yuan. The number of splits is configured as 10. Then, it can be split into 10 records of account 1 with a balance of 20 yuan. The names of the split tables are account balance table 1, account balance table 2, ..., account balance table 10. These 10 records can exist in the form of sub-tables, sub-libraries, or records within a table. If sub-tables or sub-libraries are used, the setting of the primary key can remain consistent with the original table, that is, the account ID of each record is consistent and distributed in each sub-table or sub-library. The name of the sub-table or sub-library where the record is located is distinguished by a serial number; if there are multiple records of the same account in the table, it is necessary to add a shard serial number field, together with the original table primary key field, as a joint primary key to distinguish the uniqueness of the business data record. Among them, Figure 3 The diagram takes the sub-table as an example. It can be seen that all 10 records use account 1, but the sub-table names are distinguished by numerical serial numbers.

[0031] The data form of the library table records with multiple records in the table is shown in Table 1 below: The table structure of the new account balance table needs to add a shard sequence number field, in which the account ID + shard sequence number field is used as the joint primary key.

[0032] Table 1:

[0033] In summary, the business data processing method in the above-mentioned embodiment of the present invention splits and adjusts the numerical fields that need to be updated frequently in the numerical business data, splits a data record into multiple records according to the numerical fields, that is, splits an exclusive resource into multiple exclusive resources, increases the number of exclusive resources, and reduces lock conflicts in concurrent scenarios. Combined with the automatic adjustment capability, the concurrent access performance of data updates is further improved under the premise of ensuring data accuracy and not changing the original business rules. For example, for the application scenario of account balance, when the balance of the same account is updated concurrently, the existing conventional solution can only lock and update one exclusive resource (the balance record of this account), and when the solution in the embodiment of the present invention is adopted, for a certain account, one exclusive resource is split into N exclusive resources, that is, there are N exclusive resources available for locking, thereby reducing lock conflicts, and theoretically the performance of data updates can be improved by N times at most. Embodiment 2 The second embodiment of the present invention also provides a service data processing method, which can be implemented by software and / or hardware. The difference between the service data processing method in this embodiment and the service data processing method in the first embodiment is that: Before the step of splitting the numerical field into a plurality of sub-numerical fields according to a preset number of parts and in a preset distribution method, the step further includes: The preset number of copies is determined based on the value of the numerical field, the preset maximum number of split copies, and the numerical merging threshold.

[0034] Specifically, according to the value of the numerical field, the preset maximum number of splits, and the numerical merging threshold, the step of determining the preset number of shares specifically includes: Calculate the ratio of the value of the numerical field to the numerical merging threshold, and round the calculated ratio to obtain a rounding ratio, wherein the rounding ratio is ≥ 1. If the calculated ratio is less than 1, the rounding ratio is calculated as 1; The rounding ratio is compared with the maximum number of splits, and the smaller value is taken as the preset number of splits.

[0035] That is, before splitting a numeric field, the optimal preset number of parts, i.e. the number of splits, will be calculated based on the value of the numeric field, the preset maximum number of splits, and the numeric merging threshold. The specific rule is as follows: Number of splits = minimum value (round (numeric field value / numeric merging threshold), maximum number of splits).

[0036] For example: If the value of a numeric field of certain business data is 200, the maximum number of splits is 6, and the value merging threshold is 10, then the number of splits = 6; if the value of a numeric field of certain business data is 200, the maximum number of splits is 25, and the value merging threshold is 10, then the number of splits = 20.

[0037] This splitting scheme, through flexible configuration, can make the business data shard storage more flexible and convenient to adjust according to the actual situation of the production application environment. In addition to the maximum number of splits as the upper limit of the shard storage as a guarantee, the number of shard storage can also be dynamically determined according to the value of the numerical field. The larger the value of the numerical field, the more splits there are, which is equivalent to more exclusive resources split out, and the smaller the lock conflicts generated in concurrent scenarios. However, the maximum number of splits should not exceed the limit to avoid excessive resource usage caused by too much shard storage or too much shard storage increasing the difficulty of management and maintenance.

[0038] In some preferred embodiments, the business data processing method further includes: When the numerical field is updated, the value of at least one sub-numerical field of the sub-service data is selected for updating according to a preset update rule.

[0039] As a preferred implementation, specifically, the step of selecting the value of at least one sub-value field of the sub-service data to update according to a preset update rule includes: When the value of the numerical field is increased or updated, the value of the sub-numerical field of the sub-business data that is currently unlocked and has the smallest sub-numerical field value is selected to increase or update the corresponding value; When the numerical field is updated with a reduced value, the value of the sub-numerical field of the sub-business data that is currently unlocked and has the largest sub-numerical field value is selected for a corresponding reduced value update. In specific implementation, before updating the corresponding numerical field, the corresponding sub-business data needs to be locked first, and unlocked after the update to ensure the accuracy of the data.

[0040] That is, when it is necessary to update a data record, if the value of a numerical field increases, the split record that is currently unlocked (indicating no other concurrent access) and has a smaller value of the numerical field is preferentially selected for locking and updating; if the value of a numerical field decreases, the split record that is currently unlocked and has a larger value of the numerical field is preferentially selected for locking and updating, so that the data of each sub-business can be more balanced before and after the update. Of course, the priority selection of the split record with the largest or smallest numerical field is only considered from the perspective of relatively balanced updating of the numerical field. Optionally, a random method can also be used, which does not affect the key implementation of the proposal of this application.

[0041] In addition, after the step of selecting the value of the sub-numeric field of the sub-business data that is currently unlocked and has the largest sub-numeric field value to perform a corresponding value reduction update, the method further includes: Determine whether the value of the sub-numeric field of the updated sub-business data is less than the numeric merging threshold; If so, at least one target sub-business data is selected from other sub-business data according to a preset merging rule, and the updated sub-business data is merged with the target sub-business data.

[0042] That is, if the reduced value is less than the value merge threshold, the data merge is automatically triggered, specifically, it is merged into other sub-business data, wherein the preset merge rule preferably gives priority to merging the split records with smaller values ​​of the numerical field, so that the merged sub-business data are more balanced; if it is an update of other business attribute fields of non-numeric fields, the field values ​​stored in all shards are locked and updated synchronously, or the field values ​​stored in the first shard are locked and updated synchronously (depending on the optional shard storage scheme of other business attribute fields of non-numeric fields, it can be redundantly stored in each shard storage, or it can be stored only in the first shard storage, and the other business attribute fields of non-numeric fields are based on the data stored in the first shard. It will not be repeated later).

[0043] Specifically, the step of merging the updated sub-service data with the target sub-service data includes: Merging the updated sub-service data and the value of the sub-value field of the target sub-service data; The combined value is used as the value of the new sub-value field of the target sub-business data for updating, and the updated sub-business data is deleted.

[0044] When merging, first merge the values ​​of the two sub-numeric fields, and then update the merged value to the new value of the sub-numeric field of the sub-business data to be merged. For example, suppose the balance of account 1 in account balance table 1 is 5. According to the rules, the balance of account 1 in account balance table 1 needs to be merged into account balance table 2. At this time, the balance of account 1 in account balance table 2 is 20. After the merger, the balance of account 1 in account balance table 2 is 25, and the sub-business data corresponding to account 1 in account balance table 1 is deleted.

[0045] As an optional implementation, an automatic adjustment mechanism may also be set, specifically, to check the records of each sub-table regularly (configurable time, such as intervals of 1 hour, 1 day, etc.), and to automatically re-split or re-merge the records of each sub-table according to logical judgment and adjustment processing, that is, to automatically re-split and re-allocate the numerical fields regularly, or to automatically re-merge the records of each sub-table regularly. The specific splitting rules and merging rules are the same as those described above and will not be repeated here.

[0046] Furthermore, in some optional embodiments, the method further includes: When accessing the service data, the values ​​of the sub-numeric fields of each of the sub-service data are merged, and the merged value is used as the current value of the numeric field of the service data; At least the current value of the numerical field of the business data is fed back as the result of this access.

[0047] That is, when it is necessary to access business data (for example, to check the latest balance), the values ​​of the sub-numeric fields of each sub-business data will first be merged, for example, summed up to calculate the current balance, and then the current balance or together with the business attribute field will be used as the balance check result.

[0048] It should be noted that the above embodiments and their features can be combined arbitrarily without conflict, and the new technical solutions obtained by the combination still fall within the scope of protection of the present invention. In addition, the solutions in the embodiments of the present invention can be specifically applied to business scenarios such as account balance deduction, commodity inventory deduction, billing accumulation deduction, etc., and have application value in scenarios where there is business concentration or hot data. Specific example scenarios are as follows: In the billing and accounting processing of Internet products in B2B, when an Internet enterprise uses a certain capability product, the billing platform needs to perform enterprise billing and account deductions based on the number of times the capability product is used (call volume). Since the business scale of each Internet enterprise varies greatly, the number of times the capability product is used also varies greatly in magnitude. Most of the business volume may be concentrated in the top 20 enterprises. For such enterprises, billing and account updates for the capability products used will have hot data access issues. The following takes the account balance table of an enterprise account as an example. Each time an enterprise uses a certain capability product, a usage bill will be generated and sent to the billing platform. After the billing platform charges the bill at a batch price, it also needs to deduct the balance from the enterprise's account. Therefore, a large number of bills will be generated and deducted from the enterprise account. When a concurrent processing solution is adopted, the update of the account balance table requires locking the records of the enterprise account. Since a large number of bills are concentrated in the top 20 enterprises, the possibility of lock conflicts caused by locking the records of the enterprise account is very high, so that high concurrency cannot significantly improve the processing performance. After adopting the technical solution of the embodiment of the present invention, the account balance table can be split into multiple split records according to the balance (i.e., the specified numerical field). Then, for the same enterprise, when updating the balance, originally only one enterprise balance record can be locked and deducted. Now, the enterprise account balance record is split into N split records according to the balance field, and these N split records can be locked and deducted at the same time, which greatly reduces the possibility of lock conflicts and improves concurrency performance.

[0049] As an example, the business data processing method in the embodiment of the present invention can be specifically applied to Figure 4 In the business system architecture, Figure 4 The business system architecture shown includes a data access proxy module, a database, a parameter configuration module, and an automatic adjustment module, wherein: The data access proxy module includes: Operation instruction parsing submodule: responsible for accessing the data access request of the upstream business logic, identifying instructions such as adding, deleting, modifying, querying, and other data operations, and forwarding them to the corresponding data adding, data updating, data deleting, data querying, and other data operation submodules for processing; Data adding submodule: When data records need to be added, the data records to be added are split according to the value of the numerical field, the maximum number of splits, and the numerical merging threshold, and then added to the corresponding sub-table; Data update submodule: When data records need to be updated, if the value of a numeric field increases, the split records with smaller values ​​in the numeric field are preferentially selected for locking and updating; if the value of a numeric field decreases, the split records with larger values ​​in the numeric field are preferentially selected for locking and updating. Moreover, if the value after the decrease is less than the value merging threshold, data merging can be automatically triggered. For the data merging logic, please refer to the aforementioned "Key Logic of Data Merging"; if other fields of non-numeric fields are updated, the field values ​​of all sub-tables are locked and synchronously updated; Data deletion submodule: when data records need to be deleted, the split records under each sub-table are deleted synchronously; Data query submodule: When you need to query data records, you need to query the split records of each sub-table, and after statistics based on the numerical field, the other fields are based on the first sub-table, and the data query results are returned; Other data operation submodules: Agent for processing database operation instructions other than adding, deleting, modifying, and querying.

[0050] Parameter configuration module: used to configure parameters related to business data processing.

[0051] Automatic adjustment module: The automatic adjustment module is a timed task that checks the records of each sub-table regularly (configurable time, such as 1 hour, 1 day, etc.), and automatically re-splits or merges the records of each sub-table for logical judgment and adjustment.

[0052] Embodiment 3 Another aspect of the present invention provides a business data processing device, please refer to Figure 5 , shown is a business data processing device in a third embodiment of the present invention, which is applied to store and process business data containing numerical fields, and the business data processing device includes: The data acquisition module 11 is used to acquire at least one piece of business data, wherein the business data includes a numerical field and a business attribute field; A value splitting module 12, for splitting the value field into a plurality of sub-value fields according to a preset number of parts and in a preset distribution method; The data storage module 13 is used to form multiple sub-business data according to the business attribute field and the multiple sub-value fields, and to store the multiple sub-business data in segments according to a preset storage method.

[0053] Furthermore, in some optional embodiments, the service data processing device further includes: The split allocation module is used to determine the preset number of shares based on the value of the numerical field, the preset maximum number of split shares, and the numerical merging threshold.

[0054] Furthermore, in some optional embodiments, the split allocation module is also used to calculate the ratio of the value of the numerical field to the numerical merging threshold, and round the calculated ratio to obtain a rounding ratio, wherein the rounding ratio is ≥ 1. If the calculated ratio is less than 1, the rounding ratio is calculated as 1; the rounding ratio is compared with the maximum number of splits, and the smaller value is taken as the preset number.

[0055] Furthermore, in some optional embodiments, the service data processing device further includes: The data updating module is used to select and update the value of at least one sub-numeric field of the sub-business data according to a preset updating rule when updating the numeric field.

[0056] Furthermore, in some optional embodiments, the data update module is also used to select the value of the sub-numeric field of the sub-business data that is currently unlocked and has the smallest sub-numeric field value for a corresponding numerical increase update when the numerical field is updated with a numerical increase; and to select the value of the sub-numeric field of the sub-business data that is currently unlocked and has the largest sub-numeric field value for a corresponding numerical decrease when the numerical field is updated with a numerical decrease.

[0057] Furthermore, in some optional embodiments, the service data processing device further includes: The data merging module is used to determine whether the value of the sub-numeric field of the updated sub-business data is less than the numeric merging threshold; if so, at least one target sub-business data is selected from other sub-business data according to the preset merging rules, and the updated sub-business data is merged with the target sub-business data.

[0058] Furthermore, in some optional embodiments, the data merging module is also used to merge the values ​​of the sub-numeric fields of the updated sub-business data and the target sub-business data; update the merged value as the value of the new sub-numeric field of the target sub-business data, and delete the updated sub-business data.

[0059] Furthermore, in some optional embodiments, the service data processing device further includes: The data access module is used to merge the values ​​of the sub-numeric fields of each sub-business data when accessing the business data, and use the merged value as the current value of the numeric field of the business data; at least use the current value of the numeric field of the business data as feedback as the result of this access. The functions or operation steps implemented when the above modules and units are executed are generally the same as those in the above method embodiments, and will not be repeated here.

[0060] Embodiment 4 Another aspect of the present invention also provides a business data processing device, see Figure 6 , shown is a business data processing device in the fourth embodiment of the present invention, including a memory 20, a processor 10, and a computer program 30 stored in the memory and executable on the processor, and when the processor 10 executes the computer program 30, the business data processing method as described above is implemented.

[0061] Among them, the business data processing device can specifically be a cloud server or an internal server of an enterprise, etc., and the processor 10 in some embodiments can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip, which is used to run the program code stored in the memory 20 or process data, such as executing access restriction programs, etc.

[0062] The memory 20 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 20 may be an internal storage unit of a business data processing device, such as a hard disk of the business data processing device. In other embodiments, the memory 20 may also be an external storage device of the business data processing device, such as a plug-in hard disk equipped on the business data processing device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Further, the memory 20 may also include both an internal storage unit and an external storage device of the business data processing device. The memory 20 may be used not only to store application software and various types of data installed in the business data processing device, but also to temporarily store data that has been output or is to be output.

[0063] It should be pointed out that Figure 6 The structure shown does not constitute a limitation on the business data processing device. In other embodiments, the business data processing device may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0064] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the business data processing method as described above is implemented.

[0065] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0066] More specific examples (a non-exhaustive list) of computer-readable storage media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0067] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0068] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0069] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A business data processing method, characterized in that: Applicable to storing and processing business data containing numerical fields, the method comprises the following steps: Acquire at least one piece of business data, wherein the business data includes a numerical field and a business attribute field; Splitting the numerical field into a plurality of sub-numerical fields according to a preset number of parts and in a preset distribution method; A plurality of sub-business data are formed according to the business attribute field and the plurality of sub-value fields, and the plurality of sub-business data are stored in segments according to a preset storage method.

2. The business data processing method according to claim 1, characterized in that: Before the step of splitting the numerical field into a plurality of sub-numerical fields according to a preset number of parts and in a preset distribution method, the step further includes: The preset number of copies is determined based on the value of the numerical field, the preset maximum number of split copies, and the numerical merging threshold.

3. The business data processing method according to claim 2, characterized in that: The step of determining the preset number of copies according to the value of the numerical field, the preset maximum number of copies, and the numerical merging threshold comprises: Calculate the ratio of the value of the numerical field to the numerical merging threshold, and round the calculated ratio to obtain a rounding ratio, wherein the rounding ratio is ≥ 1. If the calculated ratio is less than 1, the rounding ratio is calculated as 1; The rounding ratio is compared with the maximum number of splits, and the smaller value is taken as the preset number of splits.

4. The business data processing method according to any one of claims 1 to 3, characterized in that: Also includes: When the numerical field is updated, the value of at least one sub-numerical field of the sub-service data is selected for updating according to a preset update rule.

5. The business data processing method according to claim 4, characterized in that: The step of selecting the value of at least one sub-value field of the sub-service data for updating according to a preset update rule comprises: When the value of the numerical field is increased or updated, the value of the sub-numerical field of the sub-business data that is currently unlocked and has the smallest sub-numerical field value is selected to increase or update the corresponding value; When the numerical value field is updated to decrease in value, the value of the sub-numerical field of the sub-business data that is currently unlocked and has the largest sub-numerical field value is selected to perform a corresponding numerical decrease update.

6. The business data processing method according to claim 5, characterized in that: After the step of selecting the value of the sub-numeric field of the sub-business data that is currently unlocked and has the largest sub-numeric field value to perform a corresponding value reduction update, the method further includes: Determine whether the value of the sub-numeric field of the updated sub-business data is less than the numeric merging threshold; If so, at least one target sub-business data is selected from other sub-business data according to a preset merging rule, and the updated sub-business data is merged with the target sub-business data.

7. The business data processing method according to claim 6, characterized in that: The step of merging the updated sub-service data with the target sub-service data comprises: Merging the updated sub-service data and the value of the sub-value field of the target sub-service data; The combined value is used as the value of the new sub-value field of the target sub-business data for updating, and the updated sub-business data is deleted.

8. The business data processing method according to claim 7, characterized in that: Also includes: When accessing the service data, the values ​​of the sub-numeric fields of each of the sub-service data are merged, and the merged value is used as the current value of the numeric field of the service data; At least the current value of the numerical field of the business data is fed back as the result of this access.

9. The business data processing method according to claim 1, characterized in that: The step of storing the plurality of sub-business data in slices according to a preset storage method comprises: The multiple sub-business data are stored in fragments in the form of separate tables, separate libraries, or multiple records in a table.

10. A business data processing device, characterized in that: Applicable to storing and processing business data containing numerical fields, the device comprises: A data acquisition module, used to acquire at least one piece of business data, wherein the business data includes a numerical field and a business attribute field; A value splitting module, used for splitting the value field into multiple sub-value fields according to a preset number of parts and in a preset distribution method; The data storage module is used to form multiple sub-business data according to the business attribute field and the multiple sub-value fields, and to store the multiple sub-business data in segments according to a preset storage method.

Citation Information

Patent Citations

  • Value update method and device and server

    CN108268490A

  • Method and device for creating data pre-partition storage periodic table, equipment and storage medium

    CN109657009A

  • Balance updating method and device, computer storage medium and electronic device

    CN109753512A

  • Data storage method, electronic equipment and computer readable storage medium

    CN112328592A

  • Data request method and device, terminal equipment and storage medium

    CN114428779A