Hotspot data processing method and device, equipment, storage medium and program product
By hashing processing and dynamic update of target hashing, the problem of low response speed and efficiency of hotspot data access in the prior art is solved, and more efficient hotspot data processing is achieved.
Patent Information
- Application Number
- CN202411867427.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-05-09
AI Technical Summary
When handling large-scale preferential purchase activities, the access speed and efficiency of hot data are low, making it difficult to solve hot issues.
By determining the number of hashs based on database configuration information and hotspot data, hashing the hotspot data, determining the target hash according to preset rules when responding to access requests, and updating its hash data to improve response efficiency.
This method disperses the heat of hot spot data, avoids hot spot problems, and improves the response speed and efficiency of access requests to hot spot data.
Smart Images

Figure CN119961272A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of financial technology or other fields, and more specifically to a hot data processing method, device, equipment, storage medium and program product. Background Art
[0002] As data continues to grow, hot business scenarios are more likely to appear. For example, in large-scale discount purchase activity scenarios, due to the large number of participating users or the large volume of discount transactions, requests for discount purchases can easily reach tens of thousands or even hundreds of thousands of queries per second. Data with access requests reaching tens of thousands or even hundreds of thousands of queries per second can be called hot data, and transactions of hot data are prone to cause hot problems.
[0003] In the process of implementing the present disclosure, the inventors found that the response speed and response efficiency for accessing hotspot data in the related art were low. Summary of the invention
[0004] In view of the above problems, the present disclosure provides a hotspot data processing method, apparatus, device, storage medium and program product.
[0005] According to a first aspect of the present disclosure, a hotspot data processing method is provided, comprising: determining the number of hashes for the hotspot data according to configuration information and the hotspot data of a database; performing hash processing on the hotspot data according to the number of hashes to obtain at least one hash, wherein each of the hashes corresponds to hash data; in response to an access request to the hotspot data, determining a target hash corresponding to the access request from at least one hash according to a preset rule; and accessing the hash data corresponding to the target hash, and updating the hash data of the target hash to obtain the current hash data of the target hash.
[0006] According to an embodiment of the present disclosure, the above-mentioned preset rules include a random method or a user identifier modulo method, and the above-mentioned response to the access request for the above-mentioned hotspot data, according to the preset rules, determines the target hash corresponding to the above-mentioned access request from at least one hash, including: based on the above-mentioned access request, according to the above-mentioned random method, determining the target hash corresponding to the above-mentioned access request from at least one hash; or, based on the above-mentioned access request, according to the above-mentioned user identifier modulo method, determining the target hash corresponding to the above-mentioned access request from at least one hash.
[0007] According to an embodiment of the present disclosure, an access request includes user identification information, each of the above hashes has a hash number, and based on the above access request and according to the above user identification modulo method, a target hash corresponding to the above access request is determined from at least one hash, including: determining a numbering interval involved in a hash number of at least one hash according to the hash number of each of the above hashes; performing a modulo operation according to the above numbering interval and the above user identification information to obtain a remainder; and determining the above target hash from at least one hash according to the above remainder.
[0008] According to an embodiment of the present disclosure, the at least one hash includes a main hash and a sub-hash. After the hotspot data is hashed according to the number of hashes to obtain at least one hash, the method further includes: determining total hash data of the sub-hashes according to the hash data of the main hash and the hotspot data; and obtaining hash data of the sub-hashes according to the total hash data of the sub-hashes and the number of the sub-hashes.
[0009] According to an embodiment of the present disclosure, the above-mentioned hash data includes a hash quota, the above-mentioned access request includes a deduction quota, the above-mentioned access to the hash data corresponding to the above-mentioned target hash, and updating the hash data of the above-mentioned target hash to obtain the current hash data of the above-mentioned target hash, includes: deducting the hash quota of the above-mentioned target hash according to the above-mentioned deduction quota to obtain the current hash quota of the above-mentioned target hash.
[0010] According to an embodiment of the present disclosure, the above-mentioned hotspot data processing method also includes: when the current hash amount of the above-mentioned target hash is less than the preset reserved amount, the current hash amount of the above-mentioned target hash is recovered to the main hash to obtain the current total amount of the above-mentioned hotspot data; and / or, when the current moment satisfies the above-mentioned preset time interval, the current hash amount of the above-mentioned target hash is recovered to the above-mentioned main hash to obtain the current total amount of the above-mentioned hotspot data; and the current total amount of the above-mentioned hotspot data is re-hashed.
[0011] According to an embodiment of the present disclosure, before recovering the current hash amount of the target hash to the main hash, the step further includes: sending a data recovery request to the main hash.
[0012] According to an embodiment of the present disclosure, the hotspot data processing method further includes: when the current hash amount of the target hash is less than the preset reserved amount, displaying the current hash amount of the target hash.
[0013] A second aspect of the present disclosure provides a hotspot data processing device, including: a first determination module, a first obtaining module, a second determination module and a second obtaining module.
[0014] The first determination module is used to determine the number of hashes for the hotspot data according to the configuration information of the database and the hotspot data.
[0015] The first obtaining module is used to perform hash processing on the hotspot data according to the hash quantity to obtain at least one hash, wherein each of the hashes corresponds to hash data.
[0016] The second determination module is used to respond to the access request for the hotspot data and determine the target hash corresponding to the access request from at least one hash according to a preset rule.
[0017] The second obtaining module is used to access the hash data corresponding to the target hash, and update the hash data of the target hash to obtain the current hash data of the target hash.
[0018] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0019] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.
[0020] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.
[0021] According to the hotspot data processing method, device, equipment, storage medium and product provided by the present disclosure, at least one hash can be obtained by hashing the hotspot data according to the hash quantity. Based on the access request of the hotspot data, the target hash can be determined from at least one hash based on preset rules, and then the hash data corresponding to the target hash is accessed to complete the update of the hash data of the target hash and obtain the current hash data of the target hash, thereby dispersing the heat of the hotspot data and avoiding hot spot problems for the hotspot data, thereby improving the response speed of access requests for the hotspot data and further improving the response efficiency of the access requests. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above contents and other purposes, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0023] Figure 1 The application scenario diagram of the hotspot data processing method according to the embodiment of the present disclosure is schematically shown;
[0024] Figure 2 A flowchart of a hotspot data processing method according to an embodiment of the present disclosure is schematically shown;
[0025] Figure 3 A flowchart of a hotspot data processing method according to an embodiment of the present disclosure is schematically shown;
[0026] Figure 4 A flowchart schematically illustrates the distributed processing of hotspot data according to an embodiment of the present disclosure;
[0027] Figure 5 A block diagram schematically shows a structure of a hotspot data processing device according to an embodiment of the present disclosure; and
[0028] Figure 6 A block diagram of an electronic device suitable for implementing a hotspot data processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0029] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0030] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0031] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0032] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0033] It should be noted that the hotspot data processing method and device provided in the embodiments of the present disclosure can be used for data processing in the field of financial technology, and can also be used for data processing in any field other than the field of financial technology. The application field of the hotspot data processing method and device provided in the embodiments of the present disclosure is not limited.
[0034] In the technical solution of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0035] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating a person's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.
[0036] In the process of implementing the present disclosure, it was found that in the related technology, in large-scale preferential purchase activities, the peak value of preferential deduction requests for goods can easily reach tens of thousands or even hundreds of thousands of queries per second (QPS). In this scenario, it is powerless to deduct the amount based on the database. The current performance of a single row update operation is about 500QPS, which cannot support transactions of tens of thousands of QPS, and will cause obvious hot spots.
[0037] In view of this, an embodiment of the present disclosure provides a hotspot data processing method, including: determining the number of hashes for the hotspot data based on the configuration information and hotspot data of the database; hashing the hotspot data according to the hash number to obtain at least one hash, wherein each hash corresponds to hash data; in response to an access request to the hotspot data, determining a target hash corresponding to the access request from at least one hash according to a preset rule; and accessing the hash data corresponding to the target hash, and updating the hash data of the target hash to obtain the current hash data of the target hash.
[0038] Figure 1The application scenario diagram of the hotspot data processing method according to an embodiment of the present disclosure is schematically shown.
[0039] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0040] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0041] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0042] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0043] It should be noted that the hotspot data processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the hotspot data processing device provided in the embodiment of the present disclosure can generally be set in the server 105. The hotspot data processing method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the hotspot data processing device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0044] Should understand, should understand, Figure 1 The number of the first terminal device, the second terminal device, the third terminal device, the network and the server in the embodiment is only for illustration. According to the implementation requirements, there may be any number of the first terminal device, the second terminal device, the third terminal device, the network and the server.
[0045] The following will be based on Figure 1 The scene described by Figure 2~Figure 4 The hotspot data processing method of the disclosed embodiment is described in detail.
[0046] Figure 2 The flowchart of the hotspot data processing method according to the embodiment of the present disclosure is schematically shown.
[0047] like Figure 2 As shown, the hotspot data processing method 200 of this embodiment includes operations S210 to S240.
[0048] In operation S210 , the number of hashes for the hotspot data is determined according to the configuration information of the database and the hotspot data.
[0049] In operation S220, the hotspot data is hashed according to the hash quantity to obtain at least one hash.
[0050] In operation S230 , in response to an access request to hotspot data, a target hash corresponding to the access request is determined from at least one hash according to a preset rule.
[0051] In operation S240, the hash data corresponding to the target hash is accessed, and the hash data of the target hash is updated to obtain the current hash data of the target hash.
[0052] According to the embodiments of the present disclosure, hot data may represent frequently accessed data, that is, data that is frequently queried or modified. For example, in order to attract users to join, a financial institution provides a sum of money for users who meet certain conditions to carry out cashback activities. All preferential transactions participating in the cashback activities must access this fund. When there are many users participating in the activity or the preferential transaction volume is large, this fund is a hot data.
[0053] According to the embodiments of the present disclosure, the configuration information of the database may characterize various parameters or configurations of the database, and the configuration information of the database may determine the characteristics of many aspects such as how the database operates, stores data, and interacts with external systems. The configuration information of the database may include information such as the type of database, the selection of storage engine, connection parameters, memory allocation configuration, backup strategy, etc. The configuration information of the database may be set and adjusted through a configuration file provided by a database management system or through a management tool.
[0054] According to an embodiment of the present disclosure, the access upper limit of a single hash and the redundancy of the database can be determined according to the configuration information of the database. According to the access upper limit of the hash, the redundancy of the database and the hot data, the number of hashes for the hot data can be determined. For example, when the access upper limit of a single hash is MAX and the redundancy of the database is 80%, the number of hashes NUM for the hot data can be determined according to the expected total transaction volume S of the hot data, the access upper limit MAX of a single hash and the redundancy of the database of 80%, using S / (MAX*80%)=NUM.
[0055] According to an embodiment of the present disclosure, each hash may correspond to hash data. The hotspot data may be hashed according to the number of hashes to obtain at least one hash. For example, when the number of hashes is 10, the hotspot data may be hashed into 10 hashes, each of which has hash data. The hash data in each hash may be the same.
[0056] According to the embodiments of the present disclosure, the hash processing of hot data is similar to horizontal expansion, and each hash can be regarded as a row of records in a single database. For example, the original row of records storing a 100 yuan discount can be changed to 5 rows of records storing 20 yuan discounts respectively.
[0057] According to an embodiment of the present disclosure, the access request for hotspot data may include multiple requests. For example, the access request for hotspot data may reach tens of thousands or even hundreds of thousands of QPS.
[0058] According to an embodiment of the present disclosure, a preset rule may represent a rule that is preset based on experience or demand. The preset rules may include multiple types. For example, the preset rules may include two types of rules. The target hash may be a hash in at least one hash. The number of target hashes may include multiple, for example, in the case of multiple access requests, multiple access requests may correspond to one target hash, or multiple access requests may correspond to multiple target hashes. In the case of an access request to hotspot data, the target hash may be determined from at least one hash according to the preset rules.
[0059] According to an embodiment of the present disclosure, the hash data corresponding to the target hash can be accessed according to the access request of the hot data, so that the hash data of the target hash can be updated to obtain the current hash data of the target hash. For example, in the case where the hash data of the target hash is a preferential amount, the hash data of the target hash can be deducted to achieve the update of the hash data of the target hash, thereby obtaining the current preferential amount of the target hash, that is, the current hash data of the target hash.
[0060] According to an embodiment of the present disclosure, at least one hash can be obtained by hashing the hotspot data according to the hash quantity. Based on the access request for the hotspot data, the target hash can be determined from the at least one hash based on a preset rule, and then the hash data corresponding to the target hash is accessed to complete the update of the hash data of the target hash and obtain the current hash data of the target hash, thereby dispersing the heat of the hotspot data and avoiding hot spot problems for the hotspot data, thereby improving the response speed of the access request for the hotspot data and further improving the response efficiency of the access request.
[0061] According to an embodiment of the present disclosure, in response to an access request for hotspot data, a target hash corresponding to the access request is determined from at least one hash according to a preset rule, including: based on the access request, determining the target hash corresponding to the access request from at least one hash in a random manner; or, based on the access request, determining the target hash corresponding to the access request from at least one hash in a user identifier modulo manner.
[0062] According to an embodiment of the present disclosure, the preset rule may include a random method or a user identification modulo method. Based on the access request, a target hash corresponding to the access request may be determined from at least one hash according to any method in the preset rule.
[0063] According to an embodiment of the present disclosure, the random method may be to determine the target hash corresponding to the access request from at least one hash using a random algorithm. The random algorithm may represent an algorithm that introduces randomness to solve a problem during the design and execution of the algorithm. The user identification (UID) modulo method may be to determine the target hash corresponding to the access request from at least one hash using the user identification modulo method.
[0064] According to an embodiment of the present disclosure, a target hash corresponding to an access request can be determined from at least one hash based on the access request by using a random method or a user identifier modulo method, thereby improving the flexibility, accuracy and efficiency of determining the target hash.
[0065] According to an embodiment of the present disclosure, based on an access request, a target hash corresponding to the access request is determined from at least one hash according to a user identification modulo method, including: determining a numbering interval involved in a hash number of at least one hash according to a hash number of each hash; performing a modulo operation according to the numbering interval and user identification information to obtain a remainder; and determining a target hash from at least one hash according to the remainder.
[0066] According to an embodiment of the present disclosure, the access request may include user identification information, which may represent a number or a unique identifier of the user. Each hash has a hash number, which may represent a sequence number of the hash.
[0067] According to an embodiment of the present disclosure, hotspot data may be dispersed into at least one hash, each hash having a hash number. For example, hotspot data may be dispersed into 20 hashes, each of which has its own hash number. The numbering interval involved in the hash number of at least one hash may be determined based on the hash number of each hash. For example, in the case of 20 hashes, the numbering interval involved in the hash numbers of the 20 hashes may be determined based on the hash numbers of the 20 hashes. For example, if the 20 hashes are numbered starting from 1, the numbering interval involved in the hash numbers of the 20 hashes is 1 to 20.
[0068] According to an embodiment of the present disclosure, a modulo operation can be performed based on the numbering interval and the user identification information to obtain a remainder. For example, when the user identification information is 12 and the numbering interval is 20, a modulo operation can be performed based on the numbering interval and the user identification information to obtain a remainder of 8.
[0069] According to an embodiment of the present disclosure, a target hash can be determined from at least one hash according to a remainder. For example, when the remainder is 8, the hash numbered 8 can be determined as the target hash. For example, in a preferential transaction scenario, each hash can be regarded as a row of records in a single database, and the target hash is determined by performing a modulo operation on the user identification information and the number interval, that is, determining which row of records the user operates.
[0070] According to an embodiment of the present disclosure, the hash number interval can be determined according to the hash number of each hash, so that a remainder can be obtained according to the modulo operation of the user identification information and the number interval. According to the remainder, a target hash can be determined from at least one hash, thereby improving the accuracy of determining the target hash.
[0071] Figure 3 The flowchart of the hotspot data processing method according to the embodiment of the present disclosure is schematically shown.
[0072] like Figure 3 As shown, the hotspot data processing method 300 of this embodiment includes operations S310 to S360.
[0073] In operation S310 , the number of hashes for the hotspot data is determined according to configuration information of the database and the hotspot data.
[0074] In operation S320, the hotspot data is hashed according to the hash quantity to obtain at least one hash.
[0075] In operation S330, according to each hash number of the hash, a number interval to which the hash number of at least one hash relates is determined.
[0076] In operation S340, a modulo operation is performed according to the hash interval and the user identification information to obtain a remainder.
[0077] In operation S350, a target hash is determined from at least one hash according to the remainder.
[0078] In operation S360, the hash data corresponding to the target hash is accessed, and the hash data of the target hash is updated to obtain the current hash data of the target hash.
[0079] According to an embodiment of the present disclosure, after the hotspot data is hashed according to the number of hashes to obtain at least one hash, the method further includes: determining the total hash data of the sub-hash according to the hash data of the main hash and the hotspot data; and obtaining the hash data of the sub-hash according to the total hash data of the sub-hash and the number of sub-hashes.
[0080] According to an embodiment of the present disclosure, at least one hash includes a main hash and a sub-hash, and the main hash is used to manage the sub-hash. The hash includes 1 main hash. The hash data of the main hash can be preset. The hash includes at least one sub-hash. The target hash can be determined in at least one sub-hash.
[0081] According to an embodiment of the present disclosure, the total hash data of the sub-hash can be determined according to the hash data of the main hash and the hotspot data. That is, when the total transaction volume of the preset hash data of the main hash and the hotspot data is determined, the total transaction volume of the hotspot data can be subtracted from the preset hash data of the main hash to determine the total hash data of the sub-hash.
[0082] According to an embodiment of the present disclosure, the hash data of the sub-hash can be obtained according to the total hash data of the sub-hash and the number of the sub-hash. That is, the total hash data of the sub-hash can be divided by the number of the sub-hash to obtain the hash data of the sub-hash. For example, when the total hash data of the sub-hash is a preferential amount of 10,000 yuan and the number of the sub-hash is 20, the hash data of the sub-hash can be 500.
[0083] According to the embodiments of the present disclosure, the total hash data of the sub-hash can be determined based on the hash data and hotspot data of the main hash, and then the hash data of the sub-hash can be obtained based on the number of sub-hashes, thereby improving the accuracy and uniformity of the hash data of the sub-hashes and avoiding the hotspot problem caused by uneven hash data in the sub-hashes.
[0084] According to an embodiment of the present disclosure, accessing hash data corresponding to a target hash and updating the hash data of the target hash to obtain current hash data of the target hash includes: deducting the hash amount of the target hash according to a deduction amount to obtain the current hash amount of the target hash.
[0085] According to an embodiment of the present disclosure, the hash data may include a hash quota, and the access request may include a deduction quota. The deduction quota may be subtracted from the hash quota of the target hash to obtain the current quota of the target hash. For example, if the hash quota of the target hash is 500, and the deduction quota in the access request is 20, the current hash quota of the target hash may be 480.
[0086] According to an embodiment of the present disclosure, an access request code can be constructed based on the hash number of the hash and the current date. For example, when the hash number of the hash is 73 and the current date is 20240301, an access request code 20240301_73 can be generated. The hash data corresponding to the target hash is accessed based on the access request code, and the hash amount of the target hash is deducted according to the deduction amount to obtain the current hash amount of the target hash, thereby completing the hash data update of the target hash.
[0087] According to the embodiment of the present disclosure, the hashed data also needs to be cached, so the cache also needs to be hashed, and each hash can be regarded as a record of the database.
[0088] According to the embodiments of the present disclosure, the data in the cache can be equivalent to the pre-deduction amount. If the pre-deduction is successful, the database can be modified based on the access request area. If it fails, the access request can be directly rejected. The data in the cache and the data in the database should be kept consistent as much as possible. The data in the cache should maintain weak consistency, and the data in the database should maintain strong consistency.
[0089] Figure 4 The flowchart of the distributed processing of hotspot data according to the embodiment of the present disclosure is schematically shown.
[0090] like Figure 4 As shown, this embodiment includes operations S410 to S440.
[0091] In operation S410, an access request for hotspot data is obtained.
[0092] In operation S420, the hotspot data is processed in a distributed manner using a preset rule.
[0093] In operation S430 , cached data is dispersed to obtain cache hash 1 , cache hash 2 , cache hash 3 , and cache hash 4 .
[0094] In operation S440 , the hotspot data is dispersed to obtain sub-hash 1 , sub-hash 2 , sub-hash 3 , sub-hash 4 and a main hash.
[0095] According to an embodiment of the present disclosure, the main hash can manage the sub-hash, for example, reclaim the hash data of the sub-hash. Each sub-hash corresponds to a cache hash. The cache hash can include two parts: a cache number and cache data, for example, key: inventoryId_1, value: XX, where key represents the cache number and value represents the cache data. The cache data of the cache hash is also the hash data of the sub-hash.
[0096] According to the embodiments of the present disclosure, the deduction amount can be subtracted from the hash amount of the target hash according to the request to obtain the current hash amount of the target hash, thereby realizing the update of the hash data of the target hash and improving the accuracy and real-time performance of the current hash of the obtained target hash.
[0097] According to an embodiment of the present disclosure, when accessing hash data corresponding to a target hash, the current hash amounts of different target hashes may be different due to differences and unevenness in traffic routed to different target hashes, and the data displayed to the user may also be different. This problem can be avoided by using any of the following two methods to recover the current hash amount of the target hash to the main hash, and then rehashing the current total amount of the obtained hotspot data.
[0098] According to an embodiment of the present disclosure, the above-mentioned hotspot data processing method also includes: when the current hash amount of the target hash is less than the preset reserved amount, the current hash amount of the target hash is recovered to the main hash to obtain the current total amount of the hotspot data; and / or, when the current moment meets the preset time interval, the current hash amount of the target hash is recovered to the main hash to obtain the current total amount of the hotspot data; and the current total amount of the hotspot data is re-hashed.
[0099] According to an embodiment of the present disclosure, a preset reserved amount may be set for a sub-hash, and the preset reserved amount may be set according to demand or experience.
[0100] For example, when the current hash amount of the target hash is less than the preset reserved amount, the current hash amount of the target hash can be recovered to the main hash to obtain the current total amount of the hotspot data. Or, for another example, when the current moment meets the preset time interval, the current hash amount of the target hash can be recovered to the main hash to obtain the current total amount of the hotspot data. Therefore, there are two ways to recover the current hash amount of the target hash to the main hash, one is that the current hash amount of the target hash is less than the preset reserved amount, and the other is that the current moment meets the preset time interval, that is, the current hash amount of the target hash is recovered regularly.
[0101] According to an embodiment of the present disclosure, when the current total amount of hotspot data is obtained, the current total amount of hotspot data may be re-hashed to obtain at least one new hash.
[0102] According to an embodiment of the present disclosure, before recovering the current hash quota of the target hash, the transaction service must be suspended and set to a maintenance state, during which users cannot trade; when the sub-hash service is suspended, an independent transaction must be manually submitted to ensure that the sub-hash state of the old hash has been submitted to the database before the next re-hash. After being saved in the database, the data should be synchronized to the cache.
[0103] According to an embodiment of the present disclosure, when the current hash amount of the target hash is less than the preset reserved amount and / or the current moment satisfies the preset time interval, the current hash amount of the target hash is recovered to the main hash to obtain the current total amount of the hotspot data, and the current total amount of the hotspot data is re-hashed. This can inventory the consumption of the hotspot data and re-average the hotspot data, so that the hotspot data can continue to be consumed if it is not completely consumed, thereby improving the response efficiency of requests for hotspot data during the entire consumption cycle.
[0104] According to an embodiment of the present disclosure, before the current hash quota of the target hash is recovered to the main hash, it also includes: sending a data recovery request to the main hash.
[0105] According to an embodiment of the present disclosure, before the current hash quota of the target hash is recycled to the main hash, the target hash sends a data recycling request to the main hash. For example, when the current hash quota of the target hash is less than the preset reserved quota, the data recycling request can be sent to the main hash.
[0106] According to an embodiment of the present disclosure, by sending a data recovery request to the main hash, the response efficiency of the request can be further improved.
[0107] According to an embodiment of the present disclosure, the hotspot data processing method further includes: when the current hash amount of the target hash is less than the preset reserved amount, displaying the current hash amount of the target hash.
[0108] According to an embodiment of the present disclosure, when the current hash amount of the target hash is less than the preset reserved amount, the current hash amount of the target hash can be directly displayed. In addition, the current hash amount of the target hash can be recycled to the main hash at a scheduled time or when the current hash amount of the target hash is less than the preset reserved amount. When the current hash amount of the target hash is less than the preset reserved amount and the current moment does not meet the preset time interval, the current hash amount of the target hash can also be directly displayed.
[0109] According to an embodiment of the present disclosure, the user experience can be improved by directly displaying the current hash amount of the target hash.
[0110] According to the embodiments of the present disclosure, in the scenario where the hotspot data belongs to preferential funds, the hotspot data is hashed, and a single hotspot data can be hashed into multiple hashes, which greatly disperses the heat of the hotspot data and improves the response efficiency of transactions. It can also be recovered when the current hash amount of the target hash is less than the pre-reserved amount or at a regular interval, to achieve inventory and averaging of the hotspot data, thereby improving the request response efficiency within the consumption cycle of the hotspot data.
[0111] Based on the above hotspot data processing method, the present disclosure also provides a hotspot data processing device. Figure 5 The device is described in detail.
[0112] Figure 5 The structure block diagram of the hotspot data processing device according to an embodiment of the present disclosure is schematically shown.
[0113] like Figure 5 As shown, the hotspot data processing device 500 of this embodiment includes a first determining module 510 , a first obtaining module 520 , a second determining module 530 and a second obtaining module 540 .
[0114] The first determination module 510 is used to determine the number of hashes for the hotspot data according to the configuration information of the database and the hotspot data. In one embodiment, the first determination module 510 can be used to perform the operation S210 described above, which will not be described in detail here.
[0115] The first obtaining module 520 is used to perform hash processing on the hotspot data according to the hash quantity to obtain at least one hash, wherein each hash corresponds to hash data. In one embodiment, the first obtaining module 520 can be used to perform the operation S220 described above, which will not be described in detail here.
[0116] The second determination module 530 is used to respond to the access request for the hotspot data and determine the target hash corresponding to the access request from at least one hash according to a preset rule. In one embodiment, the second determination module 530 can be used to perform the operation S230 described above, which will not be repeated here.
[0117] The second obtaining module 540 is used to access the hash data corresponding to the target hash, and update the hash data of the target hash to obtain the current hash data of the target hash. In one embodiment, the second obtaining module 530 can be used to perform the operation S240 described above, which will not be described in detail here.
[0118] According to an embodiment of the present disclosure, the preset rule includes a random method or a user identification modulo method, and the second determination module 530 includes: a first determination submodule and a second determination submodule.
[0119] A first determination submodule is used to determine, based on the access request, a target hash corresponding to the access request from at least one hash in a random manner; or.
[0120] The second determination submodule is used to determine a target hash corresponding to the access request from at least one hash based on the access request and according to a user identifier modulo method.
[0121] According to an embodiment of the present disclosure, the access request includes user identification information, each hash has a hash number, and the second determination submodule includes: a first determination unit, a second determination unit, and a third determination unit.
[0122] The first determining unit is used to determine, according to the hash number of each hash, a numbering interval involved by the hash number of at least one hash.
[0123] The second determining unit is used to perform a modulo operation according to the numbering interval and the user identification information to obtain a remainder.
[0124] The third determining unit is configured to determine a target hash from at least one hash according to the remainder.
[0125] According to an embodiment of the present disclosure, at least one hash includes a main hash and a sub-hash, and the hotspot data processing device further includes: a third determination module and a fourth determination module.
[0126] The third determination module is used to perform hash processing on the hotspot data according to the hash quantity, and after obtaining at least one hash, determine the total hash data of the sub-hash according to the hash data of the main hash and the hotspot data.
[0127] The fourth determining module is used to obtain the hash data of the sub-hash according to the total hash data of the sub-hash and the number of the sub-hash.
[0128] According to an embodiment of the present disclosure, the hash data includes a hash amount, the access request includes a deduction amount, and the second obtaining module 540 includes: a first obtaining submodule.
[0129] The first obtaining submodule is used to deduct the hash amount of the target hash according to the deduction amount to obtain the current hash amount of the target hash.
[0130] According to an embodiment of the present disclosure, the hotspot data processing device further includes: a third obtaining module, a fourth obtaining module and a re-hashing module.
[0131] A third obtaining module is used to recover the current hash quota of the target hash to the main hash to obtain the current total quota of the hotspot data when the current hash quota of the target hash is less than the preset reserved quota; and / or.
[0132] The fourth obtaining module is used to recover the current hash amount of the target hash to the main hash when the preset time interval is met at the current moment, so as to obtain the current total amount of the hotspot data;
[0133] The rehashing module is used to rehash the current total amount of hotspot data.
[0134] According to an embodiment of the present disclosure, the above-mentioned hotspot data processing device also includes: a request module.
[0135] The request module is used to send a data recovery request to the main hash before recovering the current hash amount of the target hash to the main hash.
[0136] According to an embodiment of the present disclosure, the hotspot data processing device further includes: a display module.
[0137] The display module is used to display the current hash amount of the target hash when the current hash amount of the target hash is less than the preset reserved amount.
[0138] According to an embodiment of the present disclosure, any multiple modules of the first determination module 510, the first obtaining module 520, the second determination module 530, and the second obtaining module 540 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first determination module 510, the first obtaining module 520, the second determination module 530, and the second obtaining module 540 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or encapsulating the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the first determination module 510 , the first obtaining module 520 , the second determination module 530 , and the second obtaining module 540 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be performed.
[0139] Figure 6 A block diagram of an electronic device suitable for implementing a hotspot data processing method according to an embodiment of the present disclosure is schematically shown.
[0140] like Figure 6 As shown, the electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 to a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0141] In RAM 603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0142] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the input / output (I / O) interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0143] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0144] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.
[0145] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the hotspot data processing method provided by the embodiment of the present disclosure.
[0146] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 601. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0147] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0148] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, apparatus, module, unit, etc. described above can be implemented by a computer program module.
[0149] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0150] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0151] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0152] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A hotspot data processing method, characterized in that: The method comprises: Determine the number of hashes for the hotspot data according to the configuration information of the database and the hotspot data; Performing hash processing on the hotspot data according to the hash quantity to obtain at least one hash, wherein each hash corresponds to hash data; In response to an access request to the hotspot data, determining a target hash corresponding to the access request from at least one hash according to a preset rule; and The hash data corresponding to the target hash is accessed, and the hash data of the target hash is updated to obtain the current hash data of the target hash.
2. The method according to claim 1, characterized in that The preset rule includes a random method or a user identifier modulo method, and the response to the access request to the hotspot data, according to the preset rule, determining a target hash corresponding to the access request from at least one hash, includes: Based on the access request, determining a target hash corresponding to the access request from at least one hash in the random manner; or, Based on the access request, a target hash corresponding to the access request is determined from at least one hash according to the user identifier modulo method.
3. The method according to claim 2, characterized in that The access request includes user identification information, each hash has a hash number, and determining a target hash corresponding to the access request from at least one hash based on the access request and according to a modulo method of the user identification includes: According to each of the hash numbers of the hashes, determining a numbering interval involved in the hash number of at least one hash; Perform a modulo operation according to the numbering interval and the user identification information to obtain a remainder; The target hash is determined from at least one hash based on the remainder.
4. The method according to claim 1, characterized in that: The at least one hash includes a main hash and a sub-hash, and after performing hash processing on the hotspot data according to the hash quantity to obtain at least one hash, the method further includes: Determine the total hash data of the sub-hash according to the hash data of the main hash and the hotspot data; The hash data of the sub-hash is obtained according to the total hash data of the sub-hash and the number of the sub-hash.
5. The method according to claim 1, characterized in that The hash data includes a hash amount, the access request includes a deduction amount, and the accessing the hash data corresponding to the target hash and updating the hash data of the target hash to obtain the current hash data of the target hash includes: According to the deduction amount, the hash amount of the target hash is deducted to obtain the current hash amount of the target hash.
6. The method according to claim 5, characterized in that The method further comprises: When the current hash amount of the target hash is less than the preset reserved amount, the current hash amount of the target hash is recovered to the main hash to obtain the current total amount of the hotspot data; and / or, When the preset time interval is met at the current moment, the current hash amount of the target hash is recovered to the main hash to obtain the current total amount of the hotspot data; The current total amount of the hotspot data is re-hashed.
7. The method according to claim 6, characterized in that Before the current hash amount of the target hash is recovered to the main hash, the method further includes: A data retrieval request is sent to the primary hash.
8. The method according to claim 5, characterized in that The method further comprises: In the case that the current hash amount of the target hash is less than the preset reserved amount, the current hash amount of the target hash is displayed.
9. A hotspot data processing device, characterized in that: The device comprises: A first determination module, used to determine the number of hashes for the hotspot data according to the configuration information of the database and the hotspot data; An obtaining module, configured to perform hash processing on the hotspot data according to the hash quantity to obtain at least one hash, wherein each hash corresponds to hash data; a second determination module, configured to, in response to an access request to the hotspot data, determine a target hash corresponding to the access request from at least one hash according to a preset rule; and The update module is used to access the hash data corresponding to the target hash and update the hash data of the target hash to obtain the current hash data of the target hash.
10. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.