A multi-process outbound call control method, system, electronic device and storage medium
Through the multi-process outbound call control method and dynamic planning algorithm, outbound call lines are dynamically allocated, which solves the problem of waste of outbound call line resources, realizes efficient utilization of line resources when multiple users make outbound calls, and improves the effectiveness of outbound call tasks.
Patent Information
- Application Number
- CN202110580616.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-26
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-05-26
AI Technical Summary
In the prior art, outbound call line allocation is fixed, resulting in a waste of line resources when multiple users make outbound calls at the same time.
Adopt a multi-process outbound call control method, select the best outbound call task allocation plan through dynamic programming algorithm, dynamically allocate outbound call lines, and use Redis database queue and optimistic locking to achieve inter-process synchronization to avoid line waste.
It improves the utilization rate of outbound call lines, ensures efficient allocation of line resources when multiple users make outbound calls at the same time, and maximizes the effectiveness of outbound call tasks.
Smart Images

Figure CN113448701B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a multi-process outbound call control method, system, electronic device and storage medium. Background Art
[0002] Outbound calls are generally divided into two stages: obtaining outbound call data and initiating outbound call actions. Outbound call lines refer to the lines for outbound calls. Only with outbound call lines can you make calls to customers. In outbound call scenarios, the total number of outbound call lines is usually fixed, and the lines required for multiple users to make outbound calls at the same time are often different. The main disadvantage of the existing technology is that the allocation of lines is fixed, which often results in a waste of outbound call lines. Summary of the invention
[0003] The present invention provides a multi-process outbound call control method, system, electronic device and storage medium, which are used to solve the problem that the allocation lines are fixed in the prior art, which often causes waste of outbound call lines, and realize dynamic allocation of current outbound call lines to improve the utilization rate of outbound call lines.
[0004] The present invention provides a multi-process outbound call control method, the method comprising:
[0005] Obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously;
[0006] According to the outbound call instruction, the lock authority of the process lock used to lock the database queue is obtained, and the process that has obtained the lock authority is started. The process lock is used to control the start or block of the process. The database queue is used to store all outbound call tasks;
[0007] A list of outbound call tasks being executed and not yet executed in the database queue is obtained, and an optimal outbound call task allocation scheme is selected through a dynamic programming algorithm to allocate the outbound call task to multiple processes for execution.
[0008] According to the multi-process outbound call control method of the present invention, before obtaining multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously, the method further includes:
[0009] Store all outbound call task related information into the database queue;
[0010] Marking the execution status of all outbound call tasks in the database queue;
[0011] Among them, the relevant information of the outbound call task includes one or more combinations of the number of lines required, the total number of call phones, the creation time and the execution status. The execution status of the outbound call task includes the outbound call tasks currently being executed, the outbound call tasks that have not yet been executed, and the outbound call tasks that have been executed.
[0012] According to the multi-process outbound call control method of the present invention, the step of obtaining the lock authority of the process lock for locking the database queue according to the outbound call instruction and starting the process that obtains the lock authority includes:
[0013] Determine whether the requested database queue is locked by a process using a process lock;
[0014] If so, the process that cannot obtain the lock permission to lock the database queue will be blocked;
[0015] Otherwise, a process that obtains the lock authority to lock the database queue will be started.
[0016] According to the multi-process outbound call control method of the present invention, the step of determining whether the requested database access queue is locked by a process using a process lock includes:
[0017] According to the version number of the file used to record the process lock locking the database queue, determining whether the requested access to the database queue is locked by a certain process using the process lock;
[0018] When the file version number used to record the process lock locking the database queue is equal to the current file version number of the database queue, the database queue is allowed to execute data update and is allowed to be locked by a certain process using the process lock, and the process lock adopts optimistic lock.
[0019] According to the multi-process outbound call control method of the present invention, the obtaining of the outbound call task list that has not been executed in the database queue, and selecting the best outbound call task allocation scheme through a dynamic programming algorithm to allocate to the multi-process execution includes:
[0020] The process that obtains the lock authority reads the database queue and obtains a list of outbound call tasks that are being executed and have not yet been executed in the database queue, where the database queue uses a Redis database queue;
[0021] The solution of the optimal outbound call task allocation plan is converted into the 01 knapsack problem of the dynamic specification algorithm, that is, the total number of lines executing outbound call tasks plus the number of lines to be executed for outbound call tasks is not greater than the preset upper limit of the total number of lines, and the sum of the lines currently executing outbound call tasks is the largest when there are outbound call tasks that have not yet been executed.
[0022] According to the multi-process outbound call control method of the present invention, the calculation equation of the 01 knapsack problem is:
[0023] m[i][j]=max(m[i-1][j],m[i-1][jv[i]]+v[i]);
[0024] Wherein, m[i][j] represents the number of lines of the first i outbound call tasks, v[i] represents the number of lines of the outbound call tasks to be executed at time i, j represents the total number of lines of the outbound call tasks executed, the maximum value of j is not greater than the preset upper limit of the total number of lines, and i represents the first i outbound call tasks.
[0025] According to the multi-process outbound call control method of the present invention, after selecting the best outbound call task allocation scheme by the dynamic programming algorithm, the method further includes:
[0026] The outbound call task of the best outbound call task allocation solution in the database queue is marked as executed, and the lock authority of the process that obtains the lock authority is released.
[0027] The present invention also provides a multi-process outbound call control system, the system comprising:
[0028] A receiving module, used to obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously;
[0029] A process lock module, used to obtain the lock authority of the process lock used to lock the database queue according to the outbound call instruction, and start the process that has obtained the lock authority, the process lock is used to control the start or block of the process, and the database queue is used to store all outbound call tasks;
[0030] The dynamic planning module is used to obtain the list of outbound call tasks being executed and not yet executed in the database queue, and select the best outbound call task allocation plan through the dynamic planning algorithm to allocate it to multiple processes for execution.
[0031] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the multi-process outbound call control methods described above are implemented.
[0032] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the multi-process outbound call control methods described above.
[0033] The multi-process outbound call control method, system, electronic device and storage medium provided by the present invention solve the problem of multiple users making outbound calls at the same time by adopting multiple processes, and dynamically allocate the current outbound call lines to optimize the allocation plan and improve the utilization rate of the outbound call lines. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 It is a flowchart of the multi-process outbound call control method provided by the present invention;
[0036] Figure 2 It is a schematic diagram of the process of database queue management provided by the present invention;
[0037] Figure 3 It is a schematic diagram of the process lock provided by the present invention;
[0038] Figure 4 It is a schematic diagram of the flow of dynamic programming provided by the present invention;
[0039] Figure 5 It is a flow chart of the process after executing the outbound call task provided by the present invention;
[0040] Figure 6 It is a structural schematic diagram of the multi-process outbound call control system provided by the present invention;
[0041] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0044] In an outbound call scenario, the total number of outbound call lines is usually fixed, and the lines required by multiple users for outbound calls at the same time are often different. The existing technology allocates fixed lines to multiple users, which often results in a waste of outbound call line resources. Assuming that the total number of outbound call lines is 100 and there are 5 users making outbound calls at the same time, a fixed line is allocated to each user, for example, 20 lines are allocated to each user to perform outbound call tasks, then some users may not need 20 lines, and some users may need more than 20 lines. Therefore, in the allocation of outbound call resources, it is easy to cause a waste of outbound call line resources.
[0045] The present invention dynamically allocates the current outbound call lines by adopting multi-process synchronization and dynamic planning technology, so as to maximize the line utilization rate for the outbound call demands of all users at the same time.
[0046] Combine the following Figure 1-Figure 7 The invention describes a multi-process outbound call control method, system, electronic device and storage medium.
[0047] Figure 1 FIG. 1 is a flow chart of the multi-process outbound call control method provided by the present invention. Figure 1 A multi-process outbound call control method, the method comprising:
[0048] Step 101, obtaining multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously.
[0049] Outbound calls are generally divided into two stages, one is the acquisition of outbound call data, and the other is the initiation of outbound call actions. Therefore, when a terminal (or agent) needs to make an outbound call, it is necessary to obtain the outbound call task data from the background management system. Only after obtaining the outbound call task data can the outbound call action be initiated, that is, the outbound call task is executed.
[0050] Step 102, according to the outbound call instruction, obtain the lock authority of the process lock used to lock the database queue, and start the process that obtains the lock authority, the process lock is used to control the start or block of the process, and the database queue is used to store all outbound call tasks.
[0051] Optionally, Redis database queues and thread locks can be used to achieve synchronization between processes, so that there will be no conflicts or dirty reads when reading and applying for lines between processes to perform outbound call tasks.
[0052] Dirty read means that when a transaction is accessing data and modifying the data, but the modification has not been submitted to the database, another transaction also accesses the data and uses the data. Because the data has not been submitted, the data read by the other transaction is dirty data, and the operations performed based on the dirty data may be incorrect.
[0053] Step 103, obtaining a list of outbound call tasks being executed and not yet executed in the database queue, and selecting an optimal outbound call task allocation scheme through a dynamic programming algorithm to allocate to multiple processes for execution.
[0054] Optionally, each process may also adopt the same dynamic programming algorithm according to the remaining lines to continuously and effectively select the outbound call tasks with the best outbound call task allocation plan from the waiting tasks in the data queue (i.e., the outbound call tasks that have not yet been executed) to make calls, thereby avoiding the waste of outbound call lines and maximizing the effectiveness of outbound call tasks.
[0055] It should be noted that one line can only make one outbound call at the same time. If an outbound call task needs to make m calls, it is necessary to apply for n lines (n≥m), that is, to make m calls by using n lines.
[0056] The following will describe in detail the database queue management, process lock, and dynamic programming algorithm involved in the above steps 101 to 103.
[0057] Figure 2 It is a flowchart of the database queue management provided by the present invention, such as Figure 2 In step 101, before acquiring multiple outbound call instructions that need to execute multiple outbound call tasks simultaneously, the method further includes:
[0058] Step 201, store the relevant information of all outbound call tasks into a database queue.
[0059] Step 202: Mark the execution status of all outbound call tasks in the database queue.
[0060] Among them, the relevant information of the outbound call task includes one or more combinations of the number of lines required, the total number of call numbers, the creation time and the execution status. The execution status of the outbound call task includes the outbound call task currently being executed (i.e., the currently calling task), the outbound call task that has not yet been executed (i.e., the waiting task) and the outbound call task that has been executed (i.e., the historically completed task).
[0061] Optionally, the database queue uses a Redis database queue. Redis is an in-memory data structure storage and is often used as a database, cache, and message broker. Redis supports data structures such as strings, hashes, lists, and sets. Redis has built-in replication, Lua scripts, LRU eviction, transactions, and different levels of disk persistence, and is automatically partitioned through RedisSentinel and Redis Cluster.
[0062] Redis lists in Redis database queues are simple lists of strings, sorted in insertion order, and you can add an element to the head (left) or tail (right) of the list. A list can contain up to 2 32 -1 element (4294967295, over 4 billion elements per list).
[0063] Optionally, the Redis database queue of the present invention is queued using the lpush operation. For example, the following example uses lpush to insert three values into a list named runoobkey:
[0064]
[0065] The advantages of using the Redis database queue in the present invention are:
[0066] First, Redis has high performance. For example, Redis can read at a speed of 110,000 times / s and write at a speed of 81,000 times / s.
[0067] Secondly, Redis has a rich set of data types. For example, Redis supports binary case operations on Strings, Lists, Hashes, Sets, and Ordered Sets data types.
[0068] In addition, Redis has atomic features. For example, all Redis operations are atomic, that is, they are either executed successfully or fail and are not executed at all.
[0069] Figure 3 It is a flowchart of the process lock provided by the present invention, such as Figure 3 In step 102, the process of acquiring the lock authority of the process lock for locking the database queue according to the outbound call instruction and starting the process that has acquired the lock authority includes:
[0070] Step 301, determining whether the requested database access queue is locked by a process using a process lock.
[0071] Optionally, in the present invention, multiple processes use the same database queue together. When a process locks the database queue, the database queue cannot be accessed by other processes.
[0072] Optionally, the relevant information of the outbound call task includes one or more combinations of the number of lines required, the total number of call phones, the creation time and the execution status. The execution status of the outbound call task includes the outbound call tasks currently being executed, the outbound call tasks that have not yet been executed and the outbound call tasks that have been executed.
[0073] When multiple outbound call tasks may be executed concurrently in multiple processes, the accuracy of data in the concurrent situation needs to be guaranteed to ensure that the results obtained when the current terminal operates with other terminals are the same as the results when the current terminal operates. The purpose of concurrency control is to ensure that the work of one terminal does not have an unreasonable impact on the work of another terminal. If concurrency control is not done well, it may lead to problems such as dirty reads, phantom reads, and non-repeatable reads.
[0074] Concurrency control is generally related to database management systems (DBMS). The task of concurrency control in DBMS is to ensure that when multiple transactions access the same data in the database at the same time, the isolation, consistency and unity of the transaction are not destroyed. The main means of implementing concurrency control can be roughly divided into optimistic concurrency control and pessimistic concurrency control. Optimistic locking (a form of optimistic concurrency control) is more suitable for situations where there are more reads and fewer writes (multi-read scenarios), while pessimistic locking (a form of pessimistic concurrency control) is more suitable for situations where there are more writes and fewer reads (multi-write scenarios).
[0075] Optionally, the process lock of the present invention adopts optimistic locking. Optimistic locking is relative to pessimistic locking. Optimistic locking assumes that data will not cause conflicts under normal circumstances. Therefore, when the data is submitted for update, it will formally detect whether the data is conflicting. If a conflict is found, an error message will be returned to the user, allowing the user to decide what to do. Optimistic locking is suitable for scenarios with many read operations, which can improve the throughput of the program.
[0076] Specifically, the implementation of optimistic locking is to determine whether the requested database queue is locked by a process using the process lock based on the file version number used to record the process lock that locks the database queue; if the file version number read to record the process lock that locks the database queue is equal to the current file version number of the database queue, data update is allowed and it is allowed to be locked by a process using the process lock.
[0077] For example, optimistic locking adds a file version number field to the data table, indicating the number of times the data has been modified. When the data is modified, the version value will be increased by 1. When process A wants to update the data value, it will read the version value while reading the data. When submitting the update, it will update only if the version value just read is equal to the version value in the current database. Otherwise, the operation will be abandoned and an error message will be returned.
[0078] Therefore, through optimistic locking for concurrency control, a mechanism can be used to avoid data processing errors caused by database phantom reading, long business processing time, etc. In addition, optimistic locking does not require the use of database lock mechanisms. For example, optimistic locking's CAS (Compare and Swap) is a mechanism to solve the performance loss caused by using locks in multi-process parallel situations. When multiple processes try to use CAS to update the same variable at the same time, only one of the processes can update the value of the variable, and the other processes fail. The failed process will not be suspended, but will be informed of the failure in this competition and can try again.
[0079] Step 302: If yes, the process that cannot obtain the lock authority to lock the database queue will be blocked.
[0080] When an ongoing process cannot continue to execute due to an event, it can abandon the process and enter a suspended state, that is, the execution of the process is blocked. This suspended state is called process blocking. The process in the blocked state can also be called a waiting state or a blocked state. The one or more processes in the blocked state can be arranged in a queue, or one or more processes in the blocked state can be arranged in multiple queues according to different blocking reasons. When the execution of a process is blocked, the process blocks itself by calling a blocking command and waits for the corresponding event to occur before being awakened.
[0081] Step 303: Otherwise, a process that obtains the lock authority to lock the database queue will be started.
[0082] It should be noted that the present invention is not limited to the optimistic locking described above, and the present invention may also adopt other locking methods.
[0083] Figure 4 It is a schematic diagram of the dynamic programming process provided by the present invention, such as Figure 4 In the above step 103, the process of obtaining a list of outbound call tasks that have not been executed in the database queue and selecting the best outbound call task allocation scheme through a dynamic programming algorithm to allocate to multiple processes for execution includes:
[0084] Step 401, the process that obtains the lock authority reads the database queue, and obtains a list of outbound call tasks that are being executed and have not been executed in the database queue. The database queue uses a Redis database queue.
[0085] It should be noted that, at the same time, only one process can obtain the lock authority to lock the database queue, that is, at the same time, only one process can read and update the data in the database queue.
[0086] Specifically, the read and write strategy of the Redis database queue is:
[0087] If the value written to the database is the same as the value updated to the cache, the cache can be updated immediately without any calculation. However, this solution is not suitable for scenarios where data is written frequently but read infrequently, because data may be deleted or modified before being queried, which wastes time and resources.
[0088] If the value written to the database is inconsistent with the value updated in the cache, the data written to the cache needs to be inserted into the cache after the result of the association calculation of several tables. In this case, there is no need to update the cache immediately. Just delete the cache and insert the calculated result into the cache when querying.
[0089] Therefore, when you need to update data, delete the cached data first, and then update the database, instead of updating the cache and then updating the latest data to the cache when you need to query it.
[0090] For example, when an outbound call task needs to be updated, the currently executed outbound call task is 100, and now it needs to be updated to 99. First, the database queue is updated to 99, and then the cache is deleted. It is found that the cache deletion fails, which means that the database inventory is 99, and the cache is 100, which causes the database queue and the cache to be inconsistent. Therefore, in this case, the present invention deletes the cache first, and then updates the database queue. If the cache deletion fails, then do not update the database queue. If the cache deletion succeeds, but the database update fails, then when querying, just search for old data from the database queue, so that the consistency of the database queue and the cache can be guaranteed.
[0091] Step 402, converting the solution of the optimal outbound call task allocation solution into the 01 knapsack problem of the dynamic specification algorithm, that is, solving the problem that the total number of lines executing outbound call tasks plus the number of lines to be executed for outbound call tasks is not greater than the preset upper limit of the total number of lines, and the sum of the lines currently executing outbound call tasks is the largest when there are outbound call tasks that have not yet been executed.
[0092] The Knapsack problem is a combinatorial optimization NP-Complete (NPC) problem. The problem can be described as: given a set of items, each with its own weight and price, how to choose within the limited total weight to make the total price of the items the highest. The NPC problem has no polynomial time complexity solution, but using dynamic programming, the Knapsack problem can be solved with pseudo-polynomial time complexity. Generally speaking, the Knapsack problem has the following categories: 01 Knapsack problem; Complete Knapsack problem; Multiple Knapsack problem.
[0093] Optionally, the present invention uses the 01 knapsack problem to solve the optimal outbound call task allocation scheme. The calculation equation of the 01 knapsack problem is:
[0094] m[i][j]=max(m[i-1][j],m[i-1][jv[i]]+v[i]);
[0095] Wherein, m[i][j] represents the number of lines of the first i outbound call tasks, v[i] represents the number of lines of the outbound call tasks to be executed at time i, j represents the total number of lines of the outbound call tasks executed, the maximum value of j is not greater than the preset upper limit of the total number of lines, and i represents the first i outbound call tasks.
[0096] The above calculation equation shows that the commonly used method of dynamic programming (rolling array) can be used to optimize the space, and finally the best outbound call task allocation plan can be obtained through optimization.
[0097] For example, the upper limit of the total number of preset lines is 60, the first outbound call task is being executed, and 10 lines are applied for the first outbound call task, 40 lines are applied for the second outbound call task that has not been executed, 5 lines are applied for the third outbound call task that has not been executed, and 10 lines are applied for the fourth outbound call task that has not been executed. Then, according to the above known conditions, the best outbound call task allocation scheme is to execute the second outbound call task and the fourth outbound call task.
[0098] Another situation is that the above-mentioned known conditions of the first outbound call task, the second outbound call task, the third outbound call task and the fourth outbound call task remain unchanged. If the total number of preset lines is upper limited to 40, then the best outbound call task plan is to execute the third outbound call task and the fourth outbound call task.
[0099] In summary, each process that obtains the lock permission will use the same dynamic planning scheme according to the number of remaining lines, and continuously and effectively select the optimal task from the waiting tasks in the database queue for calling, thereby avoiding the waste of outbound call lines and maximizing the effectiveness of outbound call tasks.
[0100] Figure 5 FIG. 1 is a flow chart of the process after executing an outbound call task provided by the present invention, such as Figure 5 In step 103, after the optimal outbound call task allocation scheme is selected by the dynamic programming algorithm, the method further includes:
[0101] Step 501: Mark the outbound call task of the best outbound call task allocation solution in the database queue as executed, and release the lock authority of the process that has obtained the lock authority.
[0102] Optionally, after releasing the lock authority of the process that has acquired the lock authority, multiple processes execute the outbound call tasks of the optimal outbound call task allocation scheme.
[0103] The principle of locking and unlocking (i.e. releasing lock permissions) is that when a process enters a critical section, it will hold a certain type of lock. When other processes try to enter the critical section (lock) before the process has released the lock, they will be set to sleep and then placed in the queue of processes waiting for the lock (of a certain priority). When the lock is released, that is, when the unlock event occurs, the kernel will find a process from the priority queue of processes waiting for the lock and put it in the ready state, waiting for scheduling.
[0104] Therefore, using the Redis database synchronization queue and process lock can achieve synchronization between processes, so that there will be no conflicts or dirty reads when reading and applying for lines between processes.
[0105] The multi-process outbound call control system provided by the present invention is described below. The multi-process outbound call control system described below and the multi-process outbound call control method described above can be referenced to each other.
[0106] Figure 6 Schematic diagram of the structure of the multi-process outbound call control system provided by the present invention. Figure 6 A multi-process outbound call control system 600 includes a receiving module 610, a process locking module 620 and a dynamic planning module 630.
[0107] The receiving module 610 is used to obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously.
[0108] The process lock module 620 is used to obtain the lock authority of the process lock used to lock the database queue according to the outbound call instruction, and start the process that obtains the lock authority. The process lock is used to control the start or block of the process, and the database queue is used to store all outbound call tasks.
[0109] The dynamic planning module 630 is used to obtain a list of outbound call tasks being executed and not yet executed in the database queue, and select the best outbound call task allocation scheme through a dynamic planning algorithm to allocate it to multiple processes for execution.
[0110] Optionally, the multi-process outbound call control system 600 is further configured to perform the following steps:
[0111] Before obtaining multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously, storing relevant information of all outbound call tasks in a database queue; marking the execution status of all outbound call tasks in the database queue;
[0112] Among them, the relevant information of the outbound call task includes one or more combinations of the number of lines required, the total number of call phones, the creation time and the execution status. The execution status of the outbound call task includes the outbound call tasks currently being executed, the outbound call tasks that have not yet been executed, and the outbound call tasks that have been executed.
[0113] Optionally, the process lock module 620 is further configured to perform the following steps:
[0114] Determine whether the requested database queue is locked by a process using a process lock;
[0115] If so, the process that cannot obtain the lock permission to lock the database queue will be blocked;
[0116] Otherwise, a process that obtains the lock authority to lock the database queue will be started.
[0117] Optionally, the process lock module 620 is further configured to perform the following steps:
[0118] According to the version number of the file used to record the process lock locking the database queue, determining whether the requested access to the database queue is locked by a certain process using the process lock;
[0119] When the file version number read for recording the process lock locking the database queue is equal to the current file version number of the database queue, the database queue is allowed to execute data update and is allowed to be locked by a certain process using the process lock, and the process lock adopts optimistic lock.
[0120] Optionally, the dynamic programming module 630 is further configured to perform the following steps:
[0121] The process that obtains the lock authority reads the database queue and obtains a list of outbound call tasks that are being executed and have not yet been executed in the database queue, where the database queue uses a Redis database queue;
[0122] The solution of the optimal outbound call task allocation plan is converted into the 01 knapsack problem of the dynamic specification algorithm, that is, the total number of lines executing outbound call tasks plus the number of lines to be executed for outbound call tasks is not greater than the preset upper limit of the total number of lines, and the sum of the lines currently executing outbound call tasks is the largest when there are outbound call tasks that have not yet been executed.
[0123] Optionally, the calculation equation of the 01 knapsack problem is:
[0124] m[i][j]=max(m[i-1][j],m[i-1][jv[i]]+v[i]);
[0125] Wherein, m[i][j] represents the number of lines of the first i outbound call tasks, v[i] represents the number of lines of the outbound call tasks to be executed at time i, j represents the total number of lines of the outbound call tasks executed, the maximum value of j is not greater than the preset upper limit of the total number of lines, and i represents the first i outbound call tasks.
[0126] Optionally, the multi-process outbound call control system 600 is further configured to perform the following steps:
[0127] After the best outbound call task allocation scheme is selected by the dynamic programming algorithm, the outbound call tasks of the best outbound call task allocation scheme in the database queue are marked as executed, and the lock authority of the process that obtains the lock authority is released.
[0128] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the multi-process outbound call control method described above, and the method includes:
[0129] Obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously;
[0130] According to the outbound call instruction, the lock authority of the process lock used to lock the database queue is obtained, and the process that has obtained the lock authority is started. The process lock is used to control the start or block of the process. The database queue is used to store all outbound call tasks;
[0131] A list of outbound call tasks being executed and not yet executed in the database queue is obtained, and an optimal outbound call task allocation scheme is selected through a dynamic programming algorithm to allocate the outbound call task to multiple processes for execution.
[0132] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0133] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer can execute the multi-process outbound call control method provided by the above methods, the method comprising:
[0134] Obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously;
[0135] According to the outbound call instruction, the lock authority of the process lock used to lock the database queue is obtained, and the process that has obtained the lock authority is started. The process lock is used to control the start or block of the process. The database queue is used to store all outbound call tasks;
[0136] A list of outbound call tasks being executed and not yet executed in the database queue is obtained, and an optimal outbound call task allocation scheme is selected through a dynamic programming algorithm to allocate the outbound call task to multiple processes for execution.
[0137] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the multi-process outbound call control method provided above is implemented, and the method includes:
[0138] Obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously;
[0139] According to the outbound call instruction, the lock authority of the process lock used to lock the database queue is obtained, and the process that has obtained the lock authority is started. The process lock is used to control the start or block of the process. The database queue is used to store all outbound call tasks;
[0140] A list of outbound call tasks being executed and not yet executed in the database queue is obtained, and an optimal outbound call task allocation scheme is selected through a dynamic programming algorithm to allocate the outbound call task to multiple processes for execution.
[0141] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0142] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-process outbound call control method, characterized in that: The method comprises: Obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously; Obtaining the lock authority of the process lock for locking the database queue according to the outbound call instruction, and starting the process that has obtained the lock authority, wherein the process lock is used to control the start or block of the process, and the database queue is used to store all outbound call tasks; Obtaining a list of outbound call tasks being executed and not yet executed in the database queue, and selecting an optimal outbound call task allocation scheme through a dynamic programming algorithm to allocate to multiple processes for execution; The acquiring the lock authority of the process lock for locking the database queue according to the outbound call instruction, and starting the process that acquires the lock authority, includes: Determine whether the requested database queue is locked by a process using a process lock; if so, the process that cannot obtain the lock permission to lock the database queue will be blocked; otherwise, the process that obtains the lock permission to lock the database queue will be started; The determining whether the requested database access queue is locked by a process using a process lock includes: According to the version number of the file used to record the process lock locking the database queue, it is determined whether the requested database queue is locked by a certain process using the process lock; When the file version number used to record whether the process lock locks the database queue is equal to the current file version number of the database queue, the database queue is allowed to execute data update and is allowed to be locked by a certain process using the process lock, and the process lock adopts optimistic locking; The obtaining of a list of outbound call tasks that have not been executed in the database queue, and selecting an optimal outbound call task allocation scheme through a dynamic programming algorithm to allocate the outbound call tasks to multiple processes for execution, includes: The process that obtains the lock permission reads the database queue and obtains a list of outbound call tasks that are being executed and have not yet been executed in the database queue, where the database queue adopts a Redis database queue; The solution to the optimal outbound call task allocation scheme is converted into a 01 knapsack problem of a dynamic standard algorithm, that is, the total number of lines currently executing outbound call tasks plus the number of lines with outbound call tasks to be executed is not greater than the preset upper limit of the total number of lines, and the sum of the lines currently executing outbound call tasks is the largest when there are outbound call tasks that have not yet been executed.
2. The multi-process outbound call control method according to claim 1, characterized in that: Before obtaining multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously, the method further includes: Store all outbound call task related information into the database queue; Marking the execution status of all outbound call tasks in the database queue; Among them, the relevant information of the outbound call task includes one or more combinations of the required number of lines, the total number of call numbers, the creation time and the execution status. The execution status of the outbound call task includes the outbound call task currently being executed, the outbound call task that has not yet been executed and the outbound call task that has been executed.
3. The multi-process outbound call control method according to claim 1, characterized in that: The calculation equation of the 01 knapsack problem is: m[i][j]=max(m[i-1][j],m[i-1][jv[i]]+v[i]); Where m[i][j] represents the number of lines for the first i outbound call tasks, v[i] represents the number of lines for the outbound call tasks to be executed at time i, j represents the total number of lines for the executed outbound call tasks, and the maximum value of j is no more than the preset upper limit of the total number of lines. i represents the first i outbound call tasks.
4. The multi-process outbound call control method according to claim 1, characterized in that: After selecting the optimal outbound call task allocation scheme by the dynamic programming algorithm, the method further includes: The outbound call task of the best outbound call task allocation solution in the database queue is marked as executed, and the lock authority of the process that obtains the lock authority is released.
5. A multi-process outbound call control system, characterized in that: The system comprises: A receiving module is used to obtain multiple outbound call instructions corresponding to multiple outbound call tasks that need to be executed simultaneously; A process lock module is used to obtain the lock authority of the process lock used to lock the database queue according to the outbound call instruction, and start the process that has obtained the lock authority. The process lock is used to control the start or block of the process. The database queue is used to store all outbound call tasks; A dynamic planning module is used to obtain a list of outbound call tasks being executed and not yet executed in the database queue, and select an optimal outbound call task allocation plan through a dynamic planning algorithm to allocate the outbound call task to multiple processes for execution; The process lock module is further configured to perform the following steps: determining whether the requested database queue is locked by a process using a process lock; if so, blocking the process that does not have the lock permission to lock the database queue; otherwise, starting the process that has the lock permission to lock the database queue; Optionally, the process lock module is further configured to perform the following steps: According to the version number of the file used to record the process lock locking the database queue, it is determined whether the requested database queue is locked by a certain process using the process lock; When the file version number read for recording the process lock locking the database queue is equal to the current file version number of the database queue, the database queue is allowed to execute data update and is allowed to be locked by a certain process using the process lock, and the process lock adopts optimistic locking; Optionally, the dynamic programming module is further configured to perform the following steps: The process that obtains the lock permission reads the database queue and obtains a list of outbound call tasks that are being executed and have not yet been executed in the database queue, where the database queue adopts a Redis database queue; The solution to the optimal outbound call task allocation scheme is converted into a 01 knapsack problem of a dynamic standard algorithm, that is, the total number of lines currently executing outbound call tasks plus the number of lines with outbound call tasks to be executed is not greater than the preset upper limit of the total number of lines, and the sum of the lines currently executing outbound call tasks is the largest when there are outbound call tasks that have not yet been executed.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the multi-process outbound call control method as described in any one of claims 1 to 4 are implemented.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the multi-process outbound call control method according to any one of claims 1 to 4 are implemented.
