CN113438177A - Method and device for limiting number outbound, electronic equipment and storage medium - Google Patents

Method and device for limiting number outbound, electronic equipment and storage medium Download PDF

Info

Publication number
CN113438177A
CN113438177A CN202110694030.7A CN202110694030A CN113438177A CN 113438177 A CN113438177 A CN 113438177A CN 202110694030 A CN202110694030 A CN 202110694030A CN 113438177 A CN113438177 A CN 113438177A
Authority
CN
China
Prior art keywords
outbound
time period
preset
thread
preset time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110694030.7A
Other languages
Chinese (zh)
Inventor
彭佩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202110694030.7A priority Critical patent/CN113438177A/en
Publication of CN113438177A publication Critical patent/CN113438177A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/29Flow control; Congestion control using a combination of thresholds
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L15/00Speech recognition
    • G10L15/26Speech to text systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/6245Modifications to standard FIFO or LIFO
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M3/00Automatic or semi-automatic exchanges
    • H04M3/42Systems providing special services or facilities to subscribers
    • H04M3/50Centralised arrangements for answering calls; Centralised arrangements for recording messages for absent or busy subscribers ; Centralised arrangements for recording messages
    • H04M3/51Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing
    • H04M3/5175Call or contact centers supervision arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M3/00Automatic or semi-automatic exchanges
    • H04M3/42Systems providing special services or facilities to subscribers
    • H04M3/50Centralised arrangements for answering calls; Centralised arrangements for recording messages for absent or busy subscribers ; Centralised arrangements for recording messages
    • H04M3/51Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing
    • H04M3/5183Call or contact centers with computer-telephony arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M3/00Automatic or semi-automatic exchanges
    • H04M3/42Systems providing special services or facilities to subscribers
    • H04M3/50Centralised arrangements for answering calls; Centralised arrangements for recording messages for absent or busy subscribers ; Centralised arrangements for recording messages
    • H04M3/51Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing
    • H04M3/523Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing with call distribution or queueing
    • H04M3/5232Call distribution algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M3/00Automatic or semi-automatic exchanges
    • H04M3/42Systems providing special services or facilities to subscribers
    • H04M3/50Centralised arrangements for answering calls; Centralised arrangements for recording messages for absent or busy subscribers ; Centralised arrangements for recording messages
    • H04M3/51Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing
    • H04M3/523Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing with call distribution or queueing
    • H04M3/5232Call distribution algorithms
    • H04M3/5234Uniform load distribution

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention relates to the field of big data, and discloses a method and a device for limiting number outbound, an electronic device and a storage medium, wherein the method comprises the following steps: receiving an outbound request aiming at any outbound number to be outbound within a preset time period, and acquiring a timestamp corresponding to the outbound request; generating a time identification code of the outbound number based on the preset time period and the timestamp; and judging whether the outbound number is allowed to be outbound according to the time identification code and a preset number, wherein the preset number represents an outbound number threshold value allowing outbound in the preset time period. The invention also relates to a block chain technology, and the outbound number is written into the block chain node. The invention solves the technical problem that the scheme for limiting the number outbound in the related technology has the risk of code intrusion.

Description

