CN113806379B - Rating method, device, equipment and computer medium based on threshold optimistic lock - Google Patents

Rating method, device, equipment and computer medium based on threshold optimistic lock Download PDF

Info

Publication number
CN113806379B
CN113806379B CN202010544869.8A CN202010544869A CN113806379B CN 113806379 B CN113806379 B CN 113806379B CN 202010544869 A CN202010544869 A CN 202010544869A CN 113806379 B CN113806379 B CN 113806379B
Authority
CN
China
Prior art keywords
version number
ticket
rating
current
threshold interval
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010544869.8A
Other languages
Chinese (zh)
Other versions
CN113806379A (en
Inventor
周磊
喻金权
方国梁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Zhejiang Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Zhejiang Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202010544869.8A priority Critical patent/CN113806379B/en
Publication of CN113806379A publication Critical patent/CN113806379A/en
Application granted granted Critical
Publication of CN113806379B publication Critical patent/CN113806379B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2308Concurrency control
    • G06F16/2336Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
    • G06F16/2343Locking methods, e.g. distributed locking or locking implementation details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0283Price estimation or determination
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/60Business processes related to postal services

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Game Theory and Decision Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Resources & Organizations (AREA)
  • Primary Health Care (AREA)
  • Tourism & Hospitality (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention relates to the technical field of network communication charging processing, and discloses a method for optimistically locking prices based on a threshold value, which comprises the following steps: acquiring a ticket to be priced of a user; acquiring the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated; determining whether the current usage exceeds a rating threshold interval; if not, carrying out rating treatment on the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number; if yes, comparing whether the initial version number is the same as the first current version number; and if the initial version number is the same as the first current version number in the database table, rating the standard ticket, completing charging and resource updating of the ticket to be rated, and generating a new version number. Through the mode, the method and the device have the beneficial effects of improving the batch processing performance and efficiency.

Description

Rating method, device, equipment and computer medium based on threshold optimistic lock
Technical Field
The embodiment of the invention relates to the technical field of network communication, in particular to a rating method, a rating device, rating equipment and a computer readable storage medium based on threshold optimistic lock.
Background
In a billing system in the telecommunications industry, a traffic service is billed according to a ticket issued by a network element side, and free resources/accumulated amounts in the traffic service are stored in a database (billing MDB) for billing efficiency. The charging process involves main modules including: ticket decoding module, business analysis module, charging MDB module and rating module.
And a ticket decoding module: and after the original ticket generated by network elements of different manufacturers is collected, converting according to a set rule to form an internal ticket in a standard format so as to facilitate the follow-up unified charging.
And a service analysis module: inquiring user ordering information in the MDB, analyzing the business consumption scene of the user, and giving the analyzed ticket to the rating process.
Charging MDB module: the database of the charging system stores free resources/accumulated usage of the full subscriber. Supporting the control capability of things, providing free resources/cumulative amount inquiry for the periphery, and updating the interface.
And (3) a rating module: and in combination with the ordering information of the user and the used free resources/accumulated quantity information, rating is carried out according to the agreed rate dialogue list, and charging of the original ticket of the user and updating of the resources are completed.
The mode can well support the charging of the traffic service of the common user, but with the development of the traffic sharing service of the Internet of things/group, a scene of millions of users sharing a resource pool appears, and the charging performance in the mode is seriously reduced, so that the traffic charging efficiency requirement of the Internet of things can not be met.
At present, a long lock updating mode is adopted when the price is interacted with the MDB, namely, a user is locked when the MDB data is queried out, the updating is completed, the user is unlocked, and the consistency of the data under the condition of concurrent updating is ensured.
This approach is not problematic for a single user, but for a group free resource sharing service, MDB locking and unlocking is on the group owner user, and when there are a large number of users under the internet of things traffic sharing service/large account, the batch ticket generation of the users will cause the lock conflict of the group users to be very serious, resulting in:
under a large group/large account, a long lock mechanism causes that the group/account call ticket can only be processed in sequence (namely, when one process processes the call ticket, other processes which are processing the same type call ticket can only wait), the efficiency of processing the call ticket is low, and the price is not timely.
Under the above situation, when a large number of group/large account bills wait and occupy all rating processes, the ordinary user bill waits, and the rating efficiency of the ordinary user is affected.
If the long lock mode is improved to the optimistic lock mode, namely the inquiry is not locked, the optimistic lock mode is updated and used, and the consistency of things is ensured through version number comparison, so that the concurrency problem can be relieved to a certain extent. However, when a large number of telephone bills come under a large account, when an optimistic lock updating mode is used, a large number of inconsistent version numbers can appear, so that data consistency verification is not passed, updating is unsuccessful, and finally, a long lock mode is needed to be walked again. In this extreme case, the concurrency cannot be increased significantly.
Therefore, the improvement of the flow service pricing efficiency under the group/large account is a technical problem to be solved.
Disclosure of Invention
In view of the above problems, embodiments of the present invention provide a rating method, apparatus, device and computer readable storage medium based on a threshold optimistic lock, which are used to solve the technical problem of low service rating efficiency in the prior art.
According to an aspect of an embodiment of the present invention, there is provided a rating method based on a threshold optimistic lock, the method comprising:
acquiring a ticket to be priced of a user;
acquiring the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in a database table;
determining whether the current usage exceeds the rating threshold interval;
if the current usage amount does not exceed the rating threshold interval, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number;
if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and whether the initial version number is the same as the first current version number is compared;
And if the initial version number is the same as the first current version number, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number.
In an alternative manner, obtaining the ticket to be priced for the user further includes:
collecting a ticket to be priced of a user through a network element;
decoding and converting the to-be-priced ticket to form a to-be-priced standard ticket;
and carrying out service analysis on the standard ticket to be priced to obtain the ticket to be priced, wherein the ticket to be priced comprises user account identification information, user consumption types and corresponding current resource use increment.
In an optional manner, the method further includes obtaining the current usage amount of the user resource, the rating threshold interval and the initial version number according to the ticket to be rated:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
In an optional manner, if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and before the step of comparing whether the initial version number is the same as the first current version number, the method further includes the following steps:
if the current usage amount exceeds the rating threshold interval, whether new user product tariffs exist or not is analyzed;
if new user product tariffs exist, a second current version number is obtained from a database table, and whether the initial version number is the same as the second current version number is compared;
if the new price threshold interval is the same, a new price threshold interval is determined according to the new user product price, and the new threshold interval is updated to the database table.
In an alternative manner, if the current usage exceeds the rating threshold interval, comparing whether the initial version number is the same as the first current version number, further includes:
if the initial version number is different from the first current version number in the database table, the rating processing fails, and the ticket to be rated is rated again by adopting a long lock mechanism.
According to another aspect of the embodiments of the present invention, there is also provided a rating device based on a threshold optimistic lock, including:
The ticket acquisition module is used for acquiring a ticket to be priced of a user;
the data query module is used for acquiring the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in a database table;
the threshold interval checking module is used for determining whether the current use amount exceeds the rating threshold interval;
the first data updating module is used for carrying out rating processing on the ticket to be rated if the current usage amount does not exceed the rating threshold interval, completing charging and resource updating of the ticket to be rated, and generating a new version number;
the version comparison module is used for comparing whether the initial version number is the same as a first current version number in a database or not if the current usage amount exceeds the rating threshold interval;
and the second data updating module is used for rating the ticket to be rated if the initial version number is the same as the first current version number in the database, completing charging and resource updating of the ticket to be rated, and generating a new version number.
In an optional manner, the ticket obtaining module obtains a ticket to be priced for the user, and further includes:
Collecting a ticket to be priced of a user through a network element;
decoding and converting the to-be-priced ticket to form a to-be-priced standard ticket;
and carrying out service analysis on the standard ticket to be priced to obtain the ticket to be priced, wherein the ticket to be priced comprises user account identification information, user consumption types and corresponding current resource use increment.
In an optional manner, the information obtaining module obtains the current usage amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, and further includes:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
According to another aspect of an embodiment of the present invention, there is provided a rating device based on a threshold optimistic lock, including: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
The memory is configured to store at least one executable instruction that causes the processor to perform the operations of the threshold optimistic lock-based pricing method described above.
According to yet another aspect of embodiments of the present invention, there is provided a computer-readable storage medium having stored therein at least one executable instruction that, when run on a threshold-optimistically lock-based rating apparatus/device, causes the threshold-optimistically lock-based rating apparatus/device to perform the operations of the above-described threshold-optimistically lock-based rating method.
According to the rating method based on the threshold value optimistic locks, the rating of the optimistic locks with consistency is judged based on the threshold value, the improved rating of the optimistic lock mode is realized for specific services on the basis of the rating based on the long lock mode, the mode of consistency judgment is carried out on a single judgment version number when the optimistic locks are updated, the judgment of a threshold value interval is increased, the problem of concurrency under the processing of large-account batch telephone tickets is solved, the use limitation of the optimistic locks is expanded, and the rating processing performance and efficiency of group/large-account flow service are improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and may be implemented according to the content of the specification, so that the technical means of the embodiments of the present invention can be more clearly understood, and the following specific embodiments of the present invention are given for clarity and understanding.
Drawings
The drawings are only for purposes of illustrating embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow chart of a rating method based on a threshold optimistic lock according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a rating device according to an embodiment of the present invention for providing a threshold-based optimistic lock;
fig. 3 shows a schematic structural diagram of a rating device based on a threshold optimistic lock according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein.
According to the rating method based on the threshold value optimistic lock, the rating mode is changed from a pessimistic lock mode of a long lock to an optimistic lock mode by changing the MDB inquiry locking/updating unlocking mechanism. By setting a database table comprising a version number and a threshold interval in a database, unlocking is not performed during inquiry, an optimistic locking mode is used during updating, the threshold interval is added in an optimistic locking model, the threshold interval is determined according to the free resource quantity of products ordered by a user, and the version number is not required to be compared in the threshold interval, so that the updating is directly successful. When the version number is not in the threshold interval or the threshold interval is updated, the version number needs to be compared, so that the consistency of things is ensured. Therefore, when a large number of ticket are generated in batches under the group/large account, the concurrent processing of ticket pricing is realized.
Fig. 1 is a flow chart of a rating method based on a threshold optimistic lock according to an embodiment of the present invention, where the method is performed by a rating device based on the threshold optimistic lock. As shown in fig. 1, the method comprises the steps of:
s110: and obtaining the ticket to be priced of the user.
The method comprises the steps that network elements of different manufacturers collect to-be-priced call tickets of users, a call ticket decoding unit converts and decodes the to-be-priced call ticket according to preset rules to form a to-be-priced standard call ticket, the to-be-priced standard call ticket is analyzed by a service analysis unit, the service analysis unit inquires memory data corresponding to user account identification information in a database according to user account identification information in the to-be-priced standard call ticket, and the memory data are user ordering information, free resource information or accumulated resource information, and analyzes service consumption scenes of the users to obtain the to-be-priced call ticket. The ticket to be priced includes the user consumption category and the corresponding increment of the current resource use. The business analysis unit sends the rating bill information to the current rating thread.
S120: and obtaining the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in a database table.
After receiving the ticket to be priced, the current pricing thread sends an asset inquiry request to a database (MDB) to acquire the current usage amount, the pricing threshold interval and the initial version number of the user resource corresponding to the user account representation information from the database.
In this embodiment, the database is a Memory Database (MDB) of the charging system, where information such as free resource information of a full user account, accumulated resource usage amount, and the like are stored. And obtaining the current usage of the user resources according to the current resource usage increment in the user to-be-priced standard ticket and the accumulated resource usage recorded in the database, which are analyzed by the service analysis unit, namely, the current usage is calculated by adding the accumulated resource usage to the current resource usage increment. The user resource can be the resources such as the free internet surfing flow, free call duration, free short message number and the like of the user.
The database (MDB) further stores a database table including a version number and a threshold interval, and is configured to store information such as user account identification information, a home type, a version number, a threshold interval start value, a threshold interval end value, and a threshold interval type of the user in a form of a table field, as shown in table 1. When the user is first rated, the database table is initialized. Wherein the change of the version number is compared by the value corresponding to the version number. The version number is initialized to 0, when the data is read, the values of the fields such as a threshold interval, a version number (version_seq) and the like in the database table are read together according to the user account identification information, and when the rating is finished once, namely, when ticket charging and resource updating are finished once, the value of the version number is added by 1.
Field name Field description Field description
owner_id User account identification information Group/account etc. numbering
owner_type Attribution type Group/account etc
version_seq Version number 0
beg_val Threshold interval start value 0
end_val Threshold interval end value 10G
val_type Type of threshold interval Free resource type
TABLE 1
The threshold interval type comprises a free resource type and an accumulated amount resource type, wherein the free resource type refers to free resources in the threshold interval; the accumulated amount resource type refers to charging according to the accumulated usage amount of the resource. The threshold interval refers to the total amount of free resources or a tariff gear interval owned by the user account ordered product. For the free resource type, for example, if the user subscribes to a 10G product of 100 yuan, the 10G is a threshold interval, and the 10G threshold interval type is the free resource type. At this time, beg_val=0, end_val= 10485760K (10G), val_type=10 (free resource type). For the accumulated amount resource type, the tariff gear interval is a threshold interval, for example, [0G,1G ] is 10 yuan/G, where beg_val=0, end_val=1048576K (1G), val_type=11 (accumulated amount resource type); [1G,10G ] is 5 yuan/G, at this time, beg_val=1048576K, end_val= 10485760K (1G), val_type=11 (threshold interval type).
Therefore, the specific steps of obtaining the current usage amount, the rating threshold interval and the initial version number include:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
Through the steps, the user information (such as the serial numbers of groups/accounts and the like) is obtained from the ticket to be priced, and the rating threshold interval corresponding to the user and the initial version number in the database are determined according to the user information. Wherein the initial version number represents the latest version number stored in the database that was previously read before the current rating was made.
Step 130: it is determined whether the current usage exceeds a rating threshold interval.
The unit prices of the resources in the rating threshold interval are the same, so that whether the charging standard of the current usage of the user account changes or not is judged based on the rating threshold interval queried from the database table, if yes, the free resource interval is exceeded or not.
Step 140: and if the current usage amount does not exceed the rating threshold interval, rating the ticket to be rated, completing the charging and resource updating of the ticket to be rated, and generating a new version number.
The step is to check the rating threshold interval stored in the database table, and the rating threshold interval represents that the unit price of the resources in the rating threshold interval is the same, so that when the current usage (the current resource usage increment plus the accumulated resource usage) is smaller than or equal to the threshold interval stored in the database table, the accumulated resource usage can be updated at will without comparing the version numbers. If the free resource or the cumulative amount satisfies (begval < = used amount+current increment < = end val), the ticket to be batched is processed, specifically, the current resource use increment is added to the cumulative resource use amount, the cumulative resource use amount is updated, and a new version number is generated. In this embodiment, the new version number is generated by adding 1 to the initial version number in the database table and storing the new version number in the database.
Step 150: if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and whether the initial version number is identical to the first current version number is compared based on an optimistic lock mechanism.
If the threshold interval check fails, the current usage exceeds the threshold interval, and at the moment, the accumulated resource usage is updated through the optimistic lock, and whether the initial version number is the same as the first current version number in the database is compared. The first current version number is the latest version number obtained from the database table before the ticket to be priced is charged and the resources are updated in the current prioritisation process after judging that the current usage amount exceeds the prioritisation threshold interval. That is, since the database is not locked during the pricing process, other pricing threads may update the data during the execution of the current pricing thread, and the version number in the database table is updated. Therefore, when the current usage exceeds the threshold interval, it needs to determine whether other price-rating lines update the database in the price-rating process, read the first current version number from the database table, and compare whether the initial version number is consistent with the first current version number in the database. If the data is consistent, the data is not updated in the current rating process, and the current rating can be updated. If the price list is inconsistent, the data is updated in the process of executing the price list, namely, the billing and the resources of the price list are updated, and the data update fails.
If the current usage amount exceeds the rating threshold interval stored in the database table, comparing whether the initial version number is the same as the first current version number in the database, and before the comparing, further comprising: if the current usage amount exceeds the rating threshold interval, the return service analysis unit analyzes whether a new user product cost exists, determines whether the new rating threshold interval exists, updates the rating threshold interval according to the new user product cost if the new user product cost exists, reads a second current version number from a database table of a database before updating the rating threshold interval, compares whether the initial version number is identical to the second current version number, and updates the rating threshold interval if the initial version number is identical to the second current version number, so as to obtain the new rating threshold interval. For example, after the free resources of the user 2G are used up, the user subscribes to the free resources of 1G, and the 1G becomes a new threshold. After obtaining the new rating threshold interval, checking the rating threshold interval, judging whether the current usage amount exceeds the new threshold interval, if not, directly updating, and updating the version number. If the number exceeds the number, the version numbers are compared, if the number is consistent, rating processing is carried out, and charging and resource updating of the ticket to be rated are carried out. If the new threshold interval is not exceeded, the rating fails, and the billing and resource updating of the ticket to be rated fails. And after the rating threshold interval is not updated any more and the user usage amount exceeds the rating threshold interval, comparing the version numbers, if the version numbers are the same, updating successfully, otherwise, updating failure.
Step 160: and if the initial version number is the same as the first current version number in the database, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number.
Wherein, whether the initial version number is consistent with the first current version number in the database is compared. If the resources are consistent, the fact that no other price-batched lines update the resources of the user in the database in the current price-batched process is indicated, namely, the current price-batched process can charge the bill to be batched and update the resources, specifically, the current resource use increment is added into the accumulated resource use quantity, the accumulated resource use quantity is updated, and a new version number is generated. In this embodiment, the new version number is generated by adding 1 to the initial version number in the database table, and storing the same in the database.
The present embodiment further includes step 170: if the initial version number is different from the first current version number, namely different from the latest version number in the database, the data corresponding to the user account in the database is changed, and the ticket to be priced is priced again by adopting a long lock mechanism.
If the price is inconsistent, the fact that other price-rating lines update the data of the user resources of the user account in the database in the current price-rating process is indicated, and the current price-rating process fails, namely, the billing and resource updating of the ticket to be rated fails.
In this embodiment, if the current price-approval process fails, the to-be-approved ticket is subjected to a resetting process, and sent to the service analysis unit for re-service analysis, and a long lock mechanism is adopted for price approval, that is, when the data in the database is inquired out, the user account in the database is locked, and after the charging and resource updating of the to-be-approved ticket are completed, the user account is unlocked, so that the consistency of the data under the condition of concurrent updating is ensured. The long lock mechanism is pessimistic lock, which means that data is in a locked state in the data processing process, and can be realized by using the lock mechanism of a database.
According to the rating method based on the threshold value optimistic lock, the rating of the optimistic lock with consistency is judged based on the threshold value, the improved rating of the optimistic lock mode is achieved for specific services on the basis of the rating based on the long lock mode, the mode of consistency judgment of a single judgment version number during optimistic lock updating is improved, and judgment of a threshold value interval is increased. By setting a database table comprising a version number and a threshold interval in a database, unlocking is not performed during inquiry, an optimistic locking mode is used during updating, the threshold interval is added in an optimistic locking model, the threshold interval is determined according to the free resource quantity of products ordered by a user, and the version number is not required to be compared in the threshold interval, so that the updating is directly successful. When the version number is not in the threshold interval or the threshold interval is updated, the version number needs to be compared, so that the consistency of things is ensured. The method solves the concurrency problem in large account batch ticket processing, expands the use limitation of optimistic locks, and improves the group/large account flow service batch processing performance and efficiency.
FIG. 2 shows a schematic diagram of one embodiment of a rating device based on a threshold optimistic lock of the invention. As shown in fig. 2, the apparatus 200 includes: ticket acquisition module 210, data query module 220, threshold interval check module 230, first data update module 240, version comparison module 250, second data update module 260, long lock rating processing module 270.
The ticket obtaining module 210 is configured to obtain a ticket to be priced for the user.
The data query module 220 is configured to obtain, according to the ticket to be rated, a current usage amount of the user resource, a rating threshold interval, and an initial version number, where the rating threshold interval and the initial version number are stored in a database table.
The threshold interval checking module 230 is configured to determine whether the current usage amount exceeds the rating threshold interval.
And the first data updating module 240 is configured to perform rating processing on the ticket to be rated if the current usage amount does not exceed the rating threshold interval, complete charging and resource updating on the ticket to be rated, and generate a new version number.
And the version comparison module 250 is configured to obtain a first current version number from the database table if the current usage amount exceeds the rating threshold interval, and compare whether the initial version number is the same as the first current version number in the database.
And the second data updating module 260 is configured to, if the initial version number is the same as the first current version number in the database, rate the ticket to be rate, complete charging and resource updating of the ticket to be rate, and generate a new version number.
The rating device based on the threshold optimistic lock further comprises a long-lock rating module 270 for rating by using a long-lock mechanism if the initial version number is different from the latest version number in the database.
The specific working process of each module is as follows:
the ticket acquiring module 210 acquires a ticket to be priced for the user.
The method comprises the steps that network elements of different manufacturers collect to-be-priced call tickets of users, a call ticket decoding unit converts and decodes the to-be-priced call ticket according to preset rules to form a to-be-priced standard call ticket, the to-be-priced standard call ticket is analyzed by a service analysis unit, the service analysis unit inquires memory data corresponding to user account identification information in a database according to user account identification information in the to-be-priced standard call ticket, and the memory data are user ordering information, free resource information or accumulated resource information, and analyzes service consumption scenes of the users to obtain the to-be-priced call ticket. The ticket to be priced includes the user consumption category and the corresponding increment of the current resource use. The business analysis unit sends the rating bill information to the current rating thread.
The data query module 220 obtains the current usage amount of the user resource, the rating threshold interval and the initial version number according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in the database table.
After receiving the ticket to be priced, the data query module 220 sends an asset query request to a database (MDB) to obtain the current usage amount, the rating threshold interval and the initial version number of the user resource corresponding to the user account identification information from the database.
In this embodiment, the database is a Memory Database (MDB) of the charging system, where information such as free resource information of a full user account, accumulated resource usage amount, and the like are stored. And obtaining the current usage of the user resources according to the current resource usage increment in the user to-be-priced standard ticket and the accumulated resource usage recorded in the database, which are analyzed by the service analysis unit, namely, the current usage is calculated by adding the accumulated resource usage to the current resource usage increment. The user resource can be the resources such as the free internet surfing flow, free call duration, free short message number and the like of the user.
The database (MDB) further stores a database table including a version number and a threshold interval, and is configured to store information such as user account identification information, a home type, a version number, a threshold interval start value, a threshold interval end value, and a threshold interval type of the user in a form of a table field, as shown in table 1. When the user is first rated, the database table is initialized. Wherein the change of the version number is compared by the value corresponding to the version number. The version number is initialized to 0, when the data is read, the values of the fields such as a threshold interval, a version number (version_seq) and the like in the database table are read together according to the user account identification information, and when the rating is finished once, namely, when ticket charging and resource updating are finished once, the value of the version number is added by 1.
TABLE 1
The threshold interval type comprises a free resource type and an accumulated amount resource type, wherein the free resource type refers to free resources in the threshold interval; the accumulated amount resource type refers to charging according to the accumulated usage amount of the resource. The threshold interval refers to the total amount of free resources or a tariff gear interval owned by the user account ordered product. For the free resource type, for example, if the user subscribes to a 10G product of 100 yuan, the 10G is a threshold interval, and the 10G threshold interval type is the free resource type. At this time, beg_val=0, end_val= 10485760K (10G), val_type=10 (free resource type). For the accumulated amount resource type, the tariff gear interval is a threshold interval, for example, [0G,1G ] is 10 yuan/G, where beg_val=0, end_val=1048576K (1G), val_type=11 (accumulated amount resource type); [1G,10G ] is 5 yuan/G, at this time, beg_val=1048576K, end_val= 10485760K (1G), val_type=11 (threshold interval type).
Therefore, the specific working procedure of the data query module 220 to obtain the current usage, the rating threshold interval and the initial version number includes:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
Obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
By the method, the user information (such as the serial numbers of the group/account and the like) is obtained from the ticket to be priced, and the rating threshold interval corresponding to the user and the initial version number in the database are determined according to the user information. The initial version number represents the latest version number stored in a database acquired in advance before the current rating is performed.
The threshold interval check module 230 determines whether the current usage exceeds a rating threshold interval.
The unit prices of the resources in the rating threshold interval are the same, so that whether the charging standard of the current usage of the user account changes or not is judged based on the rating threshold interval queried from the database table, if yes, the free resource interval is exceeded or not.
If the current usage amount does not exceed the rating threshold interval, the first data updating module 240 performs rating processing on the ticket to be rated, finishes charging and resource updating on the ticket to be rated, and generates a new version number.
The step is to check the rating threshold interval stored in the database table, and the rating threshold interval represents that the unit price of the resources in the rating threshold interval is the same, so that when the current usage (the current resource usage increment plus the accumulated resource usage) is smaller than or equal to the threshold interval stored in the database table, the accumulated resource usage can be updated at will without comparing the version numbers. If the free resource or the cumulative amount satisfies (begval < = used amount+current increment < = end val), the ticket to be batched is processed, specifically, the current resource use increment is added to the cumulative resource use amount, the cumulative resource use amount is updated, and a new version number is generated. In this embodiment, the new version number is generated by adding 1 to the initial version number in the database table and storing the new version number in the database.
If the current usage exceeds the rating threshold interval, the version comparison module 250 obtains a first current version number from the database table and compares whether the initial version number is the same as the first current version number based on an optimistic mechanism.
If the threshold interval check fails, the current usage exceeds the threshold interval, and at the moment, the accumulated resource usage is updated through the optimistic lock, and whether the initial version number is the same as the first current version number in the database is compared. The first current version number is the latest version number obtained from the database table before the ticket to be priced is charged and the resources are updated in the current prioritisation process after judging that the current usage amount exceeds the prioritisation threshold interval. That is, since the database is not locked during the pricing process, other pricing threads may update the data during the execution of the current pricing thread, and the version number in the database table is updated. Therefore, when the current usage exceeds the threshold interval, it needs to determine whether other price-rating lines update the database in the price-rating process, read the first current version number from the database table, and compare whether the initial version number is consistent with the first current version number in the database. If the data is consistent, the data is not updated in the current rating process, and the current rating can be updated. If the price list is inconsistent, the data is updated in the process of executing the price list, namely, the billing and the resources of the price list are updated, and the data update fails.
If the current usage amount exceeds the rating threshold interval stored in the database table, comparing whether the initial version number is the same as the first current version number in the database, and before the comparing, further comprising: if the current usage amount exceeds the rating threshold interval, the return service analysis unit analyzes whether a new user product cost exists, determines whether the new rating threshold interval exists, updates the rating threshold interval according to the new user product cost if the new user product cost exists, reads a second current version number from a database table of a database before updating the rating threshold interval, compares whether the initial version number is identical to the second current version number, and updates the rating threshold interval if the initial version number is identical to the second current version number, so as to obtain the new rating threshold interval. For example, after the free resources of the user 2G are used up, the user subscribes to the free resources of 1G, and the 1G becomes a new threshold. After obtaining the new rating threshold interval, checking the rating threshold interval, judging whether the current usage amount exceeds the new threshold interval, if not, directly updating, and updating the version number. If the number exceeds the number, the version numbers are compared, if the number is consistent, rating processing is carried out, and charging and resource updating of the ticket to be rated are carried out. If the new threshold interval is not exceeded, the rating fails, and the billing and resource updating of the ticket to be rated fails. And after the rating threshold interval is not updated any more and the user usage amount exceeds the rating threshold interval, comparing the version numbers, if the version numbers are the same, updating successfully, otherwise, updating failure.
If the initial version number is the same as the first current version number in the database, the second data updating module 260 performs rating on the ticket to be rated, finishes charging and resource updating on the ticket to be rated, and generates a new version number.
Wherein, whether the initial version number is consistent with the first current version number in the database is compared. If the price is consistent, the fact that no other price-batched line updates the resources of the user in the database in the current price-batched process is indicated, namely, the price-batched process can be used for charging the bill to be batched and updating the resources, and after the data is updated, the bill to be batched is stored in the database.
The embodiment further includes a long-lock pricing processing module 270, if the initial version number is different from the latest version number in the database, the long-lock pricing processing module 270 uses a long-lock mechanism to perform pricing processing on the ticket to be priced again.
If the price is inconsistent, the fact that other price-rating lines update the data of the user's resources in the database in the current price-rating process is indicated, and the current price-rating process fails, namely, the billing of the ticket to be priced and the updating of the resources fail.
In this embodiment, if the current price-approval process fails, the to-be-approved ticket is subjected to a resetting process, and sent to the service analysis unit for re-service analysis, and a long lock mechanism is adopted for price approval, that is, when the data in the database is inquired out, the user account in the database is locked, and after the charging and resource updating of the to-be-approved ticket are completed, the user account is unlocked, so that the consistency of the data under the condition of concurrent updating is ensured. The long lock mechanism is pessimistic lock, which means that data is in a locked state in the data processing process, and can be realized by using the lock mechanism of a database.
According to the rating device based on the threshold value optimistic lock, the rating of the optimistic lock with consistency is judged based on the threshold value, the improved rating of the optimistic lock mode is realized for specific services on the basis of the rating based on the long lock mode, the mode of consistency judgment of a single judgment version number during optimistic lock updating is improved, and the judgment of a threshold value interval is increased. By setting a database table comprising a version number and a threshold interval in a database, unlocking is not performed during inquiry, an optimistic locking mode is used during updating, the threshold interval is added in an optimistic locking model, the threshold interval is determined according to the free resource quantity of products ordered by a user, and the version number is not required to be compared in the threshold interval, so that the updating is directly successful. When the version number is not in the threshold interval or the threshold interval is updated, the version number needs to be compared, so that the consistency of things is ensured. The method solves the concurrency problem in large account batch ticket processing, expands the use limitation of optimistic locks, and improves the group/large account flow service batch processing performance and efficiency.
FIG. 3 is a schematic diagram of an embodiment of a rating device based on a threshold optimistic lock according to the present invention, which is not limited by the specific implementation of the rating device based on a threshold optimistic lock according to the present invention.
As shown in fig. 3, the threshold optimistic lock-based rating apparatus may include: a processor (processor) 302, a communication interface (Communications Interface) 304, a memory (memory) 506, and a communication bus 308.
Wherein: processor 302, communication interface 304, and memory 306 communicate with each other via communication bus 508. A communication interface 304 for communicating with network elements of other devices, such as clients or other application servers, etc. The processor 302 is configured to execute the program 310, and may specifically perform the relevant steps of the above-described rating method embodiment for optimistic locking based on a threshold.
In particular, program 310 may include program code comprising computer-executable instructions.
The processor 302 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors comprised by the authentication device may be of the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
Memory 306 for storing programs 310. Memory 306 may comprise high-speed RAM memory or may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Program 310 may be specifically invoked by processor 302 to cause the electronic device to:
acquiring a ticket to be priced of a user;
acquiring the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in a database table;
determining whether the current usage exceeds the rating threshold interval;
if the current usage amount does not exceed the rating threshold interval, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number;
if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and whether the initial version number is the same as the first current version number is compared;
and if the initial version number is the same as the first current version number, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number.
In an alternative manner, obtaining the ticket to be priced for the user further includes:
collecting a ticket to be priced of a user through a network element;
decoding and converting the to-be-priced ticket to form a to-be-priced standard ticket;
and carrying out service analysis on the standard ticket to be priced to obtain the ticket to be priced, wherein the ticket to be priced comprises user account identification information, user consumption types and corresponding current resource use increment.
In an optional manner, the method further includes obtaining the current usage amount of the user resource, the rating threshold interval and the initial version number according to the ticket to be rated:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
In an optional manner, if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and before the step of comparing whether the initial version number is the same as the first current version number, the method further includes the following steps:
If the current usage amount exceeds the rating threshold interval, whether new user product tariffs exist or not is analyzed;
if new user product tariffs exist, a second current version number is obtained from a database table, and whether the initial version number is the same as the second current version number is compared;
if the new price threshold interval is the same, a new price threshold interval is determined according to the new user product price, and the new threshold interval is updated to the database table.
In an alternative manner, if the current usage exceeds the rating threshold interval, comparing whether the initial version number is the same as the first current version number, further includes:
if the initial version number is different from the first current version number in the database table, the rating processing fails, and the ticket to be rated is rated again by adopting a long lock mechanism.
According to the rating device based on the threshold value optimistic lock, the rating of the optimistic lock with consistency is judged based on the threshold value, the improved rating of the optimistic lock mode is achieved for specific services on the basis of the rating based on the long lock mode, the mode of consistency judgment of a single judgment version number during optimistic lock updating is improved, and judgment of a threshold value interval is increased. By setting a database table comprising a version number and a threshold interval in a database, unlocking is not performed during inquiry, an optimistic locking mode is used during updating, the threshold interval is added in an optimistic locking model, the threshold interval is determined according to the free resource quantity of products ordered by a user, and the version number is not required to be compared in the threshold interval, so that the updating is directly successful. When the version number is not in the threshold interval or the threshold interval is updated, the version number needs to be compared, so that the consistency of things is ensured. The method solves the concurrency problem in large account batch ticket processing, expands the use limitation of optimistic locks, and improves the group/large account flow service batch processing performance and efficiency.
Embodiments of the present invention provide a computer readable storage medium storing at least one executable instruction that, when run on a threshold-optimistically lock-based rating apparatus/device, causes the threshold-optimistically lock-based rating apparatus/device to perform the threshold-optimistically lock-based rating method of any of the method embodiments described above.
The executable instructions may be particularly useful for causing a threshold optimistic lock-based rating apparatus/device to:
acquiring a ticket to be priced of a user;
acquiring the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in a database table;
determining whether the current usage exceeds the rating threshold interval;
if the current usage amount does not exceed the rating threshold interval, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number;
if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and whether the initial version number is the same as the first current version number is compared;
And if the initial version number is the same as the first current version number, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number.
In an alternative manner, obtaining the ticket to be priced for the user further includes:
collecting a ticket to be priced of a user through a network element;
decoding and converting the to-be-priced ticket to form a to-be-priced standard ticket;
and carrying out service analysis on the standard ticket to be priced to obtain the ticket to be priced, wherein the ticket to be priced comprises user account identification information, user consumption types and corresponding current resource use increment.
In an optional manner, the method further includes obtaining the current usage amount of the user resource, the rating threshold interval and the initial version number according to the ticket to be rated:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
In an optional manner, if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and before the step of comparing whether the initial version number is the same as the first current version number, the method further includes the following steps:
if the current usage amount exceeds the rating threshold interval, whether new user product tariffs exist or not is analyzed;
if new user product tariffs exist, a second current version number is obtained from a database table, and whether the initial version number is the same as the second current version number is compared;
if the new price threshold interval is the same, a new price threshold interval is determined according to the new user product price, and the new threshold interval is updated to the database table.
In an alternative manner, if the current usage exceeds the rating threshold interval, comparing whether the initial version number is the same as the first current version number, further includes:
if the initial version number is different from the first current version number in the database table, the rating processing fails, and the ticket to be rated is rated again by adopting a long lock mechanism.
According to the method and the device, based on the rating of the long lock mode, the improved rating of the optimistic lock mode is achieved for the specific service, the mode of consistency judgment of a single judgment version number during optimistic lock updating is improved, judgment of a threshold interval is increased, the problem of concurrency under large-account batch ticket processing is solved, the use limitation of the optimistic lock is expanded, and the group/large-account flow service rating processing performance and efficiency are improved.
The embodiment of the invention provides a rating device based on a threshold optimistic lock, which is used for executing the rating method based on the threshold optimistic lock.
Embodiments of the present invention provide a computer program that is callable by a processor to cause an electronic device as described above to perform the threshold optimistically lock-based rating method of any of the method embodiments described above.
Embodiments of the present invention provide a computer program product comprising a computer program stored on a computer readable storage medium, the computer program comprising program instructions which, when run on a computer, cause the computer to perform the rating method based on a threshold optimistic lock in any of the method embodiments described above.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, embodiments of the present invention are not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component, and they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specifically stated.

Claims (9)

1. A method of optimistic lock pricing based on a threshold, the method comprising:
acquiring a ticket to be priced of a user;
Acquiring the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in a database table;
determining whether the current usage exceeds the rating threshold interval;
if the current usage amount does not exceed the rating threshold interval, rating the ticket to be rated, completing charging and resource updating of the ticket to be rated, and generating a new version number;
if the current usage amount exceeds the rating threshold interval, a first current version number is obtained from the database table, and whether the initial version number is the same as the first current version number or not is compared based on an optimistic mechanism; setting a database table comprising a version number and a threshold interval in the database, wherein the database table is not locked during inquiry, an optimistic locking mode is used during updating, and the threshold interval is added in an optimistic locking model;
if the initial version number is the same as the first current version number, the ticket to be priced is priced, charging and resource updating of the ticket to be priced are completed, and a new version number is generated;
if the initial version number is different from the first current version number in the database table, the rating processing fails, and the ticket to be rated is rated again by adopting a long lock mechanism.
2. The method of claim 1, wherein obtaining the user's ticket to be priced further comprises:
collecting a ticket to be priced of a user through a network element;
decoding and converting the to-be-priced ticket to form a to-be-priced standard ticket;
and carrying out service analysis on the standard ticket to be priced to obtain the ticket to be priced, wherein the ticket to be priced comprises user account identification information, user consumption types and corresponding current resource use increment.
3. The method of claim 2, wherein obtaining the current usage of the user resource, the rating threshold interval, and the initial version number according to the ticket to be rated, further comprises:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
4. The method according to claim 1, wherein the step of obtaining a first current version number from the database table if the current usage exceeds a rating threshold interval, and comparing whether the initial version number is the same as the first current version number, further comprises the steps of:
If the current usage amount exceeds the rating threshold interval, whether new user product tariffs exist or not is analyzed;
if new user product tariffs exist, a second current version number is obtained from a database table, and whether the initial version number is the same as the second current version number is compared;
if the new price threshold interval is the same, a new price threshold interval is determined according to the new user product price, and the new threshold interval is updated to the database table.
5. A threshold optimistic lock-based rating apparatus, comprising:
the ticket acquisition module is used for acquiring a ticket to be priced of a user;
the data query module is used for acquiring the current use amount, the rating threshold interval and the initial version number of the user resource according to the ticket to be rated, wherein the rating threshold interval and the initial version number are stored in a database table;
the threshold interval checking module is used for determining whether the current use amount exceeds the rating threshold interval;
the first data updating module is used for carrying out rating processing on the ticket to be rated if the current usage amount does not exceed the rating threshold interval, completing charging and resource updating of the ticket to be rated, and generating a new version number;
The version comparison module is used for acquiring a first current version number from the database table if the current usage amount exceeds the rating threshold interval, and comparing whether the initial version number is the same as the first current version number in the database based on an optimistic lock mechanism; setting a database table comprising a version number and a threshold interval in the database, wherein the database table is not locked during inquiry, an optimistic locking mode is used during updating, and the threshold interval is added in an optimistic locking model;
the second data updating module is used for rating the ticket to be rated if the initial version number is the same as the first current version number in the database, completing charging and resource updating of the ticket to be rated, and generating a new version number;
and the long-lock rating processing module is used for carrying out rating processing on the ticket to be rated again by adopting a long-lock mechanism if the initial version number is different from the first current version number in the database table and the rating processing fails.
6. The apparatus of claim 5, wherein the ticket obtaining module obtains a ticket to be priced for the user, further comprising:
collecting a ticket to be priced of a user through a network element;
Decoding and converting the to-be-priced ticket to form a to-be-priced standard ticket;
and carrying out service analysis on the standard ticket to be priced to obtain the ticket to be priced, wherein the ticket to be priced comprises user account identification information, user consumption types and corresponding current resource use increment.
7. The apparatus of claim 6, wherein the information obtaining module obtains a current usage amount, a rating threshold interval, and an initial version number of the user resource according to the ticket to be rated, further comprising:
inquiring the accumulated resource usage of the user account from a database according to the user account identification information;
obtaining the current usage of the user resources corresponding to the user account according to the accumulated resource usage and the current resource usage increment;
inquiring the rating threshold interval and the initial version number of the user account in a database table of the database.
8. A rating device based on a threshold optimistic lock, comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is configured to hold at least one executable instruction that causes the processor to perform the operations of the threshold optimistically lock-based pricing method according to any one of claims 1-4.
9. A computer readable storage medium having stored therein at least one executable instruction that, when run on a threshold optimistically lock-based rating device, causes the threshold optimistically lock-based rating device to perform the operations of the threshold optimistically lock-based rating method according to any one of claims 1-4.
CN202010544869.8A 2020-06-15 2020-06-15 Rating method, device, equipment and computer medium based on threshold optimistic lock Active CN113806379B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010544869.8A CN113806379B (en) 2020-06-15 2020-06-15 Rating method, device, equipment and computer medium based on threshold optimistic lock

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010544869.8A CN113806379B (en) 2020-06-15 2020-06-15 Rating method, device, equipment and computer medium based on threshold optimistic lock

Publications (2)

Publication Number Publication Date
CN113806379A CN113806379A (en) 2021-12-17
CN113806379B true CN113806379B (en) 2024-04-09

Family

ID=78944217

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010544869.8A Active CN113806379B (en) 2020-06-15 2020-06-15 Rating method, device, equipment and computer medium based on threshold optimistic lock

Country Status (1)

Country Link
CN (1) CN113806379B (en)

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101730043A (en) * 2008-10-29 2010-06-09 中国移动通信集团吉林有限公司 Pricing test method and system
CN102075897A (en) * 2009-11-20 2011-05-25 中国移动通信集团江苏有限公司 Method and system for charging mobile data service
CN102075641A (en) * 2009-11-25 2011-05-25 中国移动通信集团甘肃有限公司 Method and device for processing service ticket
CN102098650A (en) * 2011-01-21 2011-06-15 中国联合网络通信集团有限公司 Content charging-based flow adaptive method and system
EP2911103A1 (en) * 2014-02-24 2015-08-26 Amadeus S.A.S. Auditing system with increased accuracy
CN107292640A (en) * 2016-03-30 2017-10-24 阿里巴巴集团控股有限公司 Resource information processing method and device in many businessman's joint promotion activities
CN107846288A (en) * 2016-09-19 2018-03-27 中国电信股份有限公司 For realizing the methods, devices and systems of charging
CN108964932A (en) * 2017-05-17 2018-12-07 中兴通讯股份有限公司 A kind of charging method, device and computer readable storage medium
CN109618070A (en) * 2018-12-03 2019-04-12 中国移动通信集团江苏有限公司 Bill charging method, device, equipment and medium
CN109978619A (en) * 2019-03-25 2019-07-05 携程旅游网络技术(上海)有限公司 Method, system, equipment and the medium of air ticket pricing Policy Filtering
CN109981911A (en) * 2017-12-27 2019-07-05 中国移动通信集团山东有限公司 A kind of calculation method and device optimizing talk business ticketing expense
CN110189158A (en) * 2019-04-16 2019-08-30 德邦物流股份有限公司 A kind of logistics billing method and system based on charging regulation engine
CN110366122A (en) * 2018-03-26 2019-10-22 华为技术有限公司 A kind of wholesale price method and apparatus
CN110493016A (en) * 2018-05-15 2019-11-22 中国移动通信集团浙江有限公司 Flow charging method and device
CN111082947A (en) * 2018-10-18 2020-04-28 华为技术有限公司 Method and device for charging consumption of resources

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140180915A1 (en) * 2012-12-21 2014-06-26 Zetta, Inc. Systems and methods for real-time billing and metrics reporting

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101730043A (en) * 2008-10-29 2010-06-09 中国移动通信集团吉林有限公司 Pricing test method and system
CN102075897A (en) * 2009-11-20 2011-05-25 中国移动通信集团江苏有限公司 Method and system for charging mobile data service
CN102075641A (en) * 2009-11-25 2011-05-25 中国移动通信集团甘肃有限公司 Method and device for processing service ticket
CN102098650A (en) * 2011-01-21 2011-06-15 中国联合网络通信集团有限公司 Content charging-based flow adaptive method and system
EP2911103A1 (en) * 2014-02-24 2015-08-26 Amadeus S.A.S. Auditing system with increased accuracy
CN107292640A (en) * 2016-03-30 2017-10-24 阿里巴巴集团控股有限公司 Resource information processing method and device in many businessman's joint promotion activities
CN107846288A (en) * 2016-09-19 2018-03-27 中国电信股份有限公司 For realizing the methods, devices and systems of charging
CN108964932A (en) * 2017-05-17 2018-12-07 中兴通讯股份有限公司 A kind of charging method, device and computer readable storage medium
CN109981911A (en) * 2017-12-27 2019-07-05 中国移动通信集团山东有限公司 A kind of calculation method and device optimizing talk business ticketing expense
CN110366122A (en) * 2018-03-26 2019-10-22 华为技术有限公司 A kind of wholesale price method and apparatus
CN110493016A (en) * 2018-05-15 2019-11-22 中国移动通信集团浙江有限公司 Flow charging method and device
CN111082947A (en) * 2018-10-18 2020-04-28 华为技术有限公司 Method and device for charging consumption of resources
CN109618070A (en) * 2018-12-03 2019-04-12 中国移动通信集团江苏有限公司 Bill charging method, device, equipment and medium
CN109978619A (en) * 2019-03-25 2019-07-05 携程旅游网络技术(上海)有限公司 Method, system, equipment and the medium of air ticket pricing Policy Filtering
CN110189158A (en) * 2019-04-16 2019-08-30 德邦物流股份有限公司 A kind of logistics billing method and system based on charging regulation engine

Also Published As

Publication number Publication date
CN113806379A (en) 2021-12-17

Similar Documents

Publication Publication Date Title
CN109885399A (en) Data processing method, electronic device, computer equipment and storage medium
RU2557761C2 (en) Bottom-up optimised search system and method
CN112766907A (en) Service data processing method and device and server
CN111400011A (en) Real-time task scheduling method, system, equipment and readable storage medium
CN112686746A (en) Credit flow configuration method, device and equipment
CN114070791B (en) Speed limiting processing method and device for data traffic
CN114691383A (en) Data processing method, device, equipment and storage medium
CN113806379B (en) Rating method, device, equipment and computer medium based on threshold optimistic lock
CN105827873B (en) A kind of solution strange land client traffic handles limited method and device
CN113079479A (en) Package recommendation method and device and computing equipment
CN116302464A (en) Cloud platform resource arrangement method and device based on unidirectional linked list and electronic equipment
CN112613907B (en) Method and system for fast matching of user-eligible marketing campaign products
CN115293877A (en) Credit platform data acquisition method, system, computer equipment and storage medium
CN114971753A (en) Billing method and system based on distributed lock
CN111429125B (en) Account management method and device, storage medium and electronic equipment
CN114090604A (en) Request processing method and device
CN113822704A (en) Method and device for calculating discount cost, electronic equipment and readable storage medium
CN113298513A (en) Method and system for processing payment request
CN111291019B (en) Similarity discrimination method and device for data model
CN112838932A (en) Re-rating method and device based on volume accumulated rating and computing equipment
CN113824847B (en) Method and device for determining charging abnormality, computing equipment and computer storage medium
CN109598975A (en) Virtual parking area management method, server and computer readable storage medium
CN115208831B (en) Request processing method, device, equipment and storage medium
CN114598559A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN114205764B (en) Traffic resource sharing method, device, equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant