A method and system for dynamically maintaining skip list indexes in a high-concurrency automatic call allocation system.

By dynamically adjusting the hierarchy and using a "mark-clean-reinsert" strategy, the performance stability and concurrency efficiency issues of skip list data structures in high-concurrency and high-frequency update scenarios are resolved, achieving efficient agent management and query performance.

CN123115127APending Publication Date: 2026-11-17上海井星信息科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610987313.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-03
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing technologies, skip list data structures are prone to index structure degradation, query performance deterioration, and poor concurrent update efficiency in high-concurrency, high-frequency automatic call allocation systems, especially when agent weights are updated, lock contention is intense.

Method used

By adopting a dynamic hierarchical adjustment and "mark-clean-reinsert" strategy, the promotion probability of new agent nodes is dynamically adjusted, local index density is detected and optimization operations are triggered, and weight updates are handled by atomic operations to avoid lock contention.

Benefits of technology

Maintaining the stability and efficiency of the index structure avoids performance degradation, improves the system's throughput in high-concurrency scenarios, and reduces the difficulty of development and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123115127A_ABST
    Figure CN123115127A_ABST
Patent Text Reader

Abstract

This application provides a method and system for dynamic maintenance of skip list indexes in a high-concurrency automatic call allocation system, belonging to the field of computer data processing technology. The method aims to solve the problems of easy index structure degradation and poor update concurrency performance of skip lists in high-concurrency update scenarios in existing technologies. Based on a skip list data structure, the method includes: dynamically adjusting the promotion probability of a new agent node based on operating parameters such as the total number of agents in the system when inserting a new agent node; detecting the local index density at the newly inserted position after the insertion operation, and triggering a local index optimization operation when the density is below a threshold; and adopting a "mark-clean-reinsert" strategy when the agent node weight changes, i.e., logically marking the old node as invalid, creating and inserting a new node according to the new weight, and then asynchronously cleaning up the invalid old node by a background task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer data processing technology, and in particular to a method and system for dynamically maintaining the skip list index of a high-concurrency automatic call allocation system. Background Technology

[0002] In Automatic Call Distribution (ACD) systems, achieving efficient customer service requires real-time management of the status and priorities of a large number of agents, and the rapid selection of the most suitable agent to handle incoming calls. This necessitates that the underlying data structure support efficient dynamic sorting and searching of the agent set.

[0003] In existing technologies, some simple solutions use arrays or linked lists to manage agents, but their insertion and deletion operations have high time complexity, resulting in poor performance when the number of agents is large, making it difficult to meet the needs of high-concurrency scenarios. To optimize performance, some solutions have turned to balanced binary trees (such as red-black trees) to organize data. Although the average time complexity of their search, insertion, and deletion operations can reach logarithmic levels, the implementation logic of balanced trees is very complex. Especially in high-concurrency environments, operations such as rotations and color changes to maintain tree balance require locking a large range of nodes, which can easily lead to intense lock contention, thus severely impacting concurrency performance.

[0004] To balance performance and ease of implementation, some industry solutions have proposed using skip list data structures to manage agents. Skip lists, by building multi-level indexes, can achieve logarithmic-level expected time complexity, and their implementation and concurrency control are simpler than balanced trees. However, existing skip list applications typically employ standard algorithms that build multi-level indexes based on preset probabilities, failing to adequately consider the extreme conditions of high-frequency, dynamic updates in automatic call allocation systems. Over long-term operation, frequent node insertions and deletions can lead to uneven distribution of index levels, resulting in data skew and degrading query performance, failing to adaptively maintain the overall efficiency of the index structure. Furthermore, for the common operation of updating agent weights, directly updating in-situ within the skip list structure introduces complex locking mechanisms and a high risk of concurrency conflicts, thus becoming a performance bottleneck. Therefore, how to solve the performance stability, index balancing, and concurrent update efficiency issues of skip list data structures under long-term, high-frequency, dynamic updates is a pressing problem in the current technological field. Summary of the Invention

[0005] The purpose of this application is to solve the technical problems faced by existing technologies when using ordered data structures such as skip lists in systems such as automatic call allocation, such as index structure degradation and poor concurrent performance of update operations in high-concurrency and high-frequency update scenarios, so as to provide a method and system for dynamic maintenance of skip list indexes that can self-optimize, have stable performance and high concurrency efficiency.