Method and device for limiting number outbound, electronic equipment and storage medium
Technical Field
The invention relates to the field of big data, in particular to a method and a device for limiting number outbound, electronic equipment and a storage medium.
Background
At present, in the actual production process, cost factors are considered, and in order to ensure that the access number resources can be utilized to the maximum extent, the access number resources are required to be put into the next production immediately after being used up; however, in this case, if production problems such as call restriction occur, the outbound result is returned quickly, the access number resource is released quickly and used in the next round, if the outbound rate is too fast and exceeds the capability of the server, more call restriction occurs, the dialing rate is faster, and the like, and some uncontrollable situations may occur in the server under a vicious circle. For example, a server may be unresponsive or directly down; because of the particularity of the outbound call, it is necessary to ensure that the subsequent service must have a response after the customer is connected, otherwise, the phenomenon of harassing the customer is caused, which is fatal to the service industry, and therefore, the outbound rate must be controlled, so that the overall outbound rate is in a stable state.
In the related art, the existing relatively mature token bucket algorithm, such as token bucket algorithm, can effectively limit traffic and play a role in peak elimination, but the framework is relatively heavy, a Google packet needs to be introduced, and the algorithm depends on some open source technologies and has certain intrusiveness on codes. Therefore, the existing outbound limiting scheme has the technical problem that the outbound rate cannot be stably controlled due to the code intrusion risk.
In view of the above problems in the related art, no effective solution has been found at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for limiting number outbound, electronic equipment and a storage medium, which at least solve the technical problem that the scheme for limiting number outbound has the risk of code intrusion in the related technology.
According to an embodiment of the present invention, there is provided a method of restricting number callouts, including: receiving an outbound request aiming at any outbound number to be outbound within a preset time period, and acquiring a timestamp corresponding to the outbound request; generating a time identification code of the outbound number based on the preset time period and the timestamp; and judging whether the outbound number is allowed to be outbound according to the time identification code and a preset number, wherein the preset number represents an outbound number threshold value allowing outbound in the preset time period.
Optionally, the obtaining the timestamp corresponding to the outbound request includes: setting a long value of a first atom update long integer AtomicLong object as a clock variable, wherein the initial value of the first atom update long integer is the current time; when an outbound thread of the outbound number is called, updating the long integer AtomicLong object's Long value updated by the first atom to be the current timestamp; and reading the current time stamp, and taking the current time stamp as the time stamp of the outbound request.
Optionally, the generating the time identification code of the outbound number based on the preset time period and the timestamp includes: and generating the time identification code of the outbound request according to the ratio of the timestamp to the preset time period.
Optionally, writing the outbound number into a blockchain node, and determining whether to allow outbound call to the outbound number according to the time identifier and the preset number includes: binding the time identification code with the outbound thread corresponding to the outbound number; and determining whether the outbound number is allowed to be outbound in the preset time period or not according to the number of the outbound thread calls in the preset time period and the preset number.
Optionally, the determining, according to the number of calls of the outbound thread in the preset time period and the preset number, whether the outbound number is allowed to be called in the preset time period includes: setting a long value of a second atom update long integer AtomicLong object as the number of times of calling an outbound thread, wherein the initial value of the second atom update long integer is zero; when the outbound thread is called, updating the long integer AtomicLong object updated by the second atom to be the calling times of the current outbound thread corresponding to the outbound thread, wherein the long integer AtomicLong object updated by the second atom is added with 1 in the accumulation manner when one outbound thread is called each time in the preset time period; comparing the calling times of the current outbound thread with the preset number; if the calling times of the current outbound thread are less than or equal to the preset number, allowing the outbound number to be outbound within the preset time period; and if the calling times of the current outbound thread are greater than the preset number, pausing the outbound call of the outbound number in the preset time period.
Optionally, if the number of times of calling the current outbound thread is greater than the preset number, the method further includes: determining a first timestamp for calling the outbound thread in the next time period of the preset time period; calculating a first time identification code of the outbound number according to the next time period and the first timestamp; and determining whether the outbound number is allowed to be outbound in the next time period or not according to the first time identification code and the preset number.
Optionally, if the number of times of calling the current outbound thread is greater than the preset number, the method further includes: storing the outbound thread to a target first-in first-out queue; and determining whether the outbound number is allowed to be outbound in the next time period of the preset time period or not according to the first-in first-out sequence of the target first-in first-out queue and the preset number.
According to an embodiment of the present invention, there is provided an apparatus for restricting out-calling of a number, including: the system comprises a processing module, a time stamp acquisition module and a processing module, wherein the processing module is used for receiving an outbound request aiming at any outbound number to be outbound in a preset time period and acquiring the time stamp corresponding to the outbound request; the generating module is used for generating a time identification code of the outbound number based on the preset time period and the timestamp; and the judging module is used for judging whether the outbound number is allowed to be outbound or not according to the time identification code and the preset number, wherein the preset number represents the outbound number threshold allowed to be outbound in the preset time period.
Optionally, the processing module includes: the atomic update long-integer AtomicLong object setting unit is used for setting a long value of a first atomic update long-integer AtomicLong object as a clock variable, wherein the initial value of the first atomic update long-integer is the current time; the updating unit is used for updating the long integer AtomicLong object's Long value as the current timestamp when the outbound thread of the outbound number is called; and the first determining unit is used for reading the current timestamp and taking the current timestamp as the timestamp of the outbound request.
Optionally, the generating module includes: and the generating unit is used for generating the time identification code of the outbound request according to the ratio of the timestamp to the preset time period.
Optionally, the outbound number is written into a block chain node, and the determining module includes: the binding unit is used for binding the time identification code with the outbound thread corresponding to the outbound number; and the second determining unit is used for determining whether the outbound number is allowed to be outbound within the preset time period or not according to the number of times of calling the outbound threads within the preset time period and the preset number.
Optionally, the second determining unit includes: the setting subunit is used for setting the long value of a second atom update long integer AtomicLong object as the number of calling the outbound thread, wherein the initial value of the second atom update long integer is zero; the updating subunit is configured to update the long integer atomic update atomic long integer long object to be the current calling times of the calling thread corresponding to the calling thread when the calling thread is called, where the long value of the long integer atomic update atomic long object is added by 1 each time one calling thread is called within the preset time period; a comparison subunit, configured to compare the number of times of calling the current outbound thread with the preset number; the processing subunit is used for allowing the outbound number to be outbound within the preset time period when the calling times of the current outbound thread are less than or equal to the preset number; and when the calling times of the current outbound thread are greater than the preset number, pausing the outbound of the outbound number in the preset time period.
Optionally, when the number of calls of the current outbound thread is greater than the preset number, the apparatus further includes: the first determining module is used for determining a first timestamp for calling the outbound thread in the next time period of the preset time period; the calculation module is used for calculating a first time identification code of the outbound number according to the next time period and the first timestamp; and the second determining module is used for determining whether the outbound number is allowed to be outbound in the next time period or not according to the first time identification code and the preset number.
Optionally, when the number of calls of the current outbound thread is greater than the preset number, the apparatus further includes: the storage module is used for storing the outbound thread to a target first-in first-out queue; and the third determining module is used for determining whether the outbound number is allowed to be outbound in the next time period of the preset time period or not according to the first-in first-out sequence of the target first-in first-out queue and the preset number.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to a further embodiment of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps in any of the apparatus embodiments described above when executed.
According to the method and the device, the time identification code of the outbound number is generated according to the timestamp corresponding to the outbound request and the preset time period aiming at the outbound request of any outbound number to be outbound in the preset time period, whether the outbound number is allowed to be outbound in the preset time period is judged according to the time identification code and the preset number, and therefore the outbound number of the number outbound in the preset time period can be controlled.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a block diagram of a hardware structure of a computer terminal to which a method for restricting number outbound according to an embodiment of the present invention is applied;
fig. 2 is an outbound flow diagram providing an application scenario of limiting number outbound according to an embodiment of the present invention;
FIG. 3 is a flow diagram of a method of restricting out-calling of numbers according to an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating operation of a restricted number outbound based rate controller according to an embodiment of the present invention;
fig. 5 is a flow chart illustrating an outbound call flow for limiting number outbound calls provided in accordance with an embodiment of the present invention;
fig. 6 is a block diagram of an apparatus for restricting out-calling of numbers according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method provided by the embodiment of the invention can be executed in a mobile terminal, a server, a computer terminal or a similar operation device. Taking the operation on the computer terminal as an example, fig. 1 is a block diagram of a hardware structure of a method for limiting number outbound in an embodiment of the present invention applied to the computer terminal. As shown in fig. 1, the computer terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the method for limiting number outbound in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory, and may also include volatile memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
Fig. 2 is an outbound flow chart of an application scenario for limiting number outbound according to an embodiment of the present invention, and as shown in fig. 2, the outbound flow includes the following steps:
step S201, obtaining an idle access number from an access number resource pool;
step S202, a list is fished;
step S203, judging whether the list has a list to be called out or not; if not, ending the operation; if yes, executing step S204, and calling out the client through the telephone platform;
step S205, judging whether the list calls through the telephone platform; if not, feeding back to the list to form a closed loop, executing the step S202, fishing the list, and circularly calling; if the call is on, step S206 is executed, and the telephone platform makes an external call based on the broadcast call operation;
step S207, collecting client Speech, performing ASR (Automatic Speech Recognition) Speech text escaping, and transferring the term Speech of the client Speech into text;
step S208, performing NLP (Natural language processing) text escaping and entering a sub-process;
step S209, acquiring the sub-flow content, forming TTS (Text-To-Speech, i.e. from Text To Speech) voice broadcast To the client, and finally ending.
Based on the above conventional outbound process, when the list is large enough, the steps S202 to S205 form a dead loop, and once the number of access numbers is too large, the pressure of the downstream server increases and the downstream server runs short, thereby affecting the whole process.
The embodiment of the invention controls the outbound rate by controlling the number of the outbound numbers dialed in unit time (namely a preset time period). Fig. 3 is a flowchart of a method for restricting number outbound according to an embodiment of the present invention, as shown in fig. 3, the flowchart includes the following steps:
step S302, receiving an outbound request aiming at any outbound number to be outbound within a preset time period, and acquiring a timestamp corresponding to the outbound request;
optionally, the preset time period is set to be 1 second, if 20 outbound requests are received within 1 second, a global clock can be maintained through the background thread to obtain a timestamp corresponding to each outbound request within the preset time period, wherein each outbound request carries an outbound number.
Step S304, generating a time identification code of the outbound number based on a preset time period and the timestamp;
in the present embodiment, by generating a unique ID (i.e., the above-mentioned time identification code) for each outbound number in a unit time (i.e., a preset time period), the time IDs generated in the unit time are guaranteed to be consistent no matter how many outbound requests are called in the unit time.
And step S306, judging whether the outbound number is allowed to be outbound according to the time identification code and a preset number, wherein the preset number represents an outbound number threshold value allowed to be outbound in a preset time period.
In this embodiment, if balanced dialing numbers are required, it may be considered that the preset time period is shortened, and the upper limit number (i.e. the preset number) is controlled, where the shorter the preset time period is, the more balanced and stable the dialing rate per second is; in addition, if the preset time period is shorter, more keys (key values) are generated, which results in that the occupied memory is increased, so that the balance consideration needs to be made, and the expired keys need to be deleted in time.
It is emphasized that the outgoing number may also be stored in a node of a block chain in order to further ensure privacy and security of the outgoing number.
The method for limiting the number outbound provided by the embodiment of the invention generates the time identification code of the outbound number according to the timestamp corresponding to the outbound request and the preset time period aiming at the outbound request of any outbound number to be outbound in the preset time period, and judges whether the outbound number is allowed to be outbound in the preset time period according to the time identification code and the preset number, thereby being capable of controlling the outbound number of the number outbound in the preset time period.
In an optional embodiment of the present disclosure, obtaining a timestamp corresponding to the outbound request includes: setting a long value of a first atom update long integer AtomicLong object as a clock variable, wherein the initial value of the first atom update long integer is the current time; when an outbound thread of an outbound number is called, updating the long integer AtomicLong object's Long value updated by the first atom to be the current timestamp; and reading the current time stamp, and taking the current time stamp as the time stamp of the outbound request.
Preferably, the long integer AtomicLong member variable (i.e. the Long value of the AtomicLong object) is updated by maintaining an atom, and the value is initialized to the current time; then maintaining a regularly scheduled background thread (namely an outbound thread), and setting a cycle per millisecond or per second (namely the preset cycle time) to execute once; when the thread is scheduled, executing a set method of the AtomicLong object, and directly updating the set method to the current timestamp; and other threads can obtain the more accurate current timestamp by the get method of the AtomicLong object when obtaining the time.
According to the embodiment, under the condition of high concurrency, if a system is called concurrently, currenttimeMillis ()// current system time is obtained, a global clock is frequently requested, contention among threads can be caused, performance is problematic, and efficiency can be affected. Alternatively, the preset time period may depend on whether the traffic requires a precision of milliseconds.
In an optional embodiment of the present disclosure, the generating the time identification code of the outbound number based on the preset time period and the timestamp includes: and generating the time identification code of the outbound request according to the ratio of the time stamp to the preset time period.
In an example of this embodiment, the current timestamp is divided by a unit time (i.e. a preset time period), and rounded, and the corresponding time ID of the outbound request is generated, and the time ID of each outbound request in the unit time is the same, if N represents a configurable cycle time and T represents the current time, the time ID generation algorithm is: (f) (id) ═ T + N-1)/N; (round up). For example, if the current time T is 3.6 seconds and the preset period N is 1 second, f (id) ═ T + N-1/N ═ 3.6+1-1/1 ═ 4.
In one embodiment of the present disclosure, writing the outbound number into the blockchain node, and determining whether to allow the outbound number to be outbound according to the time identification code and the preset number includes: binding the time identification code with the outbound thread corresponding to the outbound number; and determining whether the outbound number is allowed to be outbound or not within a preset time period according to the number of calling times of the outbound threads and the preset number within the preset time period.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In this embodiment, the time identifier is bound to the corresponding outbound thread, and each outbound thread is allowed to pass through the verified token, that is, whether to release or suspend processing on the outbound thread is determined by the time identifier.
Preferably, determining whether the outbound number is allowed to be outbound within the preset time period according to the number of calls of the outbound thread within the preset time period and the preset number includes: setting the long value of a second atom update long integer AtomicLong object as the number of times of calling an outbound thread, wherein the initial value of the second atom update long integer is zero; when the outbound thread is called, updating the long integer AtomicLong object updated by the second atom to be the calling times of the current outbound thread corresponding to the outbound thread, wherein the long integer AtomicLong object updated by the second atom is added with 1 in the accumulation mode when one outbound thread is called every time in a preset time period; comparing the calling times of the current outbound thread with a preset number; if the calling times of the current outbound threads are less than or equal to the preset number, the outbound numbers are allowed to be outbound within a preset time period; and if the calling times of the current outbound thread are more than the preset number, pausing the outbound of the outbound number in a preset time period.
Preferably, the number of calling times for calling the outbound thread in a preset time period is counted through atomic operation, and then whether to release the outbound thread or suspend processing is judged based on the outbound quantity threshold value of the outbound allowed in the preset time period.
In one example, each time the outbound thread is called, the outbound thread corresponding to the obtained outbound number binds the generated time identification code to the outbound thread, that is, the time identification code is marked in the callback thread, and the outbound threads corresponding to each same time identification code are accumulated. Specifically, according to a time identification code on the threaded outbound, a corresponding k-v (key value) is found in the map, And v polling is accumulated by CAS atomic operation (fully called Compare And Set, which is a mechanism for solving performance loss caused by using a lock under the condition of multithread parallelism, And the thread safety can be realized by adopting the atomic operation, so that the locking bulkiness is avoided) until the v polling is successful; if the current v value is successful, judging whether the current v value exceeds a threshold value (namely the preset number) set by the system, if so, performing delay processing on redundant outbound threads, namely putting redundant outbound numbers into the next time period for delay calling, then re-acquiring a new round of time identification codes, and performing the same operation until the outbound threads are passed or delayed again.
In an application scenario of the scheme, if the redis distributed cache is used, the outbound threads with the same time identification code can be accumulated by an incr () method, the data structure of the map is correspondingly changed into a hash structure, and then the number outbound is carried out by adopting the embodiment of the invention. Because the redis is a single thread, all threads are queued for operation, only one thread is allowed to operate at a time, and the method is naturally thread-safe, and therefore, the concurrency problem does not need to be considered.
In an optional embodiment of the present disclosure, if the number of calls of the current outbound thread is greater than the preset number, the method further includes: determining a first timestamp for calling an outbound thread in the next time period of a preset time period; calculating a first time identification code of the outbound number according to the next time period and the first time stamp; and determining whether the outbound number is allowed to be outbound in the next time period or not according to the first time identification code and the preset number. In this embodiment, if the number of calls for calling the outbound thread in the current time period has reached the threshold, the part of the outbound thread exceeding the threshold is delayed to the next time period for processing, so as to achieve the purpose of controlling the number of outbound calls in unit time.
In this embodiment, when the delay is reached to the next time period, the accumulation operation is directly performed on the time ID in the next time period again, and the calling of the outbound thread corresponding to the redundant outbound number is allowed, and the redundant outbound number is called until the upper limit is reached or the next period is entered. The next time period refers to the next iteration of the preset time period, for example, 5 seconds is taken as a time period, the same time period exists between 0 and 5 seconds, the time identification codes generated in the time period are the same, the next time period starts from 6 seconds, the corresponding time identification code is regenerated at the moment, and the time identification code generated in the next time period is different from the time identification code generated in the previous time period.
Preferably, if the number of calls of the current outbound thread is greater than the preset number, the method further includes: storing the outbound thread to a target first-in first-out queue; and determining whether the outbound number is allowed to be outbound in the next time period of the preset time period or not according to the first-in first-out sequence and the preset number of the target first-in first-out queue.
When the number of outbound threads reaches a threshold value (namely the preset number), a queuing mechanism is carried out, a FIFO queue (namely the target first-in first-out queue) is generated, when the outbound threads are blocked in the last time period, redundant outbound threads enter the FIFO queue, and after the outbound threads enter the next time period, the outbound threads in the FIFO queue are preferentially led to pass through according to the sequence of the first-in first-out, so that the fairness is ensured; the longer the queue length is, the more the number of outbound threads represents waiting, and under the condition that the threshold is the same, the more the number of threads represents the larger the request amount, the higher the busyness of the system, the downstream expansion concurrency capability or the upstream restriction list amount (namely the outbound number) should be considered, and the number of access numbers can be reduced or the concurrency capability of the downstream system can be expanded through the number, so that the blocked outbound threads are ensured to be in a reasonable range, and the stability of the system is ensured.
The invention will be further illustrated with reference to a specific embodiment:
fig. 4 is a schematic diagram of the operation of the rate controller based on the restricted number outbound according to the embodiment of the present invention, and as shown in fig. 4, the generated time identifier is bound to the corresponding outbound thread, which is a token that is used by each outbound thread to pass through the verification of the rate controller, and the rate controller determines whether to pass through or delay the outbound thread according to the time identifier.
In this example, the rate controller includes at least two functional blocks, one for assigning time identification codes and one for controlling the rate (i.e., controlling the number of outbound threads passed). The structure of the rate controller is represented by map in k-v format, k stores the generated time identification code (namely time id), and v stores the accumulated number of outbound threads with the same time id; each time an outbound thread passes through the rate controller, an id is generated according to (T + N-1)/N (N is a configurable cycle time) and bound to the outbound thread's local variable.
The id generator (i.e. for distributing id) and the filter (i.e. for controlling speed) are actually a filter device added before the outgoing call, each outgoing call thread represents a number to be called, each outgoing call thread needs to pass through the filter before requesting the outgoing call, and whether the outgoing call thread is to enter the block (i.e. delay) is judged according to the result returned by the filter.
As shown in fig. 4, in the case of concurrent request access, the controller performs current limiting by controlling the passing rate of the request, so as to achieve a relatively stable state. For example, assuming that three threads (i.e., the outbound thread) access, and that the threads corresponding to the request one and the request two are in the same cycle 1N (i.e., the preset time cycle), based on f (id) ═ T + N-1)/N, the id generated by the request one and the id generated by the request two (i.e., the time identification code) are both 1; the outbound thread corresponding to the request three arrives in the next period 2N, and id is 2; then, the set threshold value is that only 1 outbound thread is allowed to pass in unit cycle time N, the outbound thread 1 firstly operates through CAS, the value with id being 1 is accumulated, the obtained new value is 1, the threshold value range is met, and therefore a first request can pass; the same outbound thread 2 updates the value to 2 by CAS, but the value exceeds the threshold, so this thread blocks N time, and then enters the second cycle 2N to acquire id 2 again, but in this cycle, the outbound thread 3 may precede the outbound thread 2 to update the value of id 2 to 1, and then the outbound thread 3 normally passes through, and the 2 thread is blocked again for N time until the third cycle 3N, and then the outbound thread will not pass through smoothly without contention. This implementation is unfair to threads, with the possibility that later threads will pass before previously blocked threads; the operation of sharing resources is realized under the condition of no locking under the concurrent condition, the resource waste caused by lock competition is greatly reduced, and simultaneously, because of non-fair competition, a queuing mechanism for ensuring fairness is avoided, and the overhead of a system is reduced.
Based on the foregoing embodiments, for example, fig. 5 is an outbound flow chart of limiting number outbound according to an embodiment of the present invention, and as shown in fig. 5, the outbound flow includes the following steps:
step S501, obtaining an idle access number from an access number resource pool;
step S502, a list is fished;
step S503, judging whether the list has a list of outgoing calls (i.e. an outgoing call number) or not; if not, ending the operation; if yes, executing step S504, and determining a timestamp of receiving the outbound request within a preset time period through the outbound controller; generating a time ID of the outbound number based on a preset time period and the timestamp, and binding the time ID on an outbound thread corresponding to the outbound number; calling out the calling number according to the time ID, the threshold (namely the preset number) and the calling-out thread; if the accumulated times of the outbound threads exceed the threshold value, delaying the outbound process of redundant outbound numbers to the next preset time period, forming a queuing mechanism in the next unit time (namely the next time period), and carrying out outbound according to the first-in first-out sequence; if not, executing step S506, and the rate controller (i.e. the outbound controller) performs normal outbound work through the outbound process corresponding to the outbound request;
step S507, judging whether a list which is not called exists through the telephone platform, if not, returning to the step S502; if yes, executing step S508 to broadcast the speech;
step S509, collecting client dialects, conducting ASR voice text escape, and converting the client speech terminology into texts;
step S510, performing NLP text escape, and entering a sub-process;
and step S511, acquiring the sub-process content, forming TTS voice broadcast to the client, and finally ending.
By controlling the outbound number of the outbound number dialed in unit time, when the requests are sent concurrently, the problem that the pressure of a downstream server rises and even the pressure of the downstream server is rushed due to dead circulation formed by outbound of the retrieved list caused by excessive access number (namely the number of outbound threads) is solved.
Through the embodiment of the invention, the calling rhythm is controlled at the outbound source, and the method mainly aims at the problems that the outbound volume is too large, part of lists can limit calling due to some reasons, the result is returned quickly, the calling volume rises in unit time to some extent, once the system load is reached, the service is unavailable, more quick return errors are formed, the server crosses the outbound call limit, and even the server directly does peak-eliminating control under the condition of no response or downtime, so that the request volume in unit time is effectively and dynamically controlled; if some call-limiting conditions occur, the number of times of calling in the period time is limited, the overload of a downstream server is avoided, and simultaneously, the Java Jdk source code can be directly called without introducing other jar packets, so that the reconstruction cost and the code intrusion are very low, and the operation is simple; the outbound frequency can not fluctuate along with the call, so that the server is more stable, and the stability of the whole service is improved.
Based on the method for restricting number outbound provided in the foregoing embodiments, based on the same inventive concept, the present embodiment further provides a device for restricting number outbound, where the device is used to implement the foregoing embodiments and preferred embodiments, and the description that has been made is omitted for brevity. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 6 is a block diagram of an apparatus for restricting out-calling of numbers according to an embodiment of the present invention, as shown in fig. 6, the apparatus includes: the processing module 60 is configured to receive an outbound request for any outbound number to be outbound within a preset time period, and obtain a timestamp corresponding to the outbound request; a generating module 62, connected to the processing module 60, for generating a time identification code of the outbound number based on a preset time period and a timestamp; and the judging module 64 is connected to the generating module 62 and is configured to judge whether the outbound number is allowed to be outbound according to the time identifier and a preset number, where the preset number represents an outbound number threshold allowed to be outbound in a preset time period.
It is emphasized that the outgoing number may also be stored in a node of a block chain in order to further ensure privacy and security of the outgoing number.
Optionally, the processing module 60 includes: the setting unit is used for setting the long value of the AtomicLong object of the first atom update long integer as a clock variable, wherein the initial value of the first atom update long integer is the current time; the updating unit is used for updating the long integer AtomicLong object's Long value as the current timestamp when calling the outbound thread of the outbound number; and the first determining unit is used for reading the current time stamp and taking the current time stamp as the time stamp of the outbound request.
Optionally, the generating module 62 includes: and the generating unit is used for generating the time identification code of the outbound request according to the ratio of the timestamp to the preset time period.
Optionally, the outbound number is written into the blockchain node, and the determining module 64 includes: the binding unit is used for binding the time identification code with the outbound thread corresponding to the outbound number; and the second determining unit is used for determining whether the outbound number is allowed to be outbound within the preset time period according to the number of calling times of the outbound threads within the preset time period and the preset number.
Optionally, the second determining unit includes: the setting subunit is used for setting the long value of the second atom updating long integer AtomicLong object as the number of calling the outbound thread, wherein the initial value of the second atom updating long integer is zero; the updating subunit is used for updating the long integer AtomicLong object updating long value of the second atom to be the current calling times of the calling thread corresponding to the calling thread when the calling thread is called, wherein the long value of the long integer AtomicLong object updating long value of the second atom is added by 1 in an accumulated manner when one calling thread is called each time in a preset time period; the comparison subunit is used for comparing the calling times of the current outbound thread with the preset number; the processing subunit is used for allowing the outbound number to be outbound within a preset time period when the calling times of the current outbound thread are less than or equal to the preset number; and when the calling times of the current outbound thread are more than the preset number, pausing the outbound of the outbound number in a preset time period.
Optionally, when the number of calls of the current outbound thread is greater than the preset number, the apparatus further includes: the first determining module is used for determining a first timestamp for calling the outbound thread in the next time period of the preset time period; the calculation module is used for calculating a first time identification code of the outbound number according to the next time period and the first time stamp; and the second determining module is used for determining whether the outbound number is allowed to be outbound in the next time period or not according to the first time identification code and the preset number.
Optionally, when the number of calls of the current outbound thread is greater than the preset number, the apparatus further includes: the storage module is used for storing the outbound thread to the target first-in first-out queue; and the third determining module is used for determining whether the outbound number is allowed to be outbound in the next time period of the preset time period or not according to the first-in first-out sequence and the preset number of the target first-in first-out queues.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, receiving an outbound request aiming at any outbound number to be outbound within a preset time period, and acquiring a timestamp corresponding to the outbound request;
s2, generating a time identification code of the outbound number based on the preset time period and the timestamp;
and S3, judging whether the outbound number is allowed to be outbound according to the time identification code and a preset number, wherein the preset number represents an outbound number threshold value allowed to be outbound in the preset time period.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
It is emphasized that the outgoing number may also be stored in a node of a block chain in order to further ensure privacy and security of the outgoing number.
Based on the above embodiments of the method shown in fig. 3 and the apparatus shown in fig. 6, in order to achieve the above object, an embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a memory 72 and a processor 71, where the memory 72 and the processor 71 are both disposed on a bus 73, the memory 72 stores a computer program, and the processor 71, when executing the computer program, implements the method of restricting number callouts shown in fig. 2.
Based on such understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a memory (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present invention.
Optionally, the device may also be connected to a user interface, a network interface, a camera, Radio Frequency (RF) circuitry, sensors, audio circuitry, a WI-FI module, and so forth. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., a bluetooth interface, WI-FI interface), etc.
It will be understood by those skilled in the art that the structure of an electronic device provided in the present embodiment does not constitute a limitation of the physical device, and may include more or less components, or some components in combination, or a different arrangement of components.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for restricting out-calling of numbers, comprising:
receiving an outbound request aiming at any outbound number to be outbound within a preset time period, and acquiring a timestamp corresponding to the outbound request;
generating a time identification code of the outbound number based on the preset time period and the timestamp;
and judging whether the outbound number is allowed to be outbound according to the time identification code and a preset number, wherein the preset number represents an outbound number threshold value allowing outbound in the preset time period.
2. The method of claim 1, wherein the obtaining the timestamp corresponding to the outbound request comprises:
setting a long value of a first atom update long integer AtomicLong object as a clock variable, wherein the initial value of the first atom update long integer is the current time;
when an outbound thread of the outbound number is called, updating the long integer AtomicLong object's Long value updated by the first atom to be the current timestamp;
and reading the current time stamp, and taking the current time stamp as the time stamp of the outbound request.
3. The method of claim 1, wherein generating the time identification code for the outbound number based on the preset time period and the timestamp comprises:
and generating the time identification code of the outbound request according to the ratio of the timestamp to the preset time period.
4. The method of claim 1, wherein writing the outbound number into a blockchain node, and wherein determining whether to allow outbound calling of the outbound number based on the time identifier and a predetermined number comprises:
binding the time identification code with the outbound thread corresponding to the outbound number;
and determining whether the outbound number is allowed to be outbound in the preset time period or not according to the number of the outbound thread calls in the preset time period and the preset number.
5. The method according to claim 4, wherein the determining whether the outbound number is allowed to be outbound within the preset time period according to the number of outbound thread calls within the preset time period and the preset number comprises:
setting a long value of a second atom update long integer AtomicLong object as the number of times of calling an outbound thread, wherein the initial value of the second atom update long integer is zero;
when the outbound thread is called, updating the long integer AtomicLong object updated by the second atom to be the calling times of the current outbound thread corresponding to the outbound thread, wherein the long integer AtomicLong object updated by the second atom is added with 1 in the accumulation manner when one outbound thread is called each time in the preset time period;
comparing the calling times of the current outbound thread with the preset number;
if the calling times of the current outbound thread are less than or equal to the preset number, allowing the outbound number to be outbound within the preset time period; and if the calling times of the current outbound thread are greater than the preset number, pausing the outbound call of the outbound number in the preset time period.
6. The method of claim 5, wherein if the number of calls of the current outbound thread is greater than the predetermined number, the method further comprises:
determining a first timestamp for calling the outbound thread in the next time period of the preset time period;
calculating a first time identification code of the outbound number according to the next time period and the first timestamp;
and determining whether the outbound number is allowed to be outbound in the next time period or not according to the first time identification code and the preset number.
7. The method of claim 5, wherein if the number of calls of the current outbound thread is greater than the predetermined number, the method further comprises:
storing the outbound thread to a target first-in first-out queue;
and determining whether the outbound number is allowed to be outbound in the next time period of the preset time period or not according to the first-in first-out sequence of the target first-in first-out queue and the preset number.
8. An apparatus for restricting out-calling of numbers, comprising:
the system comprises a processing module, a time stamp acquisition module and a processing module, wherein the processing module is used for receiving an outbound request aiming at any outbound number to be outbound in a preset time period and acquiring the time stamp corresponding to the outbound request;
the generating module is used for generating a time identification code of the outbound number based on the preset time period and the timestamp;
and the judging module is used for judging whether the outbound number is allowed to be outbound or not according to the time identification code and the preset number, wherein the preset number represents the outbound number threshold allowed to be outbound in the preset time period.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer storage medium on which a computer program is stored, characterized in that the computer program, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110694030.7A 2021-06-22 2021-06-22 Method and device for limiting number outbound, electronic equipment and storage medium Pending CN113438177A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110694030.7A CN113438177A (en) 2021-06-22 2021-06-22 Method and device for limiting number outbound, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110694030.7A CN113438177A (en) 2021-06-22 2021-06-22 Method and device for limiting number outbound, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113438177A true CN113438177A (en) 2021-09-24

