A method, apparatus, device and computer readable medium for ultra-large scale high-performance user ranking
By dividing score ranges in internet applications and storing user information using ordered sets, real-time and accurate ranking of hundreds of millions of users was achieved, solving the problems of high latency and poor accuracy in user ranking in existing technologies, and improving system performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING BAIGEFEICHI TECH LLC
- Filing Date
- 2026-02-09
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies struggle to achieve real-time, low-latency, and highly accurate user rankings for hundreds of millions of users in internet applications, resulting in poor user experience and inaccurate rankings.
By setting a total score ceiling, dividing the score into multiple score intervals, and associating each interval with an independent ordered set in the storage system, the user identification code and its score are stored in real time. A two-level calculation mechanism is used to calculate user ranking, including score interval migration and real-time ranking aggregation.
It achieves millisecond-level real-time ranking response for hundreds of millions of users, improving system performance and user experience, ensuring the accuracy and stability of rankings, and reducing storage and computing resource consumption.
Smart Images

Figure CN122173488A_ABST
Abstract
Description
Technical Field
[0002] This application relates to the field of Internet data processing technology, and in particular to a method, apparatus, device, computer-readable medium, and computer program product for ultra-large-scale high-performance user ranking. Background Technology
[0004] In internet applications such as online education, e-sports, and social platforms, there is a significant need for real-time ranking of massive numbers of users (e.g., points, competition scores, virtual assets). Typically, most solutions compromise on this requirement, providing only a general ranking range or a non-real-time ranking.
[0005] For applications requiring this type of performance, such as ranking scores for millions of users in a competition, the mainstream solutions currently fall into two categories: The first relies on offline calculations using large datasets, such as generating ranking snapshots daily or hourly. This type of solution is not real-time, resulting in a poor user experience in scenarios where scores fluctuate frequently. The second type uses interval estimation algorithms based on sampling or statistics, only providing a rough ranking range for the user. This type of solution is imprecise and struggles to meet the needs in scenarios where rankings are directly related to user incentives (such as rewards and honors).
[0006] Therefore, there is an urgent need for a technical solution that can provide low-latency, highly accurate real-time ranking calculations for hundreds of millions of users without compromising requirements. Summary of the Invention
[0008] This application provides a method, apparatus, device, computer-readable medium, and computer program product for ultra-large-scale high-performance user ranking, which can quickly calculate the real-time accurate ranking of users with extremely low time complexity and storage overhead.
[0009] To achieve the above technical effects, one aspect of this application provides a high-performance user ranking method for ultra-large scale, including: setting a total score upper limit, and setting multiple score intervals in an orderly manner according to the score upper limit; When a target user's score changes, the target user will be moved from the original score range to the new score range; The real-time ranking of the target user is calculated by aggregating the rankings within the new score range.
[0010] According to a preferred embodiment of the present invention, the step of setting a total score upper limit and orderly setting multiple score intervals according to the score upper limit further includes: Multiple score ranges are set in an orderly manner based on the score ceiling and historical data; Each user is associated with a unique identification code in the storage system; Each score range is associated with an independent ordered set, which stores the user identification code and score of the user whose score falls within the score range in real time. The user identification codes in each ordered set are sorted in descending order according to their corresponding scores.
[0011] According to a preferred embodiment of the present invention, the step of migrating the target user from the original score range to the new score range when the target user's score changes includes: Obtain the original score range and the new score range of the target user; The user information and the changed scores of the target user are migrated from the ordered set associated with the original score interval to the ordered set associated with the new score interval.
[0012] According to a preferred embodiment of the present invention, the step of aggregating and calculating the real-time ranking of the target user based on the ranking of the new score range further includes: Get the number of high-scoring users whose scores are higher than the target user's score range; Obtain the ranking information within the ordered set associated with the score range of the target user; The real-time ranking of the target user is obtained by adding the number of high-scoring users to the ranking information.
[0013] According to a preferred embodiment of the present invention, obtaining the number of high-scoring users whose scores are higher than the target user's score range further includes: By iterating through all score intervals, the starting score of each interval is compared with the target user's score. For all intervals where the starting score is greater than the target score, sum up the number of users in each interval, and the final sum is the number of high-scoring users.
[0014] According to a preferred embodiment of the present invention, the number of traversals is proportional to the logarithm of the total number of score intervals, so that the average response time for user ranking calculation is controlled within 100 milliseconds.
[0015] Another aspect of this application provides a high-performance user ranking device with ultra-large scale, comprising: Score range configuration module: used to set the maximum total score and to set multiple score ranges in an orderly manner based on the maximum score; Score Update Module: Used to migrate the target user from the original score range to the new score range when the target user's score changes; The ranking calculation module is used to calculate the real-time ranking of the target user based on the ranking of the new score range.
[0016] Another aspect of this application provides a high-performance user ranking device with ultra-large scale, the device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described above.
[0017] In another aspect, this application provides a computer-readable storage medium having stored thereon computer program instructions that can be executed by a processor to implement the above-described method.
[0018] In another aspect of this application, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described above.
[0019] The solution provided in this application has the following beneficial effects: 1. Significantly improve ranking calculation efficiency By dividing the total score range into multiple score intervals and adopting a two-level calculation mechanism of "aggregating the number of people in the high-order interval + precise sorting within the interval", the complexity of the traditional O(N) global scan is reduced to O(logN) level, achieving millisecond-level real-time ranking response for hundreds of millions of users, which greatly improves system performance.
[0020] 2. Ensure stability and scalability under high concurrency. Each score interval maintains an independent ordered set, ensuring even data distribution, decoupled operations, and support for horizontal scaling. In high-concurrency read / write scenarios, it avoids single-point bottlenecks, resulting in a more balanced system load and excellent horizontal scalability.
[0021] 3. Achieve accurate real-time rankings without sacrificing user experience. Unlike existing technologies that use estimated rankings or timed offline calculations, this invention performs dynamic calculations based on the latest score data, ensuring that users see real, accurate, and real-time global rankings, significantly improving the interactive experience and fairness.
[0022] 4. Reduce storage and computing resource overhead. By using score interval partitioning and aggregation counting mechanisms, the enormous memory and CPU consumption caused by maintaining a global sort for all users is avoided. Queries are only performed on locally ordered sets when necessary, effectively saving storage space and computing resources.
[0023] This invention does not rely on specific hardware and can be quickly implemented based on mainstream non-relational databases such as Redis. It is applicable to various business scenarios such as online quizzes, game points, and e-commerce leaderboards, and has wide applicability and rapid deployment capabilities. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 A flowchart illustrating a high-performance user ranking method for large-scale applications is provided in one embodiment of this application. Figure 2 This is a general timing architecture diagram of a method provided in an embodiment of this application; Figure 3 This is a schematic diagram of the data storage structure and user ranking calculation provided in an embodiment of this application; Figure 4 A schematic diagram of a high-performance user ranking device for a large scale provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a device suitable for implementing the solutions in the embodiments of this application.
[0027] The same or similar reference numerals in the accompanying drawings represent the same or similar parts. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] In a typical configuration of this application, the terminal and the service network devices each include one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0031] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0032] Computer-readable media include permanent and non-permanent, removable and non-removable media, which can store information by any method or technology. Information can be computer program instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, read-only optical disc (CD-ROM), digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0033] In practical scenarios, the execution entity of this method can be a user device, or a device formed by integrating a user device and a network device through a network, or it can be an application running on the aforementioned devices. The user device includes, but is not limited to, various terminal devices such as computers, mobile phones, tablets, smartwatches, and wristbands. The network device includes, but is not limited to, network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, and can be used to implement some processing functions when setting an alarm clock. Here, the cloud consists of a large number of hosts or network servers based on cloud computing. Cloud computing is a type of distributed computing, consisting of a virtual computer composed of a group of loosely coupled computer sets.
[0034] Glossary: stored: High-performance non-relational storage, open source, compatible with the protocols and commands of open source storage Redis; zset: A data structure provided by stored, an ordered set where each element is associated with a score, sorted by score and supporting efficient range queries; The `get` command, stored, retrieves the value of the specified key. The `set` command (stored) sets the value of a specified key. The command `incr:stored` increments the value stored in the key by 1. The `decr:stored` command subtracts 1 from the value stored in the key. zrem: a stored command that removes a member from a sorted set (zset). zadd: The stored command adds a member element and its score to a sorted set (zset). The `zrank: stored` command returns the ranking of a given element within a sorted set.
[0035] Figure 1 This is a flowchart illustrating a high-performance user ranking method for large-scale applications, provided as an embodiment of this application. Figure 2 Here is a general timing architecture diagram of the method provided in one embodiment of this application, as follows: Figure 1 and Figure 2 As shown, the method includes at least the following processing steps: Step S101: Set the upper limit of the total score, and set multiple score intervals in an orderly manner according to the upper limit of the score.
[0036] Specifically, multiple score intervals are first set up in an orderly manner based on the score upper limit and historical data. The number of score intervals N and the design capacity M of a single interval satisfy N≈M (e.g., N=100, M=100, corresponding to a user scale of 10,000). Furthermore, N×M is close to the total number of participating users to balance interval granularity and storage efficiency, reducing "empty intervals" or "overcapacity intervals". For example, if the total number of users is 10,000, N=100 intervals can be set, with each interval having a capacity of M=100 users. The score span of a single interval is 10 points (1000 points / 100 intervals). The interval span can be dynamically adjusted (e.g., the interval span of high-score segments is reduced to 5 points), but the approximate relationship between N and M must be maintained. This not only matches the score distribution pattern but also further optimizes resource allocation by dynamically adjusting the interval span (e.g., further subdividing high-score segments).
[0037] Then, a unique identifier (UID) is associated with each user in the storage system, and the user score is stored in Redis String type with the key format user:{UID} and the value is the score (e.g., user:1001→850). The total storage amount equals the number of users, ensuring that the user score can be queried and updated in real time.
[0038] Finally, each score range is associated with an independent ordered set, which stores the user identification codes and scores of users whose scores fall within that range in real time. The key format is zset:start-end (e.g., zset:850-860), and it stores the UID and score of the users within that range. The user identification codes in each ordered set are sorted in descending order according to their corresponding scores. For example, a user with a score of 855 and UID:1001 will be added to the set zset:850-860. The zset is automatically sorted in descending order by score, supporting quick retrieval of the ranking within the range (e.g., querying the user's position within the range using the ZRANK command).
[0039] Preferably, if the number of users in a certain interval exceeds M for a long period of time (e.g., M=100 but actually reaches 150), the interval can be split into two sub-intervals (e.g., 850-855 points, 855-860 points) to maintain the balance between N and M and avoid the performance impact of a single zset being too large.
[0040] Step S102: When the target user's score changes, the target user is moved from the original score range to the new score range.
[0041] Specifically, when a target user's score changes and the new score falls within a different range than the original range, the range migration process is triggered.
[0042] First, based on the user's original score, match the score range to which it belongs (e.g., an original score of 855 corresponds to the range 850-860). Then, calculate the new range corresponding to the new score (e.g., a new score of 865 corresponds to the range 860-870). Delete the user's identification code and score record from the ordered set associated with the original range, and add the user's identification code and new score to the ordered set associated with the new range. The system automatically sorts the data in descending order by score. Finally, update the user count statistics for the corresponding range to ensure the balance between N and M is maintained.
[0043] Step S103: Calculate the real-time ranking of the target user based on the ranking of the new score range.
[0044] Specifically, first, obtain the number of high-scoring users whose scores are higher than the target user's score range. Based on the total score limit and preset range division rules (e.g., a limit of 1000 points, 100 points per range), map user scores to corresponding ranges. All ranges are arranged from low to high scores (e.g., 0-100→100-200→…→900-1000). Traverse all score ranges, compare the starting score of each range with the target user's score, and filter out all ranges whose starting scores are higher than the starting score of the target range (i.e., ranges with higher scores). Binary search can be used to locate the first starting score higher than the target range, reducing the number of traversals (complexity is O(log N), where N is the total number of ranges). Sum the number of users in all higher score ranges to obtain the total number of high-scoring users.
[0045] Then, the ranking information within the sorted set associated with the score range of the target user is obtained. Taking a user score of 785 (belonging to the range of 700-800) as an example, a Redis sorted set (zset) is used to store the users within the range. The key is rank:bucket:700 (700 is the starting score of the range), and the set elements are (user ID, score), sorted in descending order of score. Assuming that the range contains users UID1001 (785 points), UID1002 (790 points), and UID1003 (780 points), the zset storage structure is as follows: rank:bucket:700 = { UID1002: 790, UID1001: 785, UID1003: 780, ... (Other users) } Using Redis's ZREVRANK key member command, the user's 0-based index in the zset (i.e., the position when the score is sorted in descending order) is returned. For example, in the ranking above, the result returned is 1 (meaning the 2nd position, since the index starts from 0). The ranking within the interval is calculated as ZREVRANK return value + 1, and the final ranking result of the score interval is 2nd place.
[0046] Ranking within an interval is calculated based on the score sorting properties of ordered sets. The ZREVRANK or ZCOUNT command is used to quickly locate the user's relative position, and tie-breaking rules are applied to adjust the final ranking. This process has a time complexity of O(logN) (where N is the number of users within the interval), which can meet the real-time ranking needs of a very large number of users.
[0047] Finally, the number of high-scoring users is added to the ranking information to obtain the real-time ranking of the target user: Real-time ranking = Number of high-scoring users + Ranking within the interval.
[0048] The above method enables high-performance, low-latency real-time ranking calculations in ultra-large-scale user scenarios, balancing accuracy and system efficiency.
[0049] Figure 3 This is a schematic diagram of the data storage structure and user ranking calculation provided in one embodiment of this application, as shown below. Figure 3 As shown, the Redis String type is used first, with the key being uid:{user ID} and the value being a score. For example: key:"20110121", value:"510", and the total storage amount equals the number of users U.
[0050] Then, the number of users in each score range is counted. The preferred method is to divide the score range multiple times. The first-level range (coarse granularity) is: 0-400 points: 40,603 people, 400-800 points: 37,005 people. Secondary interval (subdivided into primary intervals): 0-300 points: 20,501 people, 300-400 points: 20,102 people (total 40,603 people, corresponding to primary interval 0-400 points), 400-500 points: 19,002 people, 500-800 points: 18,003 people (total 37,005 people, corresponding to primary interval 400-800 points); Three-level intervals (subdivided into two-level intervals): 0-200 points, 200-300 points, 300-350 points, 350-400 points, 400-450 points, 450-500 points, 500-600 points, 600-800 points (8 in total, total storage = N).
[0051] Each third-level interval uses a Redis zset to store the user ID and score (in descending order of score), with the key being zset:{range}, such as zset:0-200, zset:200-300, etc., and the total storage amount is N.
[0052] The user score update process then proceeds. Taking user 20110121 with a score of 510 as an example, first, the score's range is determined: 510 points belongs to the third-level range of 500-600 points, corresponding to the second-level range of 500-800 points and the first-level range of 400-800 points. Next, the number of users within the range is updated: if the user's score changes from 450 points (originally from the third-level range of 450-500 points) to 510 points, the following steps are executed: `decr range:450-500` (number of users within the range 19002 → 19001), `decr range:400-500` (19002 → 19001), `incr range:500-600` (assuming the original number of users within the range 18003 → 18004), `incr`... range: 500-800 (18003→18004); Finally, perform data migration: delete user IDs from set zset: 450-500 and add them to zset: 500-600.
[0053] Finally, real-time ranking calculation is performed. First, the number of high-scoring users is accumulated: the number of users in the score range >500-600 is 18003 (i.e., 600-800). Then, the ranking within the set corresponding to the score range is queried: in zset:500-600, the user ranking is obtained using the ZRANK command (assuming it is the 200th place, that is, there are 199 people in this range with a score >510). Finally, the total ranking is calculated: total ranking = number of users in the high-ranking range + ranking within the range, that is, 18003 + 200 = 18203.
[0054] Preferably, when users have the same score, a composite score can be constructed by combining the score and the timestamp to achieve "same score sorted by time", that is, the user who reaches the score first will be ranked higher.
[0055] Preferably, when situations such as user score update failure or interval migration anomaly occur: 1. Before updating a user's score, the system first verifies whether the user exists. If the user does not exist, an exception is thrown and the update failure status is returned.
[0056] 2. During the score update process, check whether the new score conforms to the business rules. For example, the score cannot be negative. If the rule is violated, roll back the score update operation.
[0057] 3. When a user's score changes, causing a change in their assigned interval, the system attempts to perform an interval migration operation.
[0058] 4. If the interval migration operation fails (such as database write error, network timeout, etc.), the system will immediately trigger the rollback mechanism to restore the user's score to the state before the update.
[0059] All anomalies are logged to facilitate subsequent troubleshooting and analysis of system problems. The anomaly handling mechanism ensures that the consistency and integrity of system data are guaranteed even if some operations fail. Through this transactional processing method, the system can maintain stable operation in the face of various anomalies.
[0060] The solution provided in this embodiment divides the total score range into multiple score intervals and adopts a two-level calculation mechanism of "aggregating the number of users in the high-rank interval + precise sorting within the interval". This avoids the huge memory and CPU consumption caused by maintaining a global ranking for all users, and achieves millisecond-level real-time ranking response for hundreds of millions of users, greatly improving system performance. Based on the latest score data, dynamic calculation ensures that users see a real, accurate and timely global ranking, significantly improving the interactive experience and fairness, and has wide applicability and rapid deployment capabilities.
[0061] Figure 4 A schematic diagram of a high-performance user ranking device for a large scale provided in an embodiment of this application is shown below. Figure 4 As shown, the device includes: Score range configuration module 11: Used to set the total score limit and set multiple score ranges in an orderly manner according to the score limit; Score Update Module 22: Used to migrate the target user from the original score range to the new score range when the target user's score changes; The ranking calculation module 33 is used to calculate the real-time ranking of the target user based on the ranking of the new score range.
[0062] The above-described device can execute the ultra-large-scale high-performance user ranking method in the foregoing embodiments, wherein the score interval configuration module 11 executes step S101, the score update module 22 executes step S102, and the ranking calculation module 33 executes step S103.
[0063] Based on the same inventive concept, this application also provides an electronic device. The method corresponding to the electronic device can be the ultra-large-scale high-performance user ranking method in the foregoing embodiments, and its problem-solving principle is similar to that method. The electronic device provided in this application includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the methods and / or technical solutions of the foregoing embodiments of this application.
[0064] The electronic device can be a user device, or a device formed by integrating user devices and network devices through a network, or it can be an application running on the aforementioned devices. The user device includes, but is not limited to, various terminal devices such as computers, mobile phones, tablets, smartwatches, and wristbands. The network device includes, but is not limited to, network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, and can be used to implement some processing functions when setting an alarm clock. Here, the cloud consists of a large number of hosts or network servers based on cloud computing. Cloud computing is a type of distributed computing, consisting of a virtual computer composed of a group of loosely coupled computer sets.
[0065] Figure 5 The diagram illustrates the structure of an apparatus suitable for implementing the methods and / or technical solutions in the embodiments of this application. The apparatus 1200 includes a Central Processing Unit (CPU) 1201, which can perform various appropriate actions and processes based on a program stored in a Read Only Memory (ROM) 1202 or a program loaded from a storage portion 1208 into a Random Access Memory (RAM) 1203. The RAM 1203 also stores various programs and data required for system operation. The CPU 1201, ROM 1202, and RAM 1203 are interconnected via a bus 1204. An Input / Output (I / O) interface 1205 is also connected to the bus 1204.
[0066] The following components are connected to I / O interface 1205: an input section 1206 including a keyboard, mouse, touchscreen, microphone, infrared sensor, etc.; an output section 1207 including a cathode ray tube (CRT), liquid crystal display (LCD), LED display, OLED display, etc., and speakers, etc.; a storage section 1208 including one or more computer-readable media such as hard disk, optical disk, magnetic disk, semiconductor memory, etc.; and a communication section 1209 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1209 performs communication processing via a network such as the Internet.
[0067] In particular, the methods and / or embodiments in this application can be implemented as computer software programs. For example, the embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 1201, it performs the functions defined in the methods of this application.
[0068] Another embodiment of this application provides a computer-readable storage medium having computer program instructions stored thereon, which can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of this application described above.
[0069] Specifically, this embodiment may employ any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0070] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0071] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0072] Another embodiment of this application also provides a computer program product, including a computer program that, when executed by a processor, implements a method for ultra-large-scale, high-performance user ranking.
[0073] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0074] The flowcharts or block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of devices, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-specific system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0075] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0076] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or page components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.
[0077] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0078] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0079] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
[0081] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a device claim may also be implemented by a single unit or device through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.
Claims
1. A high-performance user ranking method for ultra-large scale, characterized in that, include: Set a maximum total score, and then set multiple score ranges in an orderly manner based on the maximum score; When a target user's score changes, the target user will be moved from the original score range to the new score range; The real-time ranking of the target user is calculated by aggregating the rankings within the new score range.
2. The ultra-large-scale high-performance user ranking method according to claim 1, characterized in that, The setting of a total score ceiling and the orderly setting of multiple score intervals based on the score ceiling further include: Multiple score intervals are set in an orderly manner based on the score upper limit and historical data. The number of score intervals N and the design capacity M of a single interval satisfy N≈M, and N×M is close to the total number of participating users. Each user is associated with a unique identification code in the storage system; Each score range is associated with an independent ordered set, which stores the user identification code and score of the user whose score falls within the score range in real time. The user identification codes in each ordered set are sorted in descending order according to their corresponding scores.
3. The ultra-large-scale high-performance user ranking method according to claim 2, characterized in that, The step of migrating the target user from the original score range to the new score range when the target user's score changes includes: Obtain the original score range and the new score range of the target user; The user information and the changed scores of the target user are migrated from the ordered set associated with the original score interval to the ordered set associated with the new score interval.
4. The high-performance user ranking method for ultra-large scale according to claim 2, characterized in that, The step of aggregating and calculating the real-time ranking of the target user based on the ranking of the new score range further includes: Get the number of high-scoring users whose scores are higher than the target user's score range; Obtain the ranking information within the ordered set associated with the score range of the target user; The real-time ranking of the target user is obtained by adding the number of high-scoring users to the ranking information.
5. The high-performance user ranking method for ultra-large scale according to claim 4, characterized in that, The step of obtaining the number of high-scoring users whose scores are higher than the target user's score range further includes: By iterating through all score intervals, the starting score of each interval is compared with the target user's score. For all intervals where the starting score is greater than the target score, sum up the number of users in each interval, and the final sum is the number of high-scoring users.
6. The ultra-large-scale high-performance user ranking method according to claim 5, characterized in that, The number of traversals is proportional to the logarithm of the total number of score intervals, so that the average response time for user ranking calculation is controlled within 100 milliseconds.
7. A high-performance user ranking device with ultra-large scale, characterized in that, include: Score range configuration module: used to set the maximum total score and to set multiple score ranges in an orderly manner based on the maximum score; Score Update Module: Used to migrate the target user from the original score range to the new score range when the target user's score changes; The ranking calculation module is used to calculate the real-time ranking of the target user based on the ranking of the new score range.
8. A high-performance user ranking device with ultra-large scale, characterized in that, The device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6.
9. A computer-readable medium having computer program instructions stored thereon, characterized in that, The computer program instructions can be executed by a processor to implement the method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 6.