[0006] To achieve the above objectives, this application provides a method and system for dynamic maintenance of skip list indexes in a high-concurrency automatic call allocation system. The system is applied to a skip list data structure, which is a multi-level ordered linked list storing agent nodes sorted by weight. The method includes: when inserting a new agent node into the skip list, performing a dynamic level adjustment step to dynamically adjust the promotion probability of the new agent node to a higher index level based on at least one preset system operating parameter; after the insertion operation, performing an insertion-time index balancing step to detect the local index density at the newly inserted position; if the detected local index density is lower than a preset density threshold, triggering a local index optimization operation; when the weight of an agent node already existing in the skip list changes, performing a weight update concurrency optimization step. This step adopts a "mark-clean-reinsert" strategy, including: logically marking the old node representing the agent node as invalid using atomic operations; creating and inserting a new agent node based on the updated weight; and having a background task clean up the old node marked as invalid.

[0007] Optionally, the system operating parameters include at least one of the following: the current total number of seats in the system; the operating frequency of the seat nodes within a preset time window.

[0008] Optionally, in the dynamic hierarchical adjustment step, the adjustment of the promotion probability includes: setting the promotion probability to a predetermined value based on the total number of seats, wherein the predetermined value is determined according to a preset rule, which makes the expected total number of hierarchical levels of the skip list a value that is the logarithm of the total number of seats and rounded up.

[0009] Optionally, the detection of local index density includes: detecting the number of nodes contained in the next level between the new agent node and its adjacent index nodes at the level where the new agent node is located.

[0010] Optionally, the density threshold is 8 nodes.

[0011] Optionally, the optimization operation of the local index includes at least one of the following: temporarily increasing the promotion probability of nodes in the local area; or forcibly performing an index reconstruction on some nodes in the local area.

[0012] Optionally, the background task is a separate, periodically executed cleanup thread.

[0013] Optionally, the base layer of the skip list data structure is a doubly linked list.

[0014] This application also provides a dynamic maintenance system for skip list indexes in a high-concurrency automatic call allocation system, including a data storage module for constructing and maintaining a multi-level ordered linked list (i.e., a skip list data structure) in memory that stores agent nodes sorted by weight; a dynamic level adjustment module for dynamically adjusting the promotion probability of a new agent node to a higher index level based on at least one preset system operating parameter when performing an insertion operation into the skip list maintained by the data storage module, wherein the system operating parameter includes the current total number of agents in the system; and an index balancing module for detecting the level of the newly inserted agent node after performing the insertion operation. The local index density at the newly inserted position is monitored by measuring the number of nodes contained in the next level between the new insertion point and its adjacent index nodes. When the monitored local index density is lower than a preset density threshold, a local index optimization operation is triggered. The optimization operation includes temporarily increasing the promotion probability of nodes in the local area and / or forcibly performing an index reconstruction on some nodes in the local area. The node update processing module is used to execute a "mark-clean-reinsert" strategy when the weight of an agent node that already exists in the skip list maintained by the data storage module changes. This strategy uses atomic operations to mark the old node, insert the new node, and interact with a background cleanup task to clean up the old node.

[0015] Optionally, the system is a client / server architecture, wherein the skip list data structure is maintained by a central server, which responds to requests from multiple clients to perform the insertion operation and functions performed by the index balancing module and the node update processing module.

[0016] Compared with the prior art, this application has the following beneficial effects: 1. Stable performance and avoidance of degradation. Through dynamic hierarchical adjustment mechanism and index balancing mechanism during insertion, this application enables the skip list index structure to maintain a near-optimal balance in long-term operation with constantly changing data volume and operation mode, effectively avoiding performance degradation caused by data skew and ensuring the stability of logarithmic time complexity.

[0017] 2. Improved concurrency performance. By adopting a "mark-sweep-reinsert" strategy to handle node weight updates, a complex and lock-conflict-prone "in-place update" operation is decomposed into low-cost atomic marking and efficient insertion operations. This greatly reduces lock contention between write operations and significantly improves the system throughput in high-concurrency, high-frequency update scenarios.

[0018] 3. Simple implementation and maintenance. Compared to the logically complex balanced binary tree, the core logic of this application based on skip lists is more intuitive. Furthermore, through the above optimizations, complex concurrency control logic is avoided, reducing the difficulty of development and maintenance and improving the robustness of the system. Attached Figure Description