Family

ID=77757152

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110694030.7A Pending CN113438177A (en) 2021-06-22 2021-06-22 Method and device for limiting number outbound, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113438177A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8594315B1 (en) * 2006-10-03 2013-11-26 Avaya Inc. Speed dial administration based on call history
US20150082313A1 (en) * 2013-09-15 2015-03-19 Sandisk Technologies Inc. Apparatuses and methods for generating event codes including event source
CN108200180A (en) * 2018-01-08 2018-06-22 武汉斗鱼网络科技有限公司 A kind of method, apparatus and computer equipment for being used to limit request frequency
CN110536024A (en) * 2019-07-30 2019-12-03 平安科技(深圳)有限公司 Calling-out method, device, medium and computer equipment
CN111479021A (en) * 2020-03-18 2020-07-31 深圳追一科技有限公司 Outbound method, device, computer equipment and computer readable storage medium
CN112202938A (en) * 2020-10-12 2021-01-08 广州品唯软件有限公司 ID generation method, device and system
US20210099573A1 (en) * 2019-09-30 2021-04-01 Ringcentral, Inc. System and method of caller verification

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8594315B1 (en) * 2006-10-03 2013-11-26 Avaya Inc. Speed dial administration based on call history
US20150082313A1 (en) * 2013-09-15 2015-03-19 Sandisk Technologies Inc. Apparatuses and methods for generating event codes including event source
CN108200180A (en) * 2018-01-08 2018-06-22 武汉斗鱼网络科技有限公司 A kind of method, apparatus and computer equipment for being used to limit request frequency
CN110536024A (en) * 2019-07-30 2019-12-03 平安科技(深圳)有限公司 Calling-out method, device, medium and computer equipment
US20210099573A1 (en) * 2019-09-30 2021-04-01 Ringcentral, Inc. System and method of caller verification
CN111479021A (en) * 2020-03-18 2020-07-31 深圳追一科技有限公司 Outbound method, device, computer equipment and computer readable storage medium
CN112202938A (en) * 2020-10-12 2021-01-08 广州品唯软件有限公司 ID generation method, device and system

