CN-121998637-A - Account book processing method, device, equipment, medium and program product
Abstract
The application provides a ledger processing method, a device, equipment, a medium and a program product, which are applied to the technical field of the Internet of things, wherein the method comprises the steps that a server acquires the number of users associated with a target group account and acquires the identification parameters of target users associated with a service request under the condition of receiving the service request; and executing the operation corresponding to the service request on the target sub-ledger fragments, wherein the server can operate different fragments included in the target ledger at the same time. In the method of the embodiment of the application, the server operates the target sub-ledger fragments under the condition of receiving the service request, and in the process, if the server receives the concurrent service requests aiming at other fragments except the target sub-ledger fragments, the concurrent service requests are processed in parallel, so that the efficiency of ledger processing is improved.
Inventors
- SHI XUAN
- CHEN GUO
- ZHANG CHUN
- LI CHAO
- ZHOU QINGDA
Assignees
- 中移动信息技术有限公司
- 中国移动通信集团有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260212
Claims (10)
- 1. A ledger processing method applied to a server, the method comprising: Under the condition that a service request is received, acquiring the number of users associated with a target group account and acquiring identification parameters of the target users associated with the service request, wherein the target group account is associated with a target account book, and the service request is used for requesting to operate the account balance of the target users in the target account book; Determining target sub-ledger fragments from the target ledger based on the identification parameters of the target users when the number of users is larger than a preset number, wherein the target sub-ledger fragments are partial ledger fragments in the target ledger; and executing the operation corresponding to the service request on the target sub-ledger fragments, wherein the server can operate different fragments included in the target ledger at the same time.
- 2. The method of claim 1, wherein determining a target sub-ledger fragment from the target ledger based on the identification parameters of the target user comprises: calculating a target hash value corresponding to the identification parameter of the target user; Determining a sub-ledger fragment corresponding to the target hash value as the target sub-ledger fragment when the target ledger comprises the sub-ledger fragment corresponding to the target hash value; And if the target ledger does not comprise the sub-ledger fragments corresponding to the target hash value, creating the target sub-ledger fragments in the target ledger according to the target hash value.
- 3. The method of claim 2, wherein the target ledger includes a number of sub-ledger fragments associated with a number of users associated with the target group account, wherein the greater the value of the number of users associated with the target group account, the lower the speed-up of the sub-ledger fragments of the target ledger.
- 4. The method according to claim 1, wherein, in the case where the operation corresponding to the service request is to update the account balance of the target user, the performing the operation corresponding to the service request on the target sub-ledger slice includes: Locking the target sub-ledger fragments; And under the condition that the target sub-account book fragments are successfully locked, updating account balances of the target users in the target sub-account book fragments.
- 5. The method according to any one of claims 1 to 4, wherein after obtaining the number of users associated with the target group account and obtaining the identification parameter of the target user associated with the service request, the method further comprises: and executing the operation corresponding to the service request on the target account book under the condition that the number of users is smaller than or equal to the preset number.
- 6. The method according to any one of claims 1 to 4, wherein, in a case where the operation corresponding to the service request is a query for an account balance of the target user, the performing the operation corresponding to the service request on the target sub-ledger partition includes: Obtaining the total account balance of the target account book after the last account balance update, and obtaining first fee deduction information and second fee deduction information, wherein the first fee deduction information comprises fee deduction information generated by the target sub-account book after the last account balance update of the target account book; the second deduction information comprises deduction information generated by other sub-account book fragments except the target sub-account book fragment in the target account book after the last account balance update of the target account book; and virtually abutting the balance of the general ledger with the first fee deduction information and the second fee deduction information to obtain the virtually abutted balance of the target ledger.
- 7. An account book processing device applied to a server, the device comprising: The system comprises an acquisition module, a service request and a service request management module, wherein the acquisition module is used for acquiring the number of users associated with a target group account and acquiring identification parameters of the target users associated with the service request under the condition of receiving the service request, and the target group account is associated with a target account, wherein the service request is used for requesting to operate account balance of the target users in the target account; the judging module is used for determining target sub-ledger fragments from the target ledger based on the identification parameters of the target users when the number of the users is larger than the preset number, wherein the target sub-ledger fragments are part of ledger fragments in the target ledger; And the execution module is used for executing the operation corresponding to the service request on the target sub-ledger fragments, wherein the server can operate different fragments included in the target ledger at the same time.
- 8. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the ledger processing method of any one of claims 1 to 6 when executed by the processor.
- 9. A computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, which when executed by a processor, implements the steps of the ledger processing method of any one of claims 1 to 6.
- 10. A computer program product comprising computer instructions which, when executed by a processor, implement the steps of the ledger processing method of any one of claims 1 to 6.
Description
Account book processing method, device, equipment, medium and program product Technical Field The application relates to the technical field of the internet of things, in particular to an account book processing method, an account book processing device, account book processing equipment, an account book processing medium and a program product. Background When the internet of things service is vigorously developed, as the internet of things service is mostly a group service, hundreds of thousands, even hundreds of millions of internet of things cards commonly use the same group account under one group. The conventional account book processing flow is that when the account book is executed, the account book is locked, and after the operation is completed, the account book is unlocked after the corresponding modification is completed. When the accounting deduction operation is performed, if the above processing flow is adopted, because the number of the related cards is huge, a large number of concurrent requests can attempt to lock the account book at the same time, which causes frequent occurrence of failure of locking overtime and seriously hinders the processing performance of the system. The serious delay of the processing flow can be caused by a large number of overtime failures, and the problems of inconsistent data and the like can be caused, so that the stable operation of the whole Internet of things service is greatly and negatively influenced. Therefore, when the traffic volume is large, the existing ledger processing method has the problem of low processing efficiency. Disclosure of Invention The embodiment of the application provides an account book processing method, an apparatus, a device, a medium and a program product, which can solve the problem of low processing efficiency of the existing account book processing method under the condition of large traffic. In a first aspect, an embodiment of the present application provides a ledger processing method, where the method includes: Under the condition that a service request is received, acquiring the number of users associated with a target group account and acquiring identification parameters of the target users associated with the service request, wherein the target group account is associated with a target account book, and the service request is used for requesting to operate the account balance of the target users in the target account book; Determining target sub-ledger fragments from the target ledger based on the identification parameters of the target users when the number of users is larger than a preset number, wherein the target sub-ledger fragments are partial ledger fragments in the target ledger; and executing the operation corresponding to the service request on the target sub-ledger fragments, wherein the server can operate different fragments included in the target ledger at the same time. Optionally, the determining the target sub-ledger segmentation from the target ledger based on the identification parameter of the target user includes: calculating a target hash value corresponding to the identification parameter of the target user; Determining a sub-ledger fragment corresponding to the target hash value as the target sub-ledger fragment when the target ledger comprises the sub-ledger fragment corresponding to the target hash value; And if the target ledger does not comprise the sub-ledger fragments corresponding to the target hash value, creating the target sub-ledger fragments in the target ledger according to the target hash value. Optionally, the number of sub-ledger fragments included in the target ledger is associated with the number of users associated with the target group account, wherein the larger the value of the number of users associated with the target group account is, the lower the speed-up of the sub-ledger fragments of the target ledger is. Optionally, when the operation corresponding to the service request is updating the account balance of the target user, the performing the operation corresponding to the service request on the target sub-ledger slice includes: Locking the target sub-ledger fragments; And under the condition that the target sub-account book fragments are successfully locked, updating account balances of the target users in the target sub-account book fragments. Optionally, after obtaining the number of users associated with the target group account and obtaining the identification parameter of the target user associated with the service request, the method further includes: and executing the operation corresponding to the service request on the target account book under the condition that the number of users is smaller than or equal to the preset number. Optionally, when the operation corresponding to the service request is to query the account balance of the target user, the executing the operation corresponding to the service request on the target sub-ledger slice includes: Obtaining