[0019] Figure 1 This application provides an embodiment of an architecture diagram of a skip list index dynamic maintenance system for a high-concurrency automatic call allocation system. Figure 2 This is a flowchart illustrating a method for dynamically maintaining the skip list index of a high-concurrency automatic call allocation system, as provided in an embodiment of this application.

[0020] The main reference numerals in the attached diagrams are explained as follows: 10 - Automatic call allocation application server; 20 - Skip list index dynamic maintenance system; 21 - Dynamic hierarchy adjustment module; 22 - Index balancing module; 23 - Node update processing module; 24 - Data storage module; 30 - Background cleanup task; S101 - Receive operation instructions; S102 - Determine operation type; S200 - Insertion process; S201 - Dynamically calculate hierarchy; S202 - Link nodes; S203 - Check and trigger index balancing; S300 - Update process; S301 - Mark old nodes as invalid; S302 - Create and insert new nodes. Detailed Implementation To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and specific embodiments. It is understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of protection of this application.

[0021] Example 1 This embodiment provides a method for dynamically maintaining the skip list index in a high-concurrency automatic call allocation system and a specific implementation scheme of the system, in order to illustrate the core technical ideas including dynamic hierarchical adjustment, index balancing during insertion, and the "mark-clean-reinsert" update strategy.

[0022] Please see Figure 1 This illustration shows a schematic diagram of the architecture of a skip list index dynamic maintenance system for a high-concurrency automatic call allocation system according to one embodiment of this application. The system can be deployed on one or more servers, and its overall architecture can be centralized or distributed. As a specific application scenario, in a client / server architecture, the system can be maintained by a central server to respond to requests from multiple clients.

[0023] like Figure 1As shown, the system mainly includes an automatic call distribution application server 10, a jump list index dynamic maintenance system 20, and a background cleanup task 30. The automatic call distribution application server 10, as the carrier of business logic, is responsible for handling the core business of the call center, such as receiving incoming calls, managing agent status (e.g., idle, busy, post-call handling), and executing call routing decisions. When it is necessary to operate on the ordered set of agents, such as when an agent becomes idle and needs to be added to the queue, or when a call ends resulting in a change in agent weight, the automatic call distribution application server 10 issues corresponding operation instructions to the jump list index dynamic maintenance system 20.

[0024] The skip list index dynamic maintenance system 20 is the core of the technical solution of this application. As a high-performance agent priority management module, it works closely with the automatic call distribution application server 10. This system 20 internally contains several collaborative logical modules: The core of the data storage module 24 lies in building and maintaining a multi-level ordered linked list, or skip list data structure, in the server's memory. This skip list is specifically used to store agent nodes arranged in descending or ascending order of weight. Each agent in the system is identified by a unique agent ID and associated with a real-time changing weight score. This weight score is calculated by the ACD system based on various factors (such as agent skill level, wait time, historical service quality, etc.) to determine the priority of agents handling incoming calls. The data storage module 24 is responsible for all physical operations on the skip list nodes, such as node creation, linking, and removal. In a specific implementation, the maximum level of this skip list can be preset to a fixed value, such as 32 or 64, which is sufficient to handle scenarios with a large number of agents. In addition to containing the agent ID and weight score, each node in the skip list also contains a pointer to the next node in the base level, and an array of pointers, where each pointer in the array points to the next node in the corresponding index level.

[0025] The dynamic hierarchy adjustment module 21 is responsible for performing dynamic hierarchy calculations when inserting a new agent node into the skip list. Unlike traditional skip lists that use a fixed promotion probability, this module dynamically adjusts the probability of a new node being promoted to a higher index level based on one or more preset system operating parameters (such as the current total number of agents or the frequency of recent operations). This allows the overall structure of the skip list to adapt to changes in data size, maintaining the efficiency of the index.

[0026] The index balancing module 22 is used to actively monitor and maintain the balance of the index after an insertion operation. It detects the local index density at the newly inserted location. If it finds that the index in a certain area is too sparse and may lead to a decrease in query efficiency, the module will trigger a local index optimization operation to prevent data skew and ensure the uniformity of the index distribution across all levels.

[0027] The node update processing module 23 is specifically designed to handle agent weight updates. It implements the "mark-clean-reinsert" concurrency optimization strategy proposed in this application. When a weight update instruction is received from the automatic call allocation application server 10, this module does not search the skip list and directly modify the node's weight value. Instead, it decomposes the update operation into a series of low-conflict sub-operations, thereby greatly improving the system's concurrency processing capability.

[0028] Background cleanup task 30 can be implemented as an independent, low-priority background thread or process. This task works in conjunction with the node update processing module 23, periodically or when the system load is low, traversing the skip list and physically removing nodes marked as invalid, thereby reclaiming memory space. Through this asynchronous cleanup mechanism, the high overhead of deletion operations can be amortized over the entire lifecycle of the system, avoiding performance impact on critical business paths.

[0029] The following will combine Figure 2 The flowchart shown illustrates the working process of this embodiment in detail.

[0030] The process begins at step S101, where the skip list index dynamic maintenance system 20 receives an operation instruction from the automatic call allocation application server 10. This instruction can be for agent online (insertion), agent offline (deletion), or agent status change (weight update).

[0031] In step S102, the system determines the instruction type.

[0032] If the instruction is "insert", then the insertion process S200 is initiated. This scenario corresponds to an agent becoming idle and needing to be added to the available agent pool. For example, for agent "Agent007", whose initial weight score is 100, the automatic call to the allocation application server 10 invokes the insertion interface of the skip list index dynamic maintenance system 20. First, in step S201, the level is dynamically calculated, at which point the dynamic level adjustment module 21 is invoked. Assuming the total number of agents in the current system is 2000 and the recent operation frequency is stable, this module calculates a suitable promotion probability according to preset rules, such as p=0.25, and generates a random level number for the new node "Agent007" based on this probability, such as 4. This means that the new node will appear in levels 0 to 4 of the skip list. Subsequently, in step S202, the node is linked, and the actual node insertion operation is performed by the data storage module 24. This module searches downwards from the highest level of the skip list, finding the correct predecessor node for the new node at each level from level 4 to level 0. Then, it creates a new agent node containing the agent ID "Agent007", a weight of 100, and a forward pointer array of size 5. Finally, by modifying the forward pointers of the predecessor nodes at each level and the new node's forward pointer, the new node is linked to the skip list from level 0 to level 4. After the node linking is complete, in step S203, the index balancing module 22 checks the insertion point and triggers index balancing. It analyzes how many nodes are contained in level 3 between the newly inserted node and its predecessor node at level 4. In this basic embodiment, assuming the check results indicate that the local index density is within a reasonable range and has not reached the threshold for triggering optimization, the process ends normally.

[0033] If the instruction is "delete," for example, in a call allocation process, the automatic call allocation application server 10 retrieves the agent with the highest current weight (i.e., the first valid node in the basic linked list of the skip list) from the skip list index dynamic maintenance system 20 by calling getMax() or a similar interface, and decides to allocate it to the incoming call. Afterward, the automatic call allocation application server 10 issues an instruction to delete that agent. Accordingly, the skip list index dynamic maintenance system 20 performs a standard skip list deletion operation, that is, finds the agent node at each level of the index and removes it from the linked list.

[0034] If the instruction is "update", the update process S300 is initiated. This scenario is extremely frequent. For example, after a call, agent "Agent007" accumulates more call time, causing its weight score to drop from 100 to 95. When the automatic call allocation application server 10 issues an update instruction, the node update processing module 23 initiates a "mark-clean-reinsert" strategy. First, in step S301, the old node is marked as invalid. The system finds the old node representing agent "Agent007" with a weight of 100 in the skip list, but does not modify its weight value. Instead, it atomically sets a logical flag (e.g., a boolean field named valid) within the node to false. This marking operation is extremely lightweight and has almost no risk of concurrent conflicts. At this point, the old node is logically invalid, and subsequent lookup operations will skip it. Then, in step S302, a new node is created and inserted. The system will create a new agent node with the same agent ID "Agent007" but a new weight of 95, and treat this as an independent insertion operation. It will then fully execute the aforementioned insertion process S200 (including dynamic calculation of hierarchy, linking nodes, checking index balance, etc.) and insert it into the correct position in the skip list.

[0035] In this way, a high-conflict-risk "update" operation is broken down into a low-conflict "mark" operation and an efficient "insert" operation. Meanwhile, background cleanup task 30 starts at a preset interval (e.g., every 10 seconds), traversing the base linked list of the skip list. When it encounters a node marked as false, it performs a physical deletion operation, safely removing it from all levels of the linked list and reclaiming its memory.