Similar Documents

Publication Publication Date Title
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
CN111901249B (en) Service flow limiting method, device, equipment and storage medium
CN110738497B (en) Data processing method and device, node equipment and storage medium
CN109064345A (en) Message treatment method, system and computer readable storage medium
CN103873587B (en) A kind of method and device that scheduling is realized based on cloud platform
CN111490963B (en) Data processing method, system, equipment and storage medium based on QUIC protocol stack
CN109802895B (en) Data processing system, method and token management method
CN111277640B (en) User request processing method, device, system, computer equipment and storage medium
CN110022364B (en) File downloading method and server
CN109117609A (en) A kind of request hold-up interception method and device
CN108829519A (en) Method for scheduling task, cloud platform and computer readable storage medium based on cloud platform
CN114928579A (en) Data processing method and device, computer equipment and storage medium
CN113553153A (en) Service data processing method and device and micro-service architecture system
EP2036267A1 (en) A processor and a method for a processor
CN113422808B (en) Internet of things platform HTTP information pushing method, system, device and medium
CN113438177A (en) Method and device for limiting number outbound, electronic equipment and storage medium
CN110071952A (en) The control method and device of service call amount
CN112671945A (en) Method, device, computer equipment and storage medium for managing IP proxy pool
CN111880910A (en) Data processing method and device, server and storage medium
CN113422877B (en) Method and device for realizing number outbound based on service scene and electronic equipment
CN111124672A (en) Data distribution method based on Redis cluster and related equipment
CN102053917B (en) Smart card capable of reducing memory footprint and instruction processing method thereof
CN106874336B (en) Data matching method, data query method and device
Zhou et al. A controlled preemption scheme for emergency applications in cellular networks
CN113742071A (en) Task processing method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210924