[0036] Through the aforementioned structure and process, even under high-pressure environments with thousands of agent status changes per second, the system can complete agent insertion, deletion, and optimal agent selection within milliseconds. Furthermore, thanks to dynamic adjustment and balancing mechanisms, system performance does not degrade over extended periods of operation.

[0037] Example 2 Based on Embodiment 1, this embodiment further deepens and refines the internal implementation logic of the dynamic hierarchy adjustment module 21 and the index balancing module 22 to demonstrate how the solution of this application achieves stronger adaptability and performance stability.

[0038] First, the specific logic of the dynamic hierarchy adjustment module 21 in executing step S201 (dynamically calculating the hierarchy) is explained. In a standard skip list implementation, the hierarchy of a new node is usually determined by a fixed promotion probability p (such as 0.5 or 0.25) through a cyclic coin toss. Although this method is simple, it may cause a large deviation between the actual number of levels in the skip list and the theoretically optimal number of levels when the amount of data changes drastically.

[0039] In a preferred implementation of this application, the dynamic level adjustment module 21 internally maintains a target level. The target number of tiers is related to the current total number of seats N in the system, and its calculation formula can be... ,in The base promotion probability is (e.g., 0.25). More simply, if the desired number of nodes per level is twice that of the previous level, the target number of levels can be approximated as... The dynamic hierarchy adjustment module 21 periodically or before each insertion operation will obtain the actual maximum number of levels in the current skip list. The total number of nodes, N.

[0040] When calculating the new node hierarchy, this module will compare And calculated based on the latest N value Scenario 1: If For example, the number of seats surged from 2000 to 8000 during the initial system startup, causing L_target to increase from approximately 11 ( ) becomes 13 ( ), while the actual maximum number of levels in the current skip list It might still be stuck at 12. This indicates that the skip list's index height is insufficient, potentially affecting query efficiency. In this case, the dynamic hierarchy adjustment module 21 will temporarily increase the promotion probability p of this insertion operation, for example, by fine-tuning it from the basic 0.25 to 0.28 or higher, giving the newly inserted node a greater chance of being promoted to a higher index level, thereby accelerating the skip list structure to match the new data scale. Scenario 2: If This situation may occur after a large number of agents have been deleted, indicating the existence of redundant, almost empty top-level indexes. In this case, the module can slightly reduce the promotion probability, or use an appropriate mechanism to remove empty top-level indexes in a timely manner when deleting nodes.

[0041] In this way, the dynamic hierarchy adjustment module 21 no longer simply generates hierarchy randomly, but is guided by macro-control objectives, ensuring that the overall structure of the skip list always maintains a healthy logarithmic relationship with the data scale, providing a solid foundation for performance stability.

[0042] Secondly, the specific logic of the index balancing module 22 when executing step S203 (checking and triggering index balancing) is explained. This step is used to solve the problem of local data skew in skip lists.

[0043] Following the insertion operation in Example 1, the index balancing module 22 is activated, which needs to quantify the "local index density." According to a specific definition in this application, local index density can be measured by detecting how many nodes are contained in the next level i-1 between the newly inserted node x and its direct predecessor index node prev_i at a level i. This number is referred to as the "span."

[0044] For example, suppose the system inserts a new node at level 3. The index balancing module 22 checks how many nodes exist in the level 2 linked list between the new node and its predecessor node at level 3. If traversing the level 2 linked list reveals a span of 10 nodes, while the system's preset density threshold is 8, it indicates that the index is too sparse between these two index nodes at level 3. Any search operation that needs to cross this area cannot be accelerated at level 3 and must be reduced to a longer linear traversal at level 2, which is a precursor to performance degradation.

[0045] Accordingly, the index balancing module 22 can trigger a "local index optimization operation." This optimization operation can take several forms: One method is "forced promotion." The system can select one or more nodes (e.g., the middle node) within the 10 spans and force its promotion to level 3. This is equivalent to creating a new index node in the middle of the existing long span, decomposing a large span into two smaller, healthier spans (e.g., one with 4 nodes and one with 5 nodes). This forced promotion operation can be accomplished by modifying the level of the selected node and updating the corresponding pointer. Another method is "temporarily increasing the local promotion probability." The system can mark this area containing 10 nodes and temporarily and significantly increase the probability of its promotion to level 3 or higher when a new node is subsequently inserted into this area. This is a more flexible adjustment strategy, hoping that subsequent insertion operations will naturally fill the index gaps.

[0046] Through this low-cost local check and immediate repair performed on each insertion, the index balancing module 22 can proactively combat the problem of uneven data distribution caused by dynamic updates, ensuring that any query path is as flat and short as possible, thereby maintaining the overall efficiency of the index structure.

[0047] Example 3 This embodiment demonstrates a high-performance implementation scheme based on lock-free programming technology, particularly in a multi-core processor environment, showcasing how atomic operations are used to implement the "mark-sweep-reinsert" strategy described in Embodiment 1, thereby improving concurrency performance. This embodiment can be considered a specific and optimized implementation of the node update processing module 23 and the data storage module 24.

[0048] In traditional lock-based concurrency control, any modification to a skip list (insertion, deletion, update) requires acquiring the lock of the corresponding node. If the operation involves multiple nodes, multiple locks may be needed, which can easily lead to thread blocking and performance bottlenecks under high concurrency. This embodiment completely abandons mutex locks and instead uses atomic instructions such as "compare and swap" provided by modern processors.

[0049] First, the skip list node structure maintained in data storage module 24 is adapted. Understandably, when implementing in languages ​​like C++ or Java, the node pointer fields (such as the `next` and `forward` arrays) and the logical deletion flag (`valid`) should all use types that support atomic operations. For example, in Java, the `forward` pointer array can be defined as `AtomicReference`. <node>The [] type allows you to define the logical deletion flag as an AtomicBoolean or implement it by wrapping a flag bit in an AtomicReference.

[0050] Based on this data structure, each step of the "mark-sweep-reinsert" strategy needs to be re-examined: 1. Marking: When the node update processing module 23 needs to mark an old node as invalid (corresponding to...) Figure 2 Instead of step S301 in the previous section, this module will modify an atomic reference pointing to the node itself or its value via a compare-and-swap operation. A common lock-free deletion technique is to point the node's next or forward pointer to a special "deleted" marker object, or to set the least significant bit of the pointer (if address-aligned) to 1 to indicate deletion. More directly, if the node has an atomic reference with a valid state, the marking operation is a compare-and-swap operation that attempts to atomically update its state from "valid" to "invalid," for example: while (!oldNode.valid.compareAndSet(true,false));. This operation is atomic and non-blocking. Other threads, while traversing, will ignore a node once they find its state to be "invalid" through an atomic read operation.

[0051] 2. Reinsertion: When a new node needs to be inserted (corresponding to...) Figure 2 Step S302 in the code (linking node operations) (step S202) must also be lock-free. This is usually the most complex part of a lock-free skip list implementation. To insert a new node `newNode` after the predecessor node `prevNode` at level `i`, the forward pointer of `prevNode` at level `i` needs to be updated atomically. This process can be roughly described as follows (pseudocode): `do { / / Read the next node currently pointed to by the predecessor node `oldNext` = prevNode.forward[i].get(); / / Set the forward[i] of the new node to this old next node `newNode.forward[i].set(oldNext); / / Attempt to atomically update the forward[i] of the predecessor node from `oldNext` to `newNode`} while (!prevNode.forward[i].compareAndSet(oldNext,newNode));` This compare-and-swap loop ensures that the update succeeds only if the `prevNode.forward[i]` pointer has not been modified by other threads. If other threads modify it during this time, `compareAndSet` will fail, and the loop will retry, reading the latest `oldNext` value and trying again. This avoids the use of locks and allows multiple insert operations to be performed in parallel on different parts of the skip list.

[0052] 3. Cleanup: Background cleanup task 30 must also be thread-safe when physically removing nodes marked as invalid. Physically deleting a node d essentially means setting the forward pointer of its predecessor node p to the successor node s of d. This operation is also done through a compare-and-swap loop. The cleanup thread first locates the invalid node d and its predecessor node p, and then attempts to execute p.forward[i].compareAndSet(d, d.forward[i].get()). It should be noted that the complexity of this operation lies in the fact that the predecessor node p itself may also be marked as deleted by other threads. Therefore, a robust cleanup process needs to start from a known valid node, carefully handle logically deleted nodes in the linked list, and atomically "bypass" them.

[0053] By fully employing atomic operations such as compare and swap, the skip list index dynamic maintenance system 20 constructed in this embodiment, especially its core data storage module 24 and node update processing module 23, can achieve high parallelism in a multi-core CPU environment. Multiple threads can simultaneously perform read, insert, and logical delete operations on the skip list with almost no blocking due to waiting for locks. The overall throughput of the system, especially during peak ACD business periods with many reads and writes and frequent concurrency conflicts, shows a significant performance improvement compared to lock-based implementations, fully demonstrating the technical effectiveness of this application in high-concurrency scenarios.

[0054] Example 4 This embodiment provides a system-level solution for implementing the core ideas of this application using an existing in-memory database (such as Redis). This solution aims to illustrate the universality and engineering feasibility of the technical ideas presented in this application, and is particularly suitable for scenarios requiring rapid productization or where it is desirable to rely on mature components to ensure system stability.

[0055] In this embodiment, the automatic call allocation application server 10 does not need to implement the skip list data structure from scratch in the application memory. Instead, it delegates the functionality of the skip list index dynamic maintenance system 20 to an external, dedicated in-memory data storage system. The widely used Redis is used as an example here.

[0056] The system architecture remains the same. Figure 1 As shown, the implementation differs internally. The skip list index dynamic maintenance system 20 still exists logically, but the functions of its internal dynamic hierarchy adjustment module 21, index balancing module 22, and data storage module 24 are actually performed by a Redis server instance and its client library. The automatic call allocation application server 10 communicates with the Redis server through a Redis client.

[0057] Redis provides a data structure called a "sorted set," where each member is associated with a score, and Redis sorts all members based on this score. At its underlying implementation, Redis's sorted sets, when dealing with a large number of elements, conveniently employ a combination of skip lists and hash tables, which aligns perfectly with the technical foundation of this application.

[0058] The following details how to utilize Redis sorted sets to implement the core business process of this application, and maps the key technical features of this application: 1. Data Storage and Initialization: In Redis, an ordered set can be used to represent the agent queuing pool in the ACD system, for example, with the key name agent_queue. Each agent is represented by a unique member string, such as "Agent007", and its weight score is used as the member's score.

[0059] 2. Agent Online / Insertion Operation: When an agent (e.g., AgentID "Agent007", weight Score 100) becomes idle, the automatic call allocation application server 10 can send a ZADD command to Redis: ZADD agent_queue 100 "Agent007". After receiving this command, Redis will automatically insert "Agent007" into the correct position in the sorted set. Redis's internal skip list implementation handles all the details of node creation, hierarchical allocation, and links.

[0060] 3. Call Assignment / Obtaining the Best Agent: When a call requires agent assignment, the automatic call assignment application server 10 needs to obtain the agent with the highest current weight. A higher weight score indicates higher priority, so the ZREVRANGE command can be executed to obtain the member with the highest score: ZREVRANGE agent_queue 0 0. This command immediately returns the ID of the agent ranked first in the current ordered set. After obtaining the agent ID, to remove it from the queue pool, the automatic call assignment application server 10 then executes the ZREM command: ZREM agent_queue "Agent007". This combination of commands efficiently implements the "obtain and remove the best" operation.

[0061] 4. Equivalent Implementation of the "Mark-Sweep-Reinsert" Strategy for Weight Updates: One of the core innovations of this application is the "Mark-Sweep-Reinsert" strategy for handling weight updates. In Redis, this strategy can be greatly simplified, but its core principles are retained. When the weight of agent "Agent007" changes from 100 to 95, the automatic call allocation application server 10 only needs to execute one ZADD command again: ZADD agent_queue 95 "Agent007". The characteristic of the ZADD command is that if the specified member already exists in the sorted set, it will directly update the member's score and automatically adjust its position in the skip list to maintain order. This operation is atomic internally in Redis. In effect, this single ZADD update operation is equivalent to "reinserting" a node with a new score in this application. Given that Redis can guarantee the atomicity and efficiency of operations, it naturally solves the problem of concurrent updates, avoiding the need for the application layer to implement complex "Mark-Sweep" logic. Redis's internal skip list implementation already handles all the complexities of node position changes.

[0062] 5. Implementation of Dynamic Adjustment and Balancing Mechanisms: The performance stability issues addressed by the dynamic hierarchical adjustment module 21 and index balancing module 22 in this application are also reflected in the Redis implementation. As a mature database product, Redis's skip list implementation already includes balancing and optimization strategies. Although users cannot finely intervene in promotion probabilities or trigger local rebuilds as in Example 2, Redis's general implementation is robust enough to maintain near-optimal performance under various data sizes and operational loads. Therefore, by adopting Redis, its built-in advanced dynamic maintenance capabilities can be directly utilized.

[0063] This embodiment demonstrates that the core technical idea proposed in this application—namely, managing ordered sets through a skip list structure that supports dynamic optimization and improving concurrency by decomposing update operations—can be implemented not only through low-level code but also by cleverly utilizing advanced, off-the-shelf system components. This solution significantly simplifies the development workload of the automatic call allocation application server 10, reduces system complexity and maintenance costs, while simultaneously enjoying the additional benefits of high performance, high availability, and persistence offered by industrial-grade data storage systems, thus reflecting the engineering practical value of the technical solution presented in this application.

[0064] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.< / node>

Claims

1. A method for dynamic maintenance of skip list index of a high concurrency automatic call distribution system, applied to a skip list data structure, the skip list data structure being a multi-level ordered linked list storing agent nodes ordered by weight, characterized in that, The method includes: When inserting a new agent node into the skip list, a dynamic hierarchy adjustment step is performed to dynamically adjust the promotion probability of the new agent node to a higher index level based on at least one preset system operating parameter. After the insertion operation is performed, an insertion index balancing step is performed to detect the local index density at the new insertion position. If the detected local index density is lower than the preset density threshold, a local index optimization operation is triggered. When the weight of an agent node that already exists in the skip list changes, a weight update concurrent optimization step is performed. The step adopts a "mark-clean-reinsert" strategy, which includes: logically marking the old node representing the agent node as invalid using atomic operations, creating and inserting a new agent node according to the updated weight, and cleaning up the old node marked as invalid by a background task.

2. The method of claim 1, wherein, The system operating parameters include at least one of the following: The current total number of seats in the system; The frequency of agent node operations within a preset time window.

3. The method of claim 2, wherein, In the dynamic hierarchical adjustment step, the adjustment of the promotion probability includes: Based on the total number of seats, the promotion probability is set to a predetermined value, wherein the predetermined value is determined according to a preset rule, which makes the expected total number of levels in the skip list the value of the logarithm of the total number of seats and rounded up.

4. The method according to claim 1, characterized in that, The detected local index density includes: Detect the number of nodes contained in the next level between the new agent node and its adjacent index nodes at the same level.

5. The method according to claim 4, characterized in that, The density threshold is 8 nodes.

6. The method according to claim 1, characterized in that, The optimization operations for the local index include at least one of the following: Temporarily increase the promotion probability of nodes within this local area; Force an index rebuild to be performed on a subset of nodes within this local area.

7. The method according to claim 1, characterized in that, The background task is an independent, periodically executed cleanup thread; and the basic layer of the skip list data structure is a doubly linked list.

8. The method according to claim 1, characterized in that, In the weight update concurrency optimization step, the operation of logically marking the old node representing the agent node as invalid is achieved by modifying the logical flag inside the old node using atomic operations.

9. A dynamic maintenance system for skip list indexes in a high-concurrency automatic call allocation system, comprising a data storage module, wherein the data storage module is used to construct and maintain a multi-level ordered linked list, i.e., a skip list data structure, in memory, storing agent nodes sorted by weight; characterized in that, The system also includes: The dynamic hierarchy adjustment module is used to dynamically adjust the promotion probability of the new agent node to a higher index level according to at least one preset system operating parameter when performing an insertion operation of a new agent node into a skip list maintained by the data storage module. The system operating parameter includes the current total number of agents in the system. The index balancing module is used to monitor the local index density at the newly inserted agent node by detecting the number of nodes contained in the next level between the newly inserted agent node and its adjacent index nodes after the insertion operation is performed. When the monitored local index density is lower than a preset density threshold, a local index optimization operation is triggered. The optimization operation includes temporarily increasing the promotion probability of nodes in the local area and / or forcibly performing an index reconstruction on some nodes in the local area. The node update processing module is used to execute a "mark-clean-reinsert" strategy when the weight of an agent node that already exists in the skip list maintained by the data storage module changes. This strategy uses atomic operations to mark the old node, insert the new node, and interacts with a background cleanup task to clean up the old node.

10. The system according to claim 9, characterized in that, The system is a client / server architecture, wherein the skip list data structure is maintained by a central server, which responds to requests from multiple clients to perform the insertion operation and functions performed by the index balancing module and the node update processing module.