WO2019096046A1 - Data processing system and method, and token management method - Google Patents

Data processing system and method, and token management method Download PDF

Info

Publication number
WO2019096046A1
WO2019096046A1 PCT/CN2018/114348 CN2018114348W WO2019096046A1 WO 2019096046 A1 WO2019096046 A1 WO 2019096046A1 CN 2018114348 W CN2018114348 W CN 2018114348W WO 2019096046 A1 WO2019096046 A1 WO 2019096046A1
Authority
WO
WIPO (PCT)
Prior art keywords
token
unit
service
tokens
management unit
Prior art date
Application number
PCT/CN2018/114348
Other languages
French (fr)
Chinese (zh)
Inventor
戴红斌
Original Assignee
阿里巴巴集团控股有限公司
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 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2019096046A1 publication Critical patent/WO2019096046A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/108Network architectures or network communication protocols for network security for controlling access to devices or network resources when the policy decisions are valid for a limited amount of time
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • H04L63/068Network architectures or network communication protocols for network security for supporting key management in a packet data network using time-dependent keys, e.g. periodically changing keys
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements

Definitions

  • the present specification relates to the field of computer network technologies, and in particular, to a data processing system, method, and token management method.
  • each service unit may be a physical machine or a virtual machine mounted on a physical machine. These service units can run in parallel. Multiple service units or multiple processes of the same service unit may initiate concurrent access to the same resource at the same time. If they are not controlled, the system will affect the ability of the system to process data.
  • the embodiment of the present specification provides a data processing system, including a service unit, a token management unit, and a processing unit, wherein the service unit is configured to send a token acquisition request to the token management unit to obtain the token. And then providing the service data to the processing unit for processing; the token management unit is configured to manage at least one token set, and maintain the number of tokens in the token set according to a specified rule; the token management unit is Receiving the token acquisition request, transmitting the token in the token set to a service unit that issues the token acquisition request; the processing unit is configured to have the token according to a specified processing rule The business data provided by the business unit is processed.
  • the embodiment of the present specification provides a data processing method, which is applied to a service unit.
  • the method includes: the service unit sends a token acquisition request to the token management unit; and receives a token fed back by the token management unit; wherein the token
  • the management unit manages at least one token set and maintains the number of tokens in the token set according to a specified rule; providing the service data and the token to the processing unit; wherein the processing unit has the specified processing rule pair
  • the business data of the token is processed.
  • the embodiment of the present specification provides a data processing method, which is applied to a token management unit; the method includes:
  • Receiving a token acquisition request issued by the service unit transmitting a token in the token set to the service unit, where the service unit provides the token and service data to a processing unit; wherein the processing unit Processing the service data provided by the service unit having the token; wherein the number of the token sets is at least one, and the number of tokens in the token set is maintained according to a specified rule.
  • the embodiment of the present specification provides a data processing method, which is applied to a processing unit, where the method includes: receiving a service processing request of a service unit; and if the service processing request has a token, the service is performed according to a specified processing rule. Processing the service data accompanying the request for processing; wherein the service unit obtains the token from the token management unit.
  • the embodiment of the present specification provides a token management method, which is applied to a token management unit, where the token management unit maintains at least two token sets, including: selecting one of the token sets; and setting the token set Comparing the number of tokens with the adjacent token set, adding a specified number of tokens in a smaller number of token sets; or comparing the token set with the adjacent token set for the number of tokens, A larger number of tokens reduces the specified number of tokens.
  • the token implementation unit sends a token to the service unit through the token management unit, and the processing unit processes the service data of the service unit only when the service unit obtains the token.
  • the method limits the speed of data traffic in the network, adjusts the data traffic output rate, reduces the possibility of system overload, and improves the efficiency and performance of service data processing.
  • FIG. 1 is a schematic diagram of a workflow of a data processing system according to an embodiment of the present disclosure
  • FIG. 2 is a structural block diagram of a data processing system provided by an embodiment of the present specification
  • FIG. 3 is a schematic diagram of a scenario of a data processing system according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram showing an example of a scenario of supplementing and consuming tokens when there is only one token set provided by an embodiment of the present specification
  • FIG. 5 is a schematic diagram of an example of a scenario of supplementing and consuming tokens when there are multiple token sets provided by an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of a workflow of a data processing method applied to a service unit according to an embodiment of the present disclosure
  • FIG. 7 is a schematic flowchart of a data processing method applied to a token management unit according to an embodiment of the present disclosure
  • FIG. 8 is a schematic flowchart of a data processing method applied to a processing unit according to an embodiment of the present disclosure
  • FIG. 9 is a schematic diagram of a workflow of a token management method according to an embodiment of the present disclosure.
  • an embodiment of the present specification provides a data processing system including a service unit 20, a token management unit 22, and a processing unit 24.
  • the data processing system may be a system in which hardware or software components are distributed on computers of different networks or hardware devices that can be networked, and communication and coordination can be performed between each other through message transmission. More ordinary computers can be used to provide external services. The more computers, the more CPU, memory, storage resources, etc., the greater the amount of concurrent access that can be processed.
  • the service unit 20 transmits a token acquisition request to the token management unit 22.
  • the service unit 20 is configured to send a token acquisition request to the token management unit 22 to obtain the token and then provide the service data to the processing unit 24 for processing.
  • the service unit 20 may include a network node device having data in the network that needs to be processed and possessing a network address, and software necessary to drive the hardware device to work.
  • the business unit 20 may also be only a hardware device with data processing capabilities, or only software running in a hardware device. Network data communication with the network node device is possible through the network address.
  • the service unit 20 includes: a workstation, a server, a computer, and other network devices of the user terminal, and the service unit 20 can provide a network interface for data interaction.
  • the service unit 20 can perform data information interaction in accordance with a network communication protocol.
  • the service unit 20 can implement a certain service function.
  • the service data can be provided to the processing unit 24 after the token is obtained to implement the service function. .
  • the token may be data that follows a certain format, and is used to represent a certain authority. After the business unit 20 obtains the token, it has the authority indicated by the token, so that resource access can be performed based on the authority. When data information is sent from one network node to another, only the network node that obtained the token has the right to send data.
  • the token acquisition request may be a string or code that satisfies the communication protocol and follows a certain format, and is used to indicate that the service unit 20 that issued the token acquisition request requests to obtain the corresponding token.
  • the token management unit 22 is configured to manage at least one token set and maintain the number of tokens in the token set according to a specified rule; the token management unit 22 receives the order In the case of a card acquisition request, the token in the token set is sent to the business unit 20 that issued the token acquisition request.
  • the token management unit 22 may be a server or other electronic device.
  • the token management unit 22 may include a hardware device having a data information processing function and software necessary to drive the hardware device to operate.
  • the token management unit 22 may also be only a hardware device with data processing capability, or only software running in a hardware device.
  • the token management unit 22 can be provided with an interface through which data interaction can be performed.
  • the token management unit 22 can perform network data information interaction based on a network communication protocol that can be followed.
  • the token management unit 22 is pre-configured with a certain number of tokens.
  • the token set may be a set of the tokens in the token management unit 22. At least one token is included in the token set.
  • the token management unit 22 may be from the at least one token set.
  • the token unit collects at least one token to allocate the service unit 20, and ensures that the service unit 20 corresponding to the plurality of token acquisition requests can acquire the token.
  • the token set may have a maximum number of tokens.
  • the maximum number of tokens of the token set is less than or equal to the processing unit's ability to process the service data. If the processing unit 24 is larger than the processing unit 24, the service data of the acquiring token is greater than the processing of the processing unit 24. The ability to cause some business data can not be processed, nor can it achieve the role of current limiting.
  • the token management unit 22 may maintain the number of tokens in the token set according to a specified rule, and the designation rule may be preset or may be set according to current network conditions. When the number of token sets satisfies at least one specified rule, the token management unit 22 supplements the token with the token set.
  • the processing unit 24 can process the service data according to a preset rate and manner or change the processing rate and mode according to the current network condition to adapt to the current network condition and make the network status. Maintained within a manageable range.
  • the specifying the rule may include: adding a specified number of tokens to the token set every specified time interval; and after the service unit 20 uses the obtained token, the token management unit 22 The token set adds a corresponding number of tokens.
  • sending the token in the token set to the service unit 20 that issues the token acquisition request may include, as shown in step 11 in FIG. 1, the token management unit 22 receives the token. Get the request. After receiving the token acquisition request sent by the service unit 20, the token management unit 22 checks whether the number of tokens in the token set is greater than the token acquisition, as shown in step 12 in FIG. The amount, the token management unit 20 may check the number of tokens in the current at least one token set and compare it with the token acquisition amount sent by the business unit 20. If the number of tokens in the at least one token set of the token management unit 22 is greater than the token acquisition amount sent by the service unit, the token is sent to the service as shown in step S13 in FIG. Unit 20.
  • a corresponding number of tokens may be deducted from the token set, and the token is sent to the service unit 20 according to the network address of the service unit 20 of the request token. If the current total token amount of the token management unit 22 is smaller than the token acquisition amount sent by the service unit 20, as shown in step S15 of FIG. 1, the service unit waits for the token management unit to supplement the token. Specifically, the token management unit 22 may feed back information to the service unit 20, and include the acquisition request sent by the service unit 20 in the request queue, and wait for the token management unit 22 to supplement the token; The token acquisition request is placed in the request queue. When the token has a token, the service unit 20 corresponding to the token acquisition request sends notification information to notify the service unit 20 to resend the token acquisition request. After the token management unit supplements the token, as shown in step S16 of FIG. 1, the token is sent to the service unit 20. Specifically, the token management unit 22 may perform the service according to the request token. The network address of unit 20 sends the token to the service unit 20.
  • the processing unit 24 is configured to process the service data provided by the service unit 20 having the token according to a specified processing rule.
  • the processing unit 24 may include a server capable of processing parallel data or software necessary for other electronic devices and driving hardware devices to operate.
  • the processing may also be only a hardware device with data processing capability, or only software running in a hardware device.
  • the parallel data may be a set of processing units contained within a server or other electronic device, each processing unit storing one or more data elements. When the machine executes the sequential program, the data stored in all or part of the internal processing unit can be operated simultaneously.
  • the processing unit 24 can be provided with an interface through which data interaction can be performed.
  • the processing unit can perform network data information interaction based on a network communication protocol that can be followed.
  • the processing unit 24 may be a gateway. In the message delivery process, at least one service unit 20 simultaneously sends a message to the user terminal. By calling the gateway interface, the gateway repackages and sends the message sent by the at least one service unit 20.
  • the processing unit 24 may also be a search engine. The user inputs the search information through the user terminal, and the thread that executes the search task invokes the search engine interface, and the search engine searches for the corresponding information.
  • the processing unit 24 can also process other business functions, but as long as the functions or effects thereof are the same or similar to the present application, It should be covered by the scope of this application.
  • the specified processing rule may be preset or may be changed according to current network conditions. As shown in steps S14 and S17 of FIG. 1, the service unit 24 processes the service data, and when the service data provided by the service unit 24 satisfies at least one predetermined specified processing rule, the service data is processed.
  • the specified processing rule may include: when the service data provided by the service unit 20 includes a token, the processing unit 24 processes the service data; when a plurality of service data having different priorities and including the token When arriving at the same time, the service data with higher priority is prioritized.
  • the data processing system is structured as a platform server, a token server, and an information sending gateway.
  • the platform organizes a time-limited promotion.
  • the platform server sends the information about the limited-time promotion to the mobile phone of the registered member of the platform in the form of a short message.
  • the number of SMS messages to be sent by the platform server is 200,000.
  • the interface of the information sending gateway needs to be called to send the 200,000 SMS messages to the mobile phone of the registered member.
  • the platform The server also sends a token acquisition request to the token server to obtain the token, so that the 200,000 messages can be sent to the registered member's mobile phone through the information sending gateway, and the platform server stipulates that when there is no short message to be sent, the server no longer The token server sends a token get request.
  • the ability of the messaging gateway to process and send text messages to registered members' mobile phones per second is 20,000.
  • the token server manages a token set that contains 20,000 tokens, and the token server sets a token to the token set every 1 second, each time Fill up the capacity of the token set.
  • the token server receives 200,000 token acquisition requests sent by the platform server, queries 20,000 tokens in the token set, sends the 20,000 tokens to the platform server, and sends the tokens to the platform.
  • the server sends feedback information to notify the platform server that the number of tokens in the current token set is 0, so that the platform server sends 20,000 token acquisition requests every 1 second after receiving the token until the data processing is completed.
  • the token replenishment unit begins to replenish the token after the token and feedback information has been sent.
  • the service server randomly allocates 20,000 tokens to 20,000 threads that perform SMS sending tasks, and each thread executes one SMS sending task. And the 20,000 threads simultaneously call the interface of the information sending gateway, and the information sending gateway sends the 20,000 text messages to the registered member's mobile phone.
  • the platform server sends 20,000 token acquisition requests to the token server one second after receiving the token, and the token server sends the supplemental 20,000 tokens to the platform server, and the platform server again will Ten thousand tokens are randomly assigned to 20,000 threads that perform SMS sending tasks. These threads call the information sending gateway interface and send out 20,000 SMS messages to the registered member's mobile phone. After repeating 8 times again, 200,000 text messages will be sent to the registered member's mobile phone.
  • the service data provided by the service unit is processed by the processing unit only after the service unit acquires the token from the at least one token set of the token management unit, which can reduce the occurrence of the network transmission data.
  • the network congestion in turn sends a packet loss condition, and the network traffic can be further controlled by controlling the token replenishment rate of the token set.
  • the data processing system is structured as a plurality of mobile terminals, a token server, and a search engine.
  • three users send search requests for searching for World Cup information through the mobile terminal, and the search engine responds and processes the search requests to search for World Cup information.
  • the user sends a token acquisition request to the token server through the mobile terminal, and the token server extracts the token from the token set managed by the token server to the corresponding mobile terminal, and the mobile terminal searches after obtaining the token.
  • the engine processes the search request sent by the mobile terminal.
  • the token server manages 1 token set, the maximum number of tokens in the token set is 2 tokens, and sets 2 tokens to be added every 1 second, if the number of tokens reaches the maximum The number of tokens is no longer added, and if the maximum number of tokens is not reached, continue to add.
  • three users search for World Cup information through the mobile terminal, and the three user terminals send a token acquisition request for obtaining one token to the token server, and two token acquisition requests arrive at the token at the same time.
  • the server receives two tokens from the token set by the token server, respectively sends the two tokens to the mobile terminal that sends the two token acquisition requests, and replenishes the token after one second.
  • the search request for searching for World Cup information sent by the two mobile terminals that obtain the token is processed by the search engine, and the two users obtain the World Cup information through the search engine.
  • the third token acquisition request arrives at the token server after the first two token acquisition requests reach the token server.
  • the token server manages the token set without the token, and the token server sends the token.
  • the three tokens acquire the requested mobile terminal feedback information, and notify the third mobile terminal to send the token acquisition request again after 1 second, and after 1 second, the third mobile terminal sends the token acquisition request again, and the token server receives the command.
  • the card acquisition request one token is extracted from the two tokens in the token set and assigned to the mobile terminal.
  • the token server replenishes the token again.
  • the search request sent by the third mobile terminal for searching for World Cup information is processed by the search engine, and the user obtains the World Cup information through the search engine. After that, no user terminal sends the token acquisition request again.
  • the data processing system is structured as a plurality of mobile terminals, a token management unit, and a search engine.
  • one user transmits a search request for searching for World Cup information through the mobile terminal, and the search engine responds and processes the search request to search for World Cup information.
  • the user sends a token acquisition request to the token server through the mobile terminal, and the token server extracts the token from the token set managed by the token server to the corresponding mobile terminal, and the mobile terminal searches after obtaining the token.
  • the engine processes the search request sent by the mobile terminal.
  • the token server manages five token sets.
  • the maximum number of tokens for the five token sets is 10, 7, 9, 4, and 8, each of the current token set.
  • the number of tokens is 9, 6, 8, 3, and 7, respectively, and the number of these 5 token sets is numbered. And set to add 1 token every 1 second interval. If the number of tokens reaches the maximum number of tokens, it will not be added. If the maximum number of tokens is not reached, continue to add.
  • one user searches for World Cup information through the mobile terminal, and the mobile terminal first sends a token acquisition request requesting to obtain one token, and the token acquisition request arrives at the token server at the same time, and the token server randomly selects Token Set 2, the number of tokens in the token set is retrieved, and one of the six tokens in the token set 2 is taken out and sent to the user's mobile terminal. After the mobile terminal obtains the token, the search request sent is searched. The engine processes the user's search results for World Cup information.
  • the token server queries the number of tokens in the token set 1 and the token set 3 adjacent to the token set 2, There are 9 and 8 respectively.
  • the token server chooses to take 1 token from the token set 1 and send it to the mobile terminal. After the mobile terminal obtains the token, the search request sent by the mobile terminal is processed by the search engine, and the user obtains the World Cup information. Search results.
  • the token server adds 1 token per second, the token server randomly selects a token set, selects token set 3, and token token 3 has 8 tokens.
  • Token server query and order The number of tokens in token set 2 and token set 4 adjacent to card set 3 is 6 and 3 respectively, wherein the number of tokens in token set 4 is the least, and in token set 4 The number of tokens does not reach the maximum number of tokens, and one token is added to token set 4.
  • the service unit has the service data that needs to be processed by the processing unit before sending the token acquisition request to the token management unit.
  • the service unit when the service unit has service data to be processed by the processing unit, the service unit may send a token acquisition request to the token management unit, thereby acquiring the token from the token management unit; When there is no data required by the processing unit, the service unit may not send a token acquisition request to the token management unit, and thus the token cannot be obtained.
  • the service unit can The token management unit sends a token acquisition request, which improves the token allocation efficiency and reduces the number of tokens available in the token set when there is a service unit demand token that needs to be processed by the service data, and no service data is needed.
  • the processed business unit has a waste of network resources caused by idle tokens.
  • the service unit includes a plurality of tasks having different task priorities; the task having the specified task priority can send the to the token management unit before having the service data Token get request.
  • the service unit includes a plurality of tasks.
  • the service unit can implement a certain service function, and the implementation of the service function requires the service unit to perform a plurality of different tasks. Having threads executing different tasks in the service unit, corresponding at least one piece of service data may be allocated to different threads for execution, and the threads may acquire tokens and/or call processing from the token management unit.
  • the unit interface allows the processing unit to process the plurality of service data to implement a service function.
  • the plurality of tasks have different task priorities.
  • the service unit may have threads for performing different tasks, and corresponding service data may be allocated to different threads for execution, and the service unit sets different priorities for different task threads, wherein, priority is given.
  • Business data in a high-level thread can be executed with priority.
  • the specified priority may be preset.
  • the thread executing the task may prioritize other threads, and generate service data that needs to be processed by the processing unit.
  • the token acquisition request can be sent before the token management unit.
  • the platform server pushes a message to the user client, and the user can be divided into a VIP user and a normal user.
  • the platform server sets the thread that performs the push of the VIP user message to a high priority, and the thread that performs the normal user message push is executed. Set to low priority.
  • the thread that performs the push of the VIP user message can send the token acquisition request to the token management unit in advance before the message is pushed.
  • the token can be obtained immediately, and the message pushed to the VIP user can be preferentially processed.
  • the task having the specified priority may send the token acquisition request to the token management unit before having the service data. Ensure that important business data can be prioritized, and reduce the possibility of important business data being lost, further improving the efficiency and performance of data processing.
  • the service units have different service priorities; the task of the service unit with the specified service priority can send the token acquisition request to the token management unit before having the service data. .
  • the service units have different service priorities. Different business functions can be implemented for different business units. The implementation of business functions requires execution of certain tasks, and the business unit has at least one thread to perform tasks. Different business functions to be implemented by different business units may have different priorities, so different priorities are set for different business units. Corresponding service data can be allocated to the execution thread of each respective service unit for execution, wherein the service data in the thread with higher priority can be executed preferentially.
  • the specified service priority may be preset, and when the service unit meets a preset priority requirement, the thread that executes the service data of the service unit may be prioritized by other threads, and needs to be processed.
  • a token acquisition request may be sent to the token management unit before the unit processed business data is generated.
  • the user accesses the website through the user terminal, and the user can be divided into a VIP user and a normal user.
  • the VIP user logs in to the user terminal, and the user terminal is in the thread that performs the website access task.
  • the priority information with the priority being high is set; the ordinary user logs in to the user terminal, and the user terminal sets the priority information with the lower priority in the thread that performs the website access.
  • the thread that the VIP user terminal performs website access can send a token acquisition request to the token management unit before the user wants to visit the website, and the ordinary user terminal can only send the token to the token management unit when the user visits the website. Obtaining a request ensures that VIP users can prioritize access to the website.
  • the service unit having the specified service priority may send the token acquisition request to the token management unit before having the service data. It ensures that the business data of important business units can be prioritized, and the possibility that the business data of important business units is lost is also reduced, further improving the efficiency and performance of data processing.
  • the specified rule includes at least one of: adding a specified number of tokens to the token set every specified time interval; or, after the service unit uses the obtained token, the The token management unit adds a corresponding number of tokens to the token set.
  • the specified time may be preset or may be set according to a current network condition, and the token management unit adds to the token set every time after the specified time interval Token.
  • the specified time may be constant or varied.
  • the token management unit presets that a certain number of tokens are added to the token set every 2 seconds; or the token management unit presets to send a token to the business unit for the first time. After that, the token is added to the token set at intervals of 2 seconds. After the token is sent to the service unit for the second time, the token is added to the token set at intervals of 5 seconds. After each token is sent to the service unit, the interval is supplemented at different intervals. Card; or when there is more network data to be processed at present, the token is added to the token set every 1 second. When the network data to be processed is small, the specified time is adjusted, and the interval is 5 seconds. brand.
  • the specified number may be preset or may be set according to a current network condition, and the token management unit concentrates on the token every time the interval is preset. Add the specified number of tokens.
  • the specified number can be constant or varied.
  • the token management unit presets to add two tokens to the token set every 2 seconds, and adds two tokens each time the token issuance interval; or The token management unit presets that after sending the token to the service unit for the first time, the token set is supplemented with two tokens at intervals of 2 seconds, and after the token is sent to the service unit for the second time, the token is sent to the token for 5 seconds.
  • the set adds 5 tokens, each time a token is added to the token set, and a different number of tokens are sent at different intervals; or when there are more network data to be processed, 5 tokens are added each time, when it needs to be processed When the network data is small, adjust the specified quantity and add one token at a time.
  • the token management unit presets or according to the current acquisition network status setting, how many tokens are used by the service unit after the service unit acquires and uses the token acquired from the token management unit. How many tokens are added to the token set by the token management unit.
  • the token management unit sends 5 tokens to the service unit, and the service unit uses all 5 tokens. At this time, the token management unit adds 5 tokens to the token set.
  • the token management unit adds a token to the token set by specifying a certain rule. According to the network status, control the rate and quantity of token replenishment, further improve the shaping of network traffic and avoid network congestion.
  • the addition of tokens to the token set is stopped.
  • the number of token sets reaching the maximum number of tokens may be, the token set has a quantity threshold, and the threshold is the maximum capacity of the token set.
  • the threshold of the number of tokens must be less than or equal to the maximum processing capacity of the processing unit, otherwise it will not function as a current limit.
  • the token management unit may preset that when the number of tokens in the token set reaches the maximum number of tokens, the token is no longer replenished to the token set regardless of any token supplementation rules.
  • the token can be replenished to the token set only if the token in the token set does not reach the token maximum token count and the predetermined token supplementation rule is met.
  • the manner in which the token management unit replenishes the token set to the token set is restricted by setting the maximum number of tokens. Stopping the token to the token set after the token set reaches the maximum number of tokens can save network resources.
  • the token management unit when the token management unit receives the token acquisition request, if the token set has no token, the token management unit processes the token acquisition request.
  • the method includes at least one of: sending a feedback message to a service unit that issues the token acquisition request to notify the service unit to reissue a token acquisition request; or placing the token acquisition request into a request queue,
  • the token is allocated to the service unit corresponding to the token acquisition request in the request queue; or the token acquisition request is placed in the request queue, where the token is
  • the service unit corresponding to the token acquisition request in the request queue issues notification information to notify the service unit to reissue the token acquisition request.
  • the feedback information may be a character string or code written in a fixed format
  • the token management unit queries the number of tokens in the current token set. If the number of tokens in the token set is 0, the service is sent to the service. The unit sends the feedback information.
  • the feedback information may include: the number of tokens in the current token set, and how long the service unit can send the token acquisition request, the number of tokens that can be requested, and the like. Notifying the service unit that the token acquisition fails, and transmitting the time information of the token acquisition request, etc., after a certain time interval or immediately.
  • the service unit sends a token acquisition request to the token management unit, and the token management unit queries the number of tokens in the current token set.
  • the number of tokens in the current token set is 0, and the token management unit sends feedback to the service unit.
  • the information informs the service unit that the current token set number of tokens is 0, and notifies the service unit to send the token acquisition request to the token management unit again after 1 second.
  • the request queue may be a buffer area or a storage unit, and is configured to store the token acquisition request that is not requested to the token.
  • the request queue obtains the request number of the token that enters the request queue.
  • the numbering method may include: numbering according to the time of entry; obtaining the priority number of the service unit or task according to the sending token, the higher the priority, the higher the number
  • the token is obtained by assigning the token to the service unit corresponding to the token acquisition request.
  • the multiple service units may simultaneously send a token acquisition request to the token management unit, and the token management unit queries the number of tokens in the current token set. When the number of tokens in the token set is 0, the token may be acquired. The request is placed in the request queue and numbered according to the request time. After the token set is supplemented with the token, the service unit corresponding to the token acquisition request in the request queue is sequentially assigned the token according to the number.
  • the token supplementing unit may sequentially send the notification information to the service unit corresponding to the token acquisition request in the request queue according to the number, and notify the service unit that the service unit can immediately Or send the token acquisition request again after a period of time.
  • the token in the case where there is no token in the token set, the token is allocated by transmitting feedback information to the service unit and/or placing the token acquisition request in the request queue.
  • the service data processing failure caused by the absence of the token in the token set when the service unit sends the token acquisition request is reduced, and the efficiency and stability of processing the service data are improved.
  • the number of the token sets is plural; the specifying rule includes: selecting one token set in a plurality of token sets, and performing the token set with an adjacent token set number Compare, add a specified number of tokens in a small number of token sets.
  • the token management unit may manage a plurality of token sets, and by managing a plurality of token sets, prevent the service unit from being reliable in a system in which the number of reads and writes per second of the single token set is increased. Reduced sex.
  • the token management unit may randomly select a token set, or may select a token set by directivity or according to a preset rule. Query the current number of tokens of the selected token set, and query the number of tokens of the token set adjacent to or adjacent to or adjacent to the selected token set. Compare the number of tokens for these token sets, select a smaller number of token sets, and replenish the tokens for a smaller number of token sets.
  • the specified number may be preset or may be set according to current network conditions, and may include: increasing the number of fixed tokens; increasing the number of changed tokens; and increasing the fixed interval time.
  • the number of tokens; the fixed interval increases the number of tokens changed; the interval change time increases the number of fixed tokens; the interval change time increases the number of tokens changed, and so on.
  • the number of tokens of the selected token set and the adjacent token set is compared, and the number of tokens is small.
  • the manner in which the token set is supplemented with the token further reduces the possibility that the token management unit selects the empty token set to allocate the token to the service unit after the service unit sends the token acquisition request, and reduces the token acquisition. waiting time.
  • the addition of the token is stopped when the number of tokens in the selected token set and its neighboring token set reaches the maximum number of tokens.
  • the token management unit may preset, after selecting the token set, query the current token number of the selected token set and the token set adjacent to the selected token set.
  • the current number of tokens if the number of tokens of the selected token set and the token set adjacent to the selected token set reaches their respective maximum number of tokens, then the stop order is satisfied regardless of any token supplemental rules. Card supplement.
  • the token management unit is restricted from replenishing the token set to the selected token set and the token set adjacent to the selected token set by setting the maximum number of tokens. Stopping the token to the token set after the token set reaches the maximum number of tokens can save network resources.
  • the number of the token sets is multiple; each of the token sets corresponds to a maximum number of tokens; wherein, the maximum number of tokens of at least part of the token set and the maximum number of other tokens The number of cards is different.
  • the token management unit manages a plurality of token sets, wherein each token set corresponds to a maximum number of tokens, and the maximum number of tokens is less than or equal to the service data processing capability of the processing unit. At least one of the token sets managed by the token management unit may be different from the number of tokens of other token sets, or the number of tokens of all token sets may be different.
  • the token management unit manages five token sets, and the maximum number of tokens in the five token sets is five, four, six, seven, and two, and the maximum token between the token sets The numbers are different from each other.
  • the token management unit can arbitrarily set the maximum number of tokens of the plurality of token sets, and the total number of tokens managed by the token management unit is less than or equal to the processing capability of the processing unit, and no The maximum number of tokens for the token set is set to the same as necessary.
  • the number of the token sets is multiple; after receiving the token acquisition request, the token management unit selects a token set, and the token set and the adjacent token The set performs a token quantity comparison, and assigns a token to a business unit that issues the token acquisition request in a larger number of token sets.
  • the token management unit may compare the selected token set with the number of tokens of the token set adjacent to the selected token set. Select a token set with a large number of tokens, and assign a token to the corresponding business unit from the token set with a larger number of tokens.
  • the token set allocation token with more tokens is selected for the corresponding business unit.
  • the way. The possibility that the service unit can obtain the token without waiting after sending the token acquisition request is improved, and the efficiency of processing the corresponding service data is improved.
  • the number of the token sets is multiple, and after receiving the token obtaining request, the token management unit selects a token set, and the number of tokens in the token set cannot match.
  • the token management unit selects a token set, and the number of tokens in the token set cannot match.
  • the token management unit may select a token set to allocate a token to the service unit.
  • the token management unit may query the token set adjacent to the selected token set. The current number of tokens.
  • the token is assigned from the token set that satisfies the request quantity of the token acquisition request.
  • Commercian unit if there is one request quantity satisfying the token acquisition request from the token set adjacent to the selected token set, the token is assigned from the token set that satisfies the request quantity of the token acquisition request.
  • a token set may be randomly selected from the adjacent token set, and the token is allocated to the service unit;
  • the neighbor tokens select the token set with the largest number of tokens, and assign tokens to the business unit.
  • the service unit if the current number of tokens of the adjacent token set cannot satisfy the request amount of the token acquisition request, the service unit is notified to wait for a period of time to acquire again.
  • the token set selected by the token management unit cannot satisfy the service by assigning a token to the service unit from a token set adjacent to the selected token set.
  • the problem that the number of requests in the token acquisition request sent by the unit is caused by the business unit not acquiring the token or waiting to be able to acquire the token. Thereby, the possibility that the business unit acquires the token is further improved, and the efficiency of the business data processing is improved.
  • the data processing system provided by the embodiment of the present specification sends a token acquisition request to the token management unit through the service unit, and the token management unit allocates the token to the service unit from the at least one token group managed by the token management unit, and the service unit
  • the way service data can be processed by the processing unit in the case of tokens limits the speed of data traffic in the network, adjusts the data traffic output rate, reduces the possibility of system overload, and improves the processing of service data. Efficiency and performance, and the system can be applied to any scenario that requires traffic shaping and rate limiting.
  • an embodiment of the present specification provides a data processing method, which may be applied to a service unit.
  • the method can include the following steps.
  • Step S60 The service unit sends a token acquisition request to the token management unit.
  • Step S62 Receive a token fed back by the token management unit; wherein the token management unit manages at least one token set and maintains the number of tokens in the token set according to a specified rule.
  • Step S64 Providing the service data and the token to the processing unit; wherein the processing unit processes the service data having the token according to a specified processing rule.
  • the subject performing the above steps may be a business unit.
  • the service unit may send a token acquisition request, receive a token fed back by the token management unit, provide service data to the processing unit, and the token.
  • the service unit may be provided with a predetermined port through which token acquisition request information may be sent to the token management unit, a token assigned by the token management unit is received, service data is provided to the processing unit, and Describe the token.
  • the service server may perform network data interaction with the token management unit based on a network protocol such as HTTP, TCP/IP or FTP.
  • an embodiment of the present specification provides a data processing method, which may be applied to a token management unit.
  • the method can include the following steps.
  • Step S70 Receive a token acquisition request sent by the service unit.
  • Step S72 Sending a token in the token set to the service unit, where the service unit provides the token and service data to a processing unit; wherein the processing unit pairs have the token The service data provided by the service unit is processed; wherein the number of the token sets is at least one, and the number of tokens in the token set is maintained according to a specified rule.
  • an embodiment of the present specification provides a data processing method, which may be applied to a processing unit.
  • the method can include the following steps.
  • Step S80 Receive a service processing request of the service unit.
  • Step S82 If the service processing request has a token, process the service data attached to the service processing request according to the specified processing rule; wherein the service unit obtains the token from the token management unit.
  • the service processing request may be a string or code that satisfies a communication protocol and follows a certain format, and may be used to indicate that the service unit that issues the service processing request has service data that needs to be processed by the processing unit.
  • the service processing request may include a search request sent by the user to the search engine by the client; a push request of the platform pushing the message to the user, and the like.
  • the token may be sent to the processing unit in the service processing request, and the processing unit may select whether the token has a service according to the service processing request. Process the business data attached to the request for processing. In the case of having a token, the processing unit may process the corresponding service data according to the service processing request.
  • two users simultaneously use the client to send a search request for searching for entertainment news to the search engine.
  • the two search requests have one token with no token, and the search engine can process the search request with the token to search for related entertainment. News; search requests without tokens can be left unprocessed.
  • the specified processing rule may be preset or may be changed according to current network conditions.
  • the business data can be processed when the business data provided by the business unit satisfies at least one predetermined specified processing rule.
  • the specified processing rule may include: when the service data provided by the service unit includes a token, the processing unit processes the service data; when a plurality of service data having different priorities and containing the token arrive at the same time Priority is given to prioritizing business data with high priority.
  • the processing unit processes the service processing request with the token by receiving the service processing request sent by the service unit, can adjust the data traffic output rate, reduces the possibility of system overload, and improves the The efficiency and performance of business data processing.
  • an embodiment of the present specification provides a token management method, which may be applied to a token management unit, and the token management unit may maintain at least two token sets.
  • the method can include the following steps.
  • S92 Compare the token set with an adjacent token set by a number of tokens, and add a specified number of tokens in a smaller number of token sets; or, combine the token set with an adjacent token The set compares the number of tokens and reduces the specified number of tokens in a larger number of tokens.
  • the manner of selecting one of the token sets may include: randomly selecting one token set from the at least two token sets; and selecting a specified token set from the at least two token sets Specifically, for example, selecting the token set of the specified number for the at least two token set numbers, or selecting a token set according to the location of the token set of the at least two token sets, for example, selecting the most The token set on the left or the rightmost token set.
  • the adjacent token set may include adjacent to the selected one of the token sets, left and right adjacent, up and down adjacent, and the like.
  • the token management unit may query the selected one of the token set and the number of tokens in the token set adjacent to the selected one of the token sets, in a smaller number of orders Add a specified number of tokens in a card set or reduce a specified number of tokens in a larger number of token sets.
  • the specified number may be preset or may be set according to current network conditions, and may include: increasing the number of fixed tokens; increasing the number of changed tokens; and increasing the fixed interval time.
  • the number of tokens; the fixed interval increases the number of tokens changed; the interval change time increases the number of fixed tokens; the interval change time increases the number of tokens changed, and so on.
  • the token management unit compares the number of tokens of the selected token set and the adjacent token set by managing at least two token sets and selecting one token set therefrom. Replenishing a token for a token set with a small number of tokens, reducing the token from a token set with a large number of tokens, and reducing the token selection unit to select an empty command after the service unit sends a token acquisition request.
  • the card set assigns a token to the business unit and reduces the wait time for token acquisition.
  • the present specification provides a data processing system, method, and token management method, the data processing system including: a service unit, a token management unit, and a processing unit, wherein the service unit is configured to send a token to the token management unit Acquiring a request to obtain the token and then providing the service data to the processing unit for processing; the token management unit is configured to manage at least one token set, and maintain the token set token according to a specified rule a quantity; the token management unit, when receiving the token acquisition request, transmitting a token in the token set to a service unit that issues the token acquisition request; the processing unit is configured to follow The specified processing rule processes the business data provided by the business unit having the token.
  • the data processing system provided in this specification limits the speed of data traffic in the network, adjusts the data traffic output rate, reduces the possibility of system overload, and improves the efficiency and performance of service data processing.
  • the various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on differences from other embodiments.
  • the data processing method applied to the business unit the data processing method applied to the token management unit, the data processing method applied to the processing unit, and the token management method are basically similar to the data processing system
  • the description of the implementation is relatively simple, and the relevant parts can be referred to the description of the implementation of the data processing system.
  • This description can be used in a variety of general purpose or special purpose computer system environments or configurations.

Abstract

The present description provides a data processing system and method, and a token management method. The data processing system comprises: a service unit, a token management unit and a processing unit; the service unit is used to send a token acquisition request to the token management unit, so as to provide service data to the processing unit for processing after the tokens are acquired; the token management unit is used to manage at least one token set, and maintain the quantity of tokens in the token set according to a specified rule; when having received the token acquisition request, the token management unit sends the tokens in the token set to the service unit which sends the token acquisition request; the processing unit is used to process, according to a specified processing rule, the service data provided by the service unit having the tokens. The data processing system provided in the present description limits the speed of data flows in the network, reducing the probability of system overload, improving the data processing performance.

Description

数据处理系统、方法及令牌管理方法Data processing system, method and token management method
本申请要求2017年11月16日递交的申请号为201711138960.4、发明名称为“数据处理系统、方法及令牌管理方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application Serial No. No. No. No. No. No. No. No. No. No. No. No. No. No. No. No. No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
技术领域Technical field
本说明书涉及计算机网络技术领域,尤其涉及数据处理系统、方法及令牌管理方法。The present specification relates to the field of computer network technologies, and in particular, to a data processing system, method, and token management method.
背景技术Background technique
在大数据的背景下,网络数据的吞吐量日益庞大,可能会造成网络系统的过载,造成网络拥塞。In the context of big data, the throughput of network data is increasing, which may cause overload of network systems and cause network congestion.
对于网络系统中来说,系统内可以有多个业务单元,其中,每个业务单元均可以为物理机或者架设于物理机上的虚拟机。这些业务单元可以并行运行,在同一时刻可能存在多个业务单元或者同一业务单元的多个进程对同一资源发起并发访问,若不对其进行控制,将会对系统处理数据的能力造成影响。For a network system, there may be multiple service units in the system, where each service unit may be a physical machine or a virtual machine mounted on a physical machine. These service units can run in parallel. Multiple service units or multiple processes of the same service unit may initiate concurrent access to the same resource at the same time. If they are not controlled, the system will affect the ability of the system to process data.
发明内容Summary of the invention
本说明书实施方式的目的在于提供一种数据处理系统、方法及计算机存储介质。能够在流量输入和输出环节进行流量整形和速率限制。It is an object of embodiments of the present specification to provide a data processing system, method, and computer storage medium. Ability to perform traffic shaping and rate limiting at the flow input and output.
本说明书实施方式提供一种数据处理系统,包括业务单元、令牌管理单元和处理单元,其中,所述业务单元用于向所述令牌管理单元发送令牌获取请求,以获得所述令牌后将业务数据提供给所述处理单元进行处理;所述令牌管理单元用于管理至少一个令牌集,并按照指定规则维持所述令牌集中令牌的数量;所述令牌管理单元在接收到所述令牌获取请求的情况下,将所述令牌集中的令牌发送给发出所述令牌获取请求的业务单元;所述处理单元用于按照指定处理规则对具有所述令牌的业务单元提供的业务数据进行处理。The embodiment of the present specification provides a data processing system, including a service unit, a token management unit, and a processing unit, wherein the service unit is configured to send a token acquisition request to the token management unit to obtain the token. And then providing the service data to the processing unit for processing; the token management unit is configured to manage at least one token set, and maintain the number of tokens in the token set according to a specified rule; the token management unit is Receiving the token acquisition request, transmitting the token in the token set to a service unit that issues the token acquisition request; the processing unit is configured to have the token according to a specified processing rule The business data provided by the business unit is processed.
本说明书实施方式提供一种数据处理方法,应用于业务单元;所述方法包括:业务单元向令牌管理单元发送令牌获取请求;接收令牌管理单元反馈的令牌;其中,所述令牌管理单元管理至少一个令牌集,并按照指定规则维持所述令牌集中令牌的数量;将业务数据和所述令牌提供给处理单元;其中,所述处理单元按照指定处理规则对具有所述 令牌的业务数据进行处理。The embodiment of the present specification provides a data processing method, which is applied to a service unit. The method includes: the service unit sends a token acquisition request to the token management unit; and receives a token fed back by the token management unit; wherein the token The management unit manages at least one token set and maintains the number of tokens in the token set according to a specified rule; providing the service data and the token to the processing unit; wherein the processing unit has the specified processing rule pair The business data of the token is processed.
本说明书实施方式提供一种数据处理方法,应用于令牌管理单元;所述方法包括:The embodiment of the present specification provides a data processing method, which is applied to a token management unit; the method includes:
接收业务单元发出的令牌获取请求;将令牌集中的令牌发送给所述业务单元,以用于所述业务单元将所述令牌和业务数据提供给处理单元;其中,所述处理单元对具有所述令牌的业务单元提供的业务数据进行处理;其中,所述令牌集的数量为至少一个,所述令牌集中令牌的数量被依照指定规则维持。Receiving a token acquisition request issued by the service unit; transmitting a token in the token set to the service unit, where the service unit provides the token and service data to a processing unit; wherein the processing unit Processing the service data provided by the service unit having the token; wherein the number of the token sets is at least one, and the number of tokens in the token set is maintained according to a specified rule.
本说明书实施方式提供一种数据处理方法,应用于处理单元,所述方法包括:接收业务单元的业务处理请求;在所述业务处理请求具有令牌的情况下,根据指定处理规则对所述业务处理请求附带的业务数据进行处理;其中,所述业务单元从令牌管理单元得到所述令牌。The embodiment of the present specification provides a data processing method, which is applied to a processing unit, where the method includes: receiving a service processing request of a service unit; and if the service processing request has a token, the service is performed according to a specified processing rule. Processing the service data accompanying the request for processing; wherein the service unit obtains the token from the token management unit.
本说明书实施方式提供一种令牌管理方法,应用于令牌管理单元,所述令牌管理单元维持有至少两个令牌集;包括:选择一个所述令牌集;将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较少的令牌集中增加指定数量的令牌;或者,将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较多的令牌集中减少指定数量的令牌。The embodiment of the present specification provides a token management method, which is applied to a token management unit, where the token management unit maintains at least two token sets, including: selecting one of the token sets; and setting the token set Comparing the number of tokens with the adjacent token set, adding a specified number of tokens in a smaller number of token sets; or comparing the token set with the adjacent token set for the number of tokens, A larger number of tokens reduces the specified number of tokens.
由以上本说明书实施方式提供的技术方案可见,本说明书实施方式通过令牌管理单元向业务单元发送令牌,在业务单元获得令牌的情况下,处理单元才对业务单元的业务数据进行处理的方式,限制了网络中数据流量的速度,调整了数据流量输出速率,降低了系统过载的可能性,并提高了业务数据处理的效率与性能。It can be seen from the technical solutions provided by the foregoing embodiments of the present specification that the token implementation unit sends a token to the service unit through the token management unit, and the processing unit processes the service data of the service unit only when the service unit obtains the token. The method limits the speed of data traffic in the network, adjusts the data traffic output rate, reduces the possibility of system overload, and improves the efficiency and performance of service data processing.
附图说明DRAWINGS
所包括的附图用来提供对本说明书实施方式的进一步的理解,其构成了说明书的一部分,用于例示本说明书的实施方式,并与文字描述一起来阐释本说明书的原理。显而易见地,下面描述中的附图仅仅是本说明书的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。在附图中:The accompanying drawings are included to provide a further understanding of the embodiments of the invention Obviously, the drawings in the following description are only some of the embodiments of the present specification, and those skilled in the art can obtain other drawings according to the drawings without any inventive labor. In the drawing:
图1为本说明书实施方式提供的数据处理系统的工作流程示意图;FIG. 1 is a schematic diagram of a workflow of a data processing system according to an embodiment of the present disclosure;
图2为本说明书实施方式提供的数据处理系统结构框图2 is a structural block diagram of a data processing system provided by an embodiment of the present specification
图3为本说明书实施方式提供的数据处理系统的一个场景示例示意图;FIG. 3 is a schematic diagram of a scenario of a data processing system according to an embodiment of the present disclosure; FIG.
图4为本说明书实施方式提供的仅有一个令牌集时补充和消耗令牌的场景示例示意 图;FIG. 4 is a schematic diagram showing an example of a scenario of supplementing and consuming tokens when there is only one token set provided by an embodiment of the present specification; FIG.
图5为本说明书实施方式提供的有多个令牌集时补充和消耗令牌的场景示例示意图;FIG. 5 is a schematic diagram of an example of a scenario of supplementing and consuming tokens when there are multiple token sets provided by an embodiment of the present disclosure; FIG.
图6为本说明书实施方式提供的应用于业务单元的数据处理方法的工作流程示意图;FIG. 6 is a schematic diagram of a workflow of a data processing method applied to a service unit according to an embodiment of the present disclosure;
图7为本说明书实施方式提供的应用于令牌管理单元的数据处理方法的工作流程示意图;FIG. 7 is a schematic flowchart of a data processing method applied to a token management unit according to an embodiment of the present disclosure;
图8为本说明书实施方式提供的应用于处理单元的数据处理方法的工作流程示意图;FIG. 8 is a schematic flowchart of a data processing method applied to a processing unit according to an embodiment of the present disclosure; FIG.
图9为本说明书实施方式提供的令牌管理方法的工作流程示意图。FIG. 9 is a schematic diagram of a workflow of a token management method according to an embodiment of the present disclosure.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施方式中的附图,对本说明书实施方式中的技术方案进行清楚、完整地描述,显然,所描述的实施方式仅仅是本说明书一部分实施方式,而不是全部的实施方式。基于本说明书中的实施方式,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施方式,都应当属于本说明书保护的范围。In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described in conjunction with the drawings in the embodiments of the present specification. The embodiments are only a part of the embodiments of the present specification, and not all of them. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without departing from the inventive scope should fall within the scope of the present disclosure.
请参阅图1和图2,本说明书实施方式提供一种数据处理系统,包括,业务单元20、令牌管理单元22和处理单元24。Referring to FIG. 1 and FIG. 2, an embodiment of the present specification provides a data processing system including a service unit 20, a token management unit 22, and a processing unit 24.
在本实施方式中,所述数据处理系统可以是一个硬件或软件组件分布在不同的网络的计算机或可以联网的硬件设备上,彼此之间可以通过消息传递进行通信和协调的系统。可以采用更多的普通计算机对外提供服务。计算机越多,CPU、内存、存储资源等也就越多,能够处理的并发访问量也就越大。In this embodiment, the data processing system may be a system in which hardware or software components are distributed on computers of different networks or hardware devices that can be networked, and communication and coordination can be performed between each other through message transmission. More ordinary computers can be used to provide external services. The more computers, the more CPU, memory, storage resources, etc., the greater the amount of concurrent access that can be processed.
在本实施方式中,如图1中步骤S10所示,业务单元20向令牌管理单元22发送令牌获取请求。所述业务单元20用于向所述令牌管理单元22发送令牌获取请求,以获得所述令牌后将业务数据提供给所述处理单元24进行处理。In the present embodiment, as shown in step S10 of FIG. 1, the service unit 20 transmits a token acquisition request to the token management unit 22. The service unit 20 is configured to send a token acquisition request to the token management unit 22 to obtain the token and then provide the service data to the processing unit 24 for processing.
在本实施方式中,所述业务单元20可以包括在网络中有数据需要被处理并拥有网络地址的网络节点设备和驱动该硬件设备工作所必须要的软件。当然,业务单元20也可以仅为具有数据处理能力的硬件设备,或者,仅为运行在硬件设备中的软件。通过所述网络地址可以与所述网络节点设备进行网络数据通信。所述业务单元20包括:工作 站、服务器,计算机、用户终端其他网络设备,业务单元20可以提供用于数据交互的网络接口。所述业务单元20可以遵循网络通信协议进行数据信息交互。In this embodiment, the service unit 20 may include a network node device having data in the network that needs to be processed and possessing a network address, and software necessary to drive the hardware device to work. Of course, the business unit 20 may also be only a hardware device with data processing capabilities, or only software running in a hardware device. Network data communication with the network node device is possible through the network address. The service unit 20 includes: a workstation, a server, a computer, and other network devices of the user terminal, and the service unit 20 can provide a network interface for data interaction. The service unit 20 can perform data information interaction in accordance with a network communication protocol.
在本实施方式中,所述业务单元20可以实现一定的业务功能,通过向令牌管理单元22获取令牌,在得到令牌后才能将业务数据提供给所述处理单元处理24进而实现业务功能。In this embodiment, the service unit 20 can implement a certain service function. By acquiring the token from the token management unit 22, the service data can be provided to the processing unit 24 after the token is obtained to implement the service function. .
在本实施方式中,所述令牌可以是遵循一定格式的数据,其用于表示一定的权限。业务单元20获得令牌之后,即具有了所述令牌所表示的权限,从而可以基于所述权限进行资源访问。当数据信息从一个网络节点发送到另一个网络节点时,只有获得令牌的网络节点才有权发送数据。In this embodiment, the token may be data that follows a certain format, and is used to represent a certain authority. After the business unit 20 obtains the token, it has the authority indicated by the token, so that resource access can be performed based on the authority. When data information is sent from one network node to another, only the network node that obtained the token has the right to send data.
在本实施方式中,令牌获取请求可以是满足通信协议并遵循一定格式的字符串或代码,其用于表示发出该令牌获取请求的业务单元20请求获得相应的令牌。In this embodiment, the token acquisition request may be a string or code that satisfies the communication protocol and follows a certain format, and is used to indicate that the service unit 20 that issued the token acquisition request requests to obtain the corresponding token.
在本实施方式中,所述令牌管理单元22用于管理至少一个令牌集,并按照指定规则维持所述令牌集中令牌的数量;所述令牌管理单元22在接收到所述令牌获取请求的情况下,将所述令牌集中的令牌发送给发出所述令牌获取请求的业务单元20。In this embodiment, the token management unit 22 is configured to manage at least one token set and maintain the number of tokens in the token set according to a specified rule; the token management unit 22 receives the order In the case of a card acquisition request, the token in the token set is sent to the business unit 20 that issued the token acquisition request.
在本实施方式中,所述令牌管理单元22可以是服务器也可以是其他电子设备。所述令牌管理单元22可以包括具有数据信息处理功能的硬件设备和驱动该硬件设备工作所需必要的软件。当然,所述令牌管理单元22也可以仅为具有数据处理能力的硬件设备,或者,仅为运行在硬件设备中的软件。所述令牌管理单元22可以提供有接口,通过该接口可以进行数据交互。所述令牌管理单元22可以基于可以遵循网络通信协议进行网络数据信息交互。所述令牌管理单元22预设有一定数量的令牌。In this embodiment, the token management unit 22 may be a server or other electronic device. The token management unit 22 may include a hardware device having a data information processing function and software necessary to drive the hardware device to operate. Of course, the token management unit 22 may also be only a hardware device with data processing capability, or only software running in a hardware device. The token management unit 22 can be provided with an interface through which data interaction can be performed. The token management unit 22 can perform network data information interaction based on a network communication protocol that can be followed. The token management unit 22 is pre-configured with a certain number of tokens.
在本实施方式中,所述令牌集可以是所述令牌在所述令牌管理单元22的集合。在令牌集中至少包含一个令牌,当所述令牌管理单元22接收到所述业务单元20发送的令牌获取请求时,所述令牌管理单元22可以从所述至少一个令牌集中的一个令牌集中取出至少一个令牌分配所述业务单元20,保证多个令牌获取请求对应的业务单元20都能够获取令牌。In this embodiment, the token set may be a set of the tokens in the token management unit 22. At least one token is included in the token set. When the token management unit 22 receives the token acquisition request sent by the service unit 20, the token management unit 22 may be from the at least one token set. The token unit collects at least one token to allocate the service unit 20, and ensures that the service unit 20 corresponding to the plurality of token acquisition requests can acquire the token.
在本实施方式中,所述令牌集可以有最大令牌数量限制。所述令牌集的最大令牌数量小于或等于所述处理单元处理业务数据的能力,如果大于所述处理单元24处理业务数据的能力会造成获取令牌的业务数据要大于处理单元24的处理能力,导致一些业务数据不能够被处理,也不能达到限流的作用。In this embodiment, the token set may have a maximum number of tokens. The maximum number of tokens of the token set is less than or equal to the processing unit's ability to process the service data. If the processing unit 24 is larger than the processing unit 24, the service data of the acquiring token is greater than the processing of the processing unit 24. The ability to cause some business data can not be processed, nor can it achieve the role of current limiting.
在本实施方式中,令牌管理单元22可以按照指定规则维持所述令牌集中的令牌数 量,所述指定规则可以是预先设定的,也可以是根据当前网络状况而设定的。当所述令牌集的数量满足至少一个指定规则时,由所述令牌管理单元22向所述令牌集补充令牌。通过指定规则维持令牌集中的令牌数量,可以使所述处理单元24按照预先设定的速率和方式处理业务数据或者根据当前网络状况而改变处理速率和方式从而适应当前网络状况,使网络状况维持在一个可控的范围内。In this embodiment, the token management unit 22 may maintain the number of tokens in the token set according to a specified rule, and the designation rule may be preset or may be set according to current network conditions. When the number of token sets satisfies at least one specified rule, the token management unit 22 supplements the token with the token set. By specifying the number of tokens in the token set, the processing unit 24 can process the service data according to a preset rate and manner or change the processing rate and mode according to the current network condition to adapt to the current network condition and make the network status. Maintained within a manageable range.
在本实施方式中,指定规则可以包括:每间隔指定时间,向所述令牌集中添加指定数量的令牌;当所述业务单元20使用得到令牌之后,所述令牌管理单元22向所述令牌集增加相应数量的令牌。In this embodiment, the specifying the rule may include: adding a specified number of tokens to the token set every specified time interval; and after the service unit 20 uses the obtained token, the token management unit 22 The token set adds a corresponding number of tokens.
在本实施方式中,将所述令牌集中的令牌发送给发出所述令牌获取请求的业务单元20可以包括,如图1中步骤11所示,所述令牌管理单元22接收令牌获取请求。所述令牌管理单元22在接收到所述业务单元20发送的令牌获取请求后,如图1中步骤12所示,令牌管理单元22检查令牌集中的令牌数量是否大于令牌获取数额,所述令牌管理单元20可以检查当前所述至少一个令牌集中的令牌数量,并与所述业务单元20发送的令牌获取数额比较。如果所述令牌管理单元22当前所述至少一个令牌集中的令牌数量大于所述业务单元发送的令牌获取数额时,如图1中步骤S13所示,将令牌发送给所述业务单元20。具体地,可以从所述令牌集中扣减相应数量的令牌,根据请求令牌的业务单元20的网络地址将所述令牌发送给所述业务单元20。如果所述令牌管理单元22当前的总令牌数量小于所述业务单元20发送的令牌获取数额,如图1中步骤S15所示,业务单元等待令牌管理单元补充令牌。具体地,所述令牌管理单元22可以向所述业务单元20反馈信息,并将所述业务单元20发送的获取请求列入请求队列,等待令牌管理单元22补充令牌;也可以将所述令牌获取请求放入请求队列,在所述令牌集中具有令牌时,向令牌获取请求相对应的业务单元20发送通知信息,通知所述业务单元20重新发送令牌获取请求。在所述令牌管理单元补充完令牌后,如图1中步骤S16所示,将令牌发送给所述业务单元20,具体地,所述令牌管理单元22可以根据请求令牌的业务单元20的网络地址将所述令牌发送给所述业务单元20。In this embodiment, sending the token in the token set to the service unit 20 that issues the token acquisition request may include, as shown in step 11 in FIG. 1, the token management unit 22 receives the token. Get the request. After receiving the token acquisition request sent by the service unit 20, the token management unit 22 checks whether the number of tokens in the token set is greater than the token acquisition, as shown in step 12 in FIG. The amount, the token management unit 20 may check the number of tokens in the current at least one token set and compare it with the token acquisition amount sent by the business unit 20. If the number of tokens in the at least one token set of the token management unit 22 is greater than the token acquisition amount sent by the service unit, the token is sent to the service as shown in step S13 in FIG. Unit 20. Specifically, a corresponding number of tokens may be deducted from the token set, and the token is sent to the service unit 20 according to the network address of the service unit 20 of the request token. If the current total token amount of the token management unit 22 is smaller than the token acquisition amount sent by the service unit 20, as shown in step S15 of FIG. 1, the service unit waits for the token management unit to supplement the token. Specifically, the token management unit 22 may feed back information to the service unit 20, and include the acquisition request sent by the service unit 20 in the request queue, and wait for the token management unit 22 to supplement the token; The token acquisition request is placed in the request queue. When the token has a token, the service unit 20 corresponding to the token acquisition request sends notification information to notify the service unit 20 to resend the token acquisition request. After the token management unit supplements the token, as shown in step S16 of FIG. 1, the token is sent to the service unit 20. Specifically, the token management unit 22 may perform the service according to the request token. The network address of unit 20 sends the token to the service unit 20.
在本实施方式中,所述处理单元24用于按照指定处理规则对具有所述令牌的业务单元20提供的业务数据进行处理。In this embodiment, the processing unit 24 is configured to process the service data provided by the service unit 20 having the token according to a specified processing rule.
在本实施方式中,所述处理单元24可以包括能够处理并行数据的服务器或者是其他电子设备和驱动硬件设备工作所必须要的软件。当然,处理也可以仅为具有数据处理能力的硬件设备,或者,仅为运行在硬件设备中的软件。所述并行数据可以是服务器或 其他电子设备内包含的一组处理单元,每个处理单元存储一个或多个数据元素。当机器执行顺序程序时,可对应于全部或部分的内部处理单元所存的数据同时操作。所述处理单元24可以提供有接口,通过该接口可以进行数据交互。所述处理单元可以基于可以遵循网络通信协议进行网络数据信息交互。In the present embodiment, the processing unit 24 may include a server capable of processing parallel data or software necessary for other electronic devices and driving hardware devices to operate. Of course, the processing may also be only a hardware device with data processing capability, or only software running in a hardware device. The parallel data may be a set of processing units contained within a server or other electronic device, each processing unit storing one or more data elements. When the machine executes the sequential program, the data stored in all or part of the internal processing unit can be operated simultaneously. The processing unit 24 can be provided with an interface through which data interaction can be performed. The processing unit can perform network data information interaction based on a network communication protocol that can be followed.
具体地,所述处理单元24可以是网关,在消息投递过程中,至少一个业务单元20同时向用户终端发送消息,通过调用网关接口,网关将至少一个业务单元20发送的消息重新打包,并发送给用户终端;所述处理单元24也可以是搜索引擎,由用户通过用户终端输入搜索信息,执行搜索任务的线程调用搜索引擎接口,由搜索引擎搜索相应的信息。当然,所属领域技术人员在本说明书技术精髓启示下,还可以做出其它变更,所述处理单元24还可以处理其它的业务功能,但只要其实现的功能或效果与本申请相同或相似,均应涵盖于本申请保护范围内。Specifically, the processing unit 24 may be a gateway. In the message delivery process, at least one service unit 20 simultaneously sends a message to the user terminal. By calling the gateway interface, the gateway repackages and sends the message sent by the at least one service unit 20. The processing unit 24 may also be a search engine. The user inputs the search information through the user terminal, and the thread that executes the search task invokes the search engine interface, and the search engine searches for the corresponding information. Of course, those skilled in the art can make other changes under the inspiration of the technical essence of the specification, and the processing unit 24 can also process other business functions, but as long as the functions or effects thereof are the same or similar to the present application, It should be covered by the scope of this application.
在本实施方式中,所述指定处理规则可以是预先设定的也可是根据当前网络状况而变化的。如图1中步骤S14和S17所示,业务单元24处理业务数据,当业务单元24提供的业务数据满足至少一个预先设定的指定处理规则时,便对所述业务数据进行处理。所述指定处理规则可以包括,当业务单元20提供的业务数据中包含有令牌时,则所述处理单元24对业务数据进行处理;当多个具有不同优先级且包含有令牌的业务数据同时到达时,将优先级高的业务数据优先处理。In this embodiment, the specified processing rule may be preset or may be changed according to current network conditions. As shown in steps S14 and S17 of FIG. 1, the service unit 24 processes the service data, and when the service data provided by the service unit 24 satisfies at least one predetermined specified processing rule, the service data is processed. The specified processing rule may include: when the service data provided by the service unit 20 includes a token, the processing unit 24 processes the service data; when a plurality of service data having different priorities and including the token When arriving at the same time, the service data with higher priority is prioritized.
请参阅图3,在一个场景示例中,数据处理系统的架构为一个平台服务器,一个令牌服务器,一个信息发送网关。Referring to FIG. 3, in a scenario example, the data processing system is structured as a platform server, a token server, and an information sending gateway.
在本场景示例中平台要组织限时促销活动,在限时促销活动尚未开始时,平台服务器要向平台的注册会员的手机以短信的形式发送限时促销活动的相关信息。In this scenario example, the platform organizes a time-limited promotion. When the time-limited promotion has not started, the platform server sends the information about the limited-time promotion to the mobile phone of the registered member of the platform in the form of a short message.
在本场景示例中平台服务器要发送的短信数量为20万条,在发送这20万条短信的过程中需要调用信息发送网关的接口将这20万条短信发送给注册会员的手机,另外,平台服务器还要向令牌服务器发送令牌获取请求来获取令牌,从而使这20万条短信可以通过信息发送网关发送给注册会员的手机,并且平台服务器规定当没有短信需要发出时就不再向令牌服务器发送令牌获取请求。In this scenario example, the number of SMS messages to be sent by the platform server is 200,000. In the process of sending the 200,000 SMS messages, the interface of the information sending gateway needs to be called to send the 200,000 SMS messages to the mobile phone of the registered member. In addition, the platform The server also sends a token acquisition request to the token server to obtain the token, so that the 200,000 messages can be sent to the registered member's mobile phone through the information sending gateway, and the platform server stipulates that when there is no short message to be sent, the server no longer The token server sends a token get request.
在本场景示例中,信息发送网关每秒能够处理并向注册会员的手机发送短信的能力是2万条。In this scenario example, the ability of the messaging gateway to process and send text messages to registered members' mobile phones per second is 20,000.
在本场景示例中,令牌服务器管理1个令牌集,这个令牌集中包含2万个令牌,且 令牌服务器设定每间隔1秒向令牌集补充一次令牌,每次补充都将令牌集的容量补满。In this scenario example, the token server manages a token set that contains 20,000 tokens, and the token server sets a token to the token set every 1 second, each time Fill up the capacity of the token set.
在本场景示例中,令牌服务器接收到平台服务器发送的20万条令牌获取请求,查询到令牌集中有2万个令牌,将这2万个令牌发送给平台服务器,并向平台服务器发送反馈信息,通知平台服务器当前令牌集的令牌数为0,让平台服务器在接收到令牌后每间隔1秒发送2万条令牌获取请求,直到数据处理完毕。在发送完令牌和反馈信息后令牌补充单元开始补充令牌。业务服务器接收到令牌服务器发送的2万条令牌以及反馈信息后,将接收到的2万个令牌随机分配给2万个执行短信发送任务的线程,每个线程执行1条短信发送任务,并由这2万个线程同时调用信息发送网关的接口,信息发送网关将这2万条短信发送给注册会员的手机。In this scenario example, the token server receives 200,000 token acquisition requests sent by the platform server, queries 20,000 tokens in the token set, sends the 20,000 tokens to the platform server, and sends the tokens to the platform. The server sends feedback information to notify the platform server that the number of tokens in the current token set is 0, so that the platform server sends 20,000 token acquisition requests every 1 second after receiving the token until the data processing is completed. The token replenishment unit begins to replenish the token after the token and feedback information has been sent. After receiving the 20,000 tokens and feedback information sent by the token server, the service server randomly allocates 20,000 tokens to 20,000 threads that perform SMS sending tasks, and each thread executes one SMS sending task. And the 20,000 threads simultaneously call the interface of the information sending gateway, and the information sending gateway sends the 20,000 text messages to the registered member's mobile phone.
在本场景示例中,平台服务器在接收到令牌后1秒向令牌服务器发送2万条令牌获取请求,令牌服务器将补充的2万个令牌发送给平台服务器,平台服务器再次将2万个令牌随机分配给2万个执行短信发送任务的线程,这些线程调用信息发送网关接口,发送出2万条短信给注册会员的手机。再次重复8次后,将20万条短信发送给注册会员的手机。In this scenario example, the platform server sends 20,000 token acquisition requests to the token server one second after receiving the token, and the token server sends the supplemental 20,000 tokens to the platform server, and the platform server again will Ten thousand tokens are randomly assigned to 20,000 threads that perform SMS sending tasks. These threads call the information sending gateway interface and send out 20,000 SMS messages to the registered member's mobile phone. After repeating 8 times again, 200,000 text messages will be sent to the registered member's mobile phone.
在本场景示例中,通过只有当业务单元从令牌管理单元的至少一个令牌集中获取令牌后,业务单元提供的业务数据才会被处理单元处理的方式,能够减少网络传输数据过程中发生的网络堵塞进而发送数据包丢失的情况,并且通过控制令牌集的令牌补充速率可以进一步控制网络流量。In this scenario example, the service data provided by the service unit is processed by the processing unit only after the service unit acquires the token from the at least one token set of the token management unit, which can reduce the occurrence of the network transmission data. The network congestion in turn sends a packet loss condition, and the network traffic can be further controlled by controlling the token replenishment rate of the token set.
请参阅图4,在一个场景示例中,数据处理系统的架构为多个移动终端,一个令牌服务器,一个搜索引擎。Referring to FIG. 4, in a scenario example, the data processing system is structured as a plurality of mobile terminals, a token server, and a search engine.
在本场景示例中,有3个用户通过移动终端发送搜索世界杯资讯的搜索请求,由搜索引擎响应并处理这些搜索请求,去搜索世界杯资讯。In this scenario example, three users send search requests for searching for World Cup information through the mobile terminal, and the search engine responds and processes the search requests to search for World Cup information.
在本场景示例中,用户通过移动终端向令牌服务器发送令牌获取请求,由令牌服务器从其管理的令牌集取出令牌发送给相应的移动终端,移动终端在获得令牌后,搜索引擎才处理移动终端发送的搜索请求。In this scenario example, the user sends a token acquisition request to the token server through the mobile terminal, and the token server extracts the token from the token set managed by the token server to the corresponding mobile terminal, and the mobile terminal searches after obtaining the token. The engine processes the search request sent by the mobile terminal.
在本场景示例中,令牌服务器管理1个令牌集,该令牌集的令牌最大数量为2个令牌,并设定每间隔1秒添加2个令牌,如果令牌数量达到最大令牌数了就不再添加,如果未达到最大令牌数则继续添加。In this scenario example, the token server manages 1 token set, the maximum number of tokens in the token set is 2 tokens, and sets 2 tokens to be added every 1 second, if the number of tokens reaches the maximum The number of tokens is no longer added, and if the maximum number of tokens is not reached, continue to add.
在本场景示例中,3个用户通过移动终端搜索世界杯资讯,这3个用户终端先后向 令牌服务器发送请求获得1个令牌的令牌获取请求,有2个令牌获取请求同时到达令牌服务器,由令牌服务器从令牌集中取出2个令牌,分别将这2个令牌分别发送给这发送这两个令牌获取请求的移动终端,并在1秒后补充令牌。2个获得令牌的移动终端发送的搜索世界杯资讯的搜索请求被搜索引擎处理,这两个用户通过搜索引擎获得了世界杯资讯。In this scenario example, three users search for World Cup information through the mobile terminal, and the three user terminals send a token acquisition request for obtaining one token to the token server, and two token acquisition requests arrive at the token at the same time. The server receives two tokens from the token set by the token server, respectively sends the two tokens to the mobile terminal that sends the two token acquisition requests, and replenishes the token after one second. The search request for searching for World Cup information sent by the two mobile terminals that obtain the token is processed by the search engine, and the two users obtain the World Cup information through the search engine.
在本场景示例中,第3个令牌获取请求在前2个令牌获取请求达到令牌服务器之后到达令牌服务器,令牌服务器管理的令牌集中没有令牌,令牌服务器就向发送第三个令牌获取请求的移动终端反馈信息,通知第三个移动终端在1秒后再次发送令牌获取请求,1秒后第三个移动终端再次发送令牌获取请求,令牌服务器接收道令牌获取请求后从令牌集中的2个令牌中取出1个令牌分配给移动终端,在1秒后令牌服务器再次补充令牌。在获得令牌后,第三个移动终端发送的搜索世界杯资讯的搜索请求被搜索引擎处理,用户通过搜索引擎获得了世界杯资讯。之后没有用户终端再次发送令牌获取请求,令牌服务器管理的令牌集中始终有2个令牌,并且在令牌没有被消耗的情况下,不再补充令牌。In this scenario example, the third token acquisition request arrives at the token server after the first two token acquisition requests reach the token server. The token server manages the token set without the token, and the token server sends the token. The three tokens acquire the requested mobile terminal feedback information, and notify the third mobile terminal to send the token acquisition request again after 1 second, and after 1 second, the third mobile terminal sends the token acquisition request again, and the token server receives the command. After the card acquisition request, one token is extracted from the two tokens in the token set and assigned to the mobile terminal. After 1 second, the token server replenishes the token again. After obtaining the token, the search request sent by the third mobile terminal for searching for World Cup information is processed by the search engine, and the user obtains the World Cup information through the search engine. After that, no user terminal sends the token acquisition request again. There are always 2 tokens in the token set managed by the token server, and the token is no longer replenished if the token is not consumed.
请参阅图5,在一个场景示例中,数据处理系统的构架为,多个移动终端,一个令牌管理单元,一个搜索引擎。Referring to FIG. 5, in a scenario example, the data processing system is structured as a plurality of mobile terminals, a token management unit, and a search engine.
在本实施方式中,1个用户通过移动终端发送搜索世界杯资讯的搜索请求,由搜索引擎响应并处理这条搜索请求,去搜索世界杯资讯。In the present embodiment, one user transmits a search request for searching for World Cup information through the mobile terminal, and the search engine responds and processes the search request to search for World Cup information.
在本场景示例中,用户通过移动终端向令牌服务器发送令牌获取请求,由令牌服务器从其管理的令牌集取出令牌发送给相应的移动终端,移动终端在获得令牌后,搜索引擎才处理移动终端发送的搜索请求。In this scenario example, the user sends a token acquisition request to the token server through the mobile terminal, and the token server extracts the token from the token set managed by the token server to the corresponding mobile terminal, and the mobile terminal searches after obtaining the token. The engine processes the search request sent by the mobile terminal.
在本场景示例中,令牌服务器管理5个令牌集,这5个令牌集的令牌最大数量为10个,7个,9个,4个,8个,每个令牌集的当前的令牌数量分别是9个,6个,8个,3个,7个,并且为这5个令牌集编号。并设定每间隔1秒添加1个令牌,如果令牌数量达到最大令牌数了就不再添加,如果未达到最大令牌数则继续添加。In this scenario example, the token server manages five token sets. The maximum number of tokens for the five token sets is 10, 7, 9, 4, and 8, each of the current token set. The number of tokens is 9, 6, 8, 3, and 7, respectively, and the number of these 5 token sets is numbered. And set to add 1 token every 1 second interval. If the number of tokens reaches the maximum number of tokens, it will not be added. If the maximum number of tokens is not reached, continue to add.
在本场景示例中,1个用户通过移动终端搜索世界杯资讯,移动终端先令牌服务器发送请求获得1个令牌的令牌获取请求,令牌获取请求同时到达令牌服务器,令牌服务器随机选中令牌集2,查询令牌集中的令牌数,从令牌集2中的6个令牌取出1个,发送给用户的移动终端,移动终端在获得令牌后,发送的搜索请求被搜索引擎处理,用户获得世界杯资讯的搜索结果。In this scenario example, one user searches for World Cup information through the mobile terminal, and the mobile terminal first sends a token acquisition request requesting to obtain one token, and the token acquisition request arrives at the token server at the same time, and the token server randomly selects Token Set 2, the number of tokens in the token set is retrieved, and one of the six tokens in the token set 2 is taken out and sent to the user's mobile terminal. After the mobile terminal obtains the token, the search request sent is searched. The engine processes the user's search results for World Cup information.
在本场景示例中,如果选中的令牌集2中的令牌数为0,令牌服务器查询与令牌集2前后相邻的令牌集1和令牌集3中的令牌个数,分别是9个和8个,令牌服务器选择从令牌集1中取出1个令牌,发送给移动终端,移动终端在获得令牌后,发送的搜索请求被搜索引擎处理,用户获得世界杯资讯的搜索结果。In this scenario example, if the number of tokens in the selected token set 2 is 0, the token server queries the number of tokens in the token set 1 and the token set 3 adjacent to the token set 2, There are 9 and 8 respectively. The token server chooses to take 1 token from the token set 1 and send it to the mobile terminal. After the mobile terminal obtains the token, the search request sent by the mobile terminal is processed by the search engine, and the user obtains the World Cup information. Search results.
在本场景示例中,令牌服务器每秒添加1个令牌,令牌服务器随机选择一个令牌集,选中令牌集3,令牌集3中有8个令牌,令牌服务器查询与令牌集3前后相邻的令牌集2和令牌集4中令牌的个数,分别是6个和3个,其中令牌集4中的令牌数最少,且令牌集4中的令牌数未达到最大令牌数,向令牌集4中添加1个令牌。In this scenario example, the token server adds 1 token per second, the token server randomly selects a token set, selects token set 3, and token token 3 has 8 tokens. Token server query and order The number of tokens in token set 2 and token set 4 adjacent to card set 3 is 6 and 3 respectively, wherein the number of tokens in token set 4 is the least, and in token set 4 The number of tokens does not reach the maximum number of tokens, and one token is added to token set 4.
在一个实施方式中,所述业务单元具有需要被所述处理单元进行处理的业务数据之后,才向所述令牌管理单元发送所述令牌获取请求。In one embodiment, the service unit has the service data that needs to be processed by the processing unit before sending the token acquisition request to the token management unit.
在本实施方式中,在业务单元有业务数据需要被所述处理单元进行处理时,业务单元才可以向令牌管理单元发送令牌获取请求,从而从令牌管理单元获取令牌;在业务单元没有需要所述处理单元处理的数据时,业务单元不可以向令牌管理单元发送令牌获取请求,进而无法获得令牌。In this embodiment, when the service unit has service data to be processed by the processing unit, the service unit may send a token acquisition request to the token management unit, thereby acquiring the token from the token management unit; When there is no data required by the processing unit, the service unit may not send a token acquisition request to the token management unit, and thus the token cannot be obtained.
在本实施方式中,通过限制所述业务单元向所述令牌管理单元发送令牌获取请求的方式,即只有当业务单元有需要被所述处理单元处理的业务数据时,业务单元才可以向所述令牌管理单元发送令牌获取请求,提高了令牌分配效率,减少了当有业务数据需要处理的业务单元需求令牌时,所述令牌集中无令牌可用,而没有业务数据需要处理的业务单元又有空闲的令牌所造成的网络资源浪费。In this embodiment, by limiting the manner in which the service unit sends a token acquisition request to the token management unit, that is, only when the service unit has service data that needs to be processed by the processing unit, the service unit can The token management unit sends a token acquisition request, which improves the token allocation efficiency and reduces the number of tokens available in the token set when there is a service unit demand token that needs to be processed by the service data, and no service data is needed. The processed business unit has a waste of network resources caused by idle tokens.
在一个实施方式中,所述业务单元包括多个任务,该多个任务具有不同的任务优先级;具有指定任务优先级的任务能在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求。In one embodiment, the service unit includes a plurality of tasks having different task priorities; the task having the specified task priority can send the to the token management unit before having the service data Token get request.
在本实施方式中,所述业务单元包括多个任务。可以为,所述业务单元可以实现一定的业务功能,业务功能的实现需要业务单元执行多个不同的任务。所述业务单元中具有执行不同任务的线程,相应的至少一条业务数据可以被分配到不同的线程中以备执行,并由这些线程从所述令牌管理单元获取令牌或和/或调用处理单元接口让所述处理单元对这多个业务数据进行处理进而实现业务功能。In this embodiment, the service unit includes a plurality of tasks. The service unit can implement a certain service function, and the implementation of the service function requires the service unit to perform a plurality of different tasks. Having threads executing different tasks in the service unit, corresponding at least one piece of service data may be allocated to different threads for execution, and the threads may acquire tokens and/or call processing from the token management unit. The unit interface allows the processing unit to process the plurality of service data to implement a service function.
在本实施方式中,该多个任务具有不同的任务优先级。可以为,所述业务单元中具 有执行不同任务的线程,相应的业务数据可以被分配到不同的线程中以备执行,所述业务单元为不同的任务线程设定不同的优先级,其中,优先级高的线程中的业务数据可以优先被执行。In this embodiment, the plurality of tasks have different task priorities. The service unit may have threads for performing different tasks, and corresponding service data may be allocated to different threads for execution, and the service unit sets different priorities for different task threads, wherein, priority is given. Business data in a high-level thread can be executed with priority.
在本实施方式中,所述指定优先级可以是预先设定的,当任务满足预先设定的优先级要求时,执行该任务的线程可以优先其他线程,在需要被处理单元处理的业务数据产生之前就可以像所述令牌管理单元发送令牌获取请求。In this embodiment, the specified priority may be preset. When the task meets a preset priority requirement, the thread executing the task may prioritize other threads, and generate service data that needs to be processed by the processing unit. The token acquisition request can be sent before the token management unit.
具体地,例如,平台服务器向用户客户端推送消息,用户可以分为VIP用户和普通用户,平台服务器将执行VIP用户消息推送的线程设定为高优先级,将执行普通用户消息推送的线程中设定为低优先级。执行VIP用户消息推送的线程可以在要进行消息推送之前就提前向令牌管理单元发送令牌获取请求,在具有业务数据时可以立即获得令牌,保证推送给VIP用户的消息可以被优先处理。Specifically, for example, the platform server pushes a message to the user client, and the user can be divided into a VIP user and a normal user. The platform server sets the thread that performs the push of the VIP user message to a high priority, and the thread that performs the normal user message push is executed. Set to low priority. The thread that performs the push of the VIP user message can send the token acquisition request to the token management unit in advance before the message is pushed. When the service data is available, the token can be obtained immediately, and the message pushed to the VIP user can be preferentially processed.
在本实施方式中,通过为所述业务单元的不同任务设置不同优先级,具有指定优先级的任务可以在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求的方式。保证重要的业务数据可以被优先处理,也降低了重要的业务数据被丢失的可能性,进一步提高了数据处理的效率与性能。In this embodiment, by setting different priorities for different tasks of the service unit, the task having the specified priority may send the token acquisition request to the token management unit before having the service data. Ensure that important business data can be prioritized, and reduce the possibility of important business data being lost, further improving the efficiency and performance of data processing.
在一个实施方式中,所述业务单元之间具有不同的业务优先级;具有指定业务优先级的业务单元的任务能在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求。In one embodiment, the service units have different service priorities; the task of the service unit with the specified service priority can send the token acquisition request to the token management unit before having the service data. .
在本实施方式中,所述业务单元之间具有不同的业务优先级。可以为不同的业务单元可以实现不同的业务功能,业务功能的实现需要执行一定的任务,业务单元中具有至少一个线程来执行任务。不同业务单元所要实现的不同的业务功能之间可以有不同的优先级,因此为不同的业务单元设定不同的优先级。相应的业务数据可以被分配到各个相应的业务单元的执行线程中以备执行,其中,优先级高的线程中的业务数据可以优先被执行。In this embodiment, the service units have different service priorities. Different business functions can be implemented for different business units. The implementation of business functions requires execution of certain tasks, and the business unit has at least one thread to perform tasks. Different business functions to be implemented by different business units may have different priorities, so different priorities are set for different business units. Corresponding service data can be allocated to the execution thread of each respective service unit for execution, wherein the service data in the thread with higher priority can be executed preferentially.
在本实施方式中,所述指定业务优先级可以是预先设定的,当业务单元满足预先设定的优先级要求时,执行该业务单元的业务数据的线程可以优先其他线程,在需要被处理单元处理的业务数据产生之前就可以向所述令牌管理单元发送令牌获取请求。In this implementation manner, the specified service priority may be preset, and when the service unit meets a preset priority requirement, the thread that executes the service data of the service unit may be prioritized by other threads, and needs to be processed. A token acquisition request may be sent to the token management unit before the unit processed business data is generated.
具体地,例如,用户通过用户终端访问网站,用户可以分为VIP用户和普通用户,在网站访问量较大的情况下,VIP用户登录用户终端,这时用户终端在执行网站访问任 务的线程中设置有优先级为高的优先级信息;普通用户登录用户终端,这时用户终端在执行网站访问的线程中设置有优先级为低的优先级信息。VIP用户终端执行网站访问的线程就可以在用户要访问网站之前就向令牌管理单元发送令牌获取请求,而普通用户终端只能等到用户进行网站访问时才可以向令牌管理单元发送令牌获取请求,保证了VIP用户可以优先访问网站。Specifically, for example, the user accesses the website through the user terminal, and the user can be divided into a VIP user and a normal user. When the website has a large amount of access, the VIP user logs in to the user terminal, and the user terminal is in the thread that performs the website access task. The priority information with the priority being high is set; the ordinary user logs in to the user terminal, and the user terminal sets the priority information with the lower priority in the thread that performs the website access. The thread that the VIP user terminal performs website access can send a token acquisition request to the token management unit before the user wants to visit the website, and the ordinary user terminal can only send the token to the token management unit when the user visits the website. Obtaining a request ensures that VIP users can prioritize access to the website.
在本实施方式中,通过为所述业务单元设置不同优先级,具有指定业务优先级的业务单元可以在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求的方式。保证重要的业务单元的业务数据可以被优先处理,也降低了重要的业务单元的业务数据被丢失的可能性,进一步提高了数据处理的效率和性能。In this embodiment, by setting different priorities for the service unit, the service unit having the specified service priority may send the token acquisition request to the token management unit before having the service data. It ensures that the business data of important business units can be prioritized, and the possibility that the business data of important business units is lost is also reduced, further improving the efficiency and performance of data processing.
在一个实施方式中,所述指定规则包括以下至少之一:每间隔指定时间,向所述令牌集中添加指定数量的令牌;或者,当所述业务单元使用得到的令牌之后,所述令牌管理单元向所述令牌集增加相应数量的令牌。In one embodiment, the specified rule includes at least one of: adding a specified number of tokens to the token set every specified time interval; or, after the service unit uses the obtained token, the The token management unit adds a corresponding number of tokens to the token set.
在本实施方式中,所述指定时间可以是预先设定的也可以是根据当前网络状况设定的,每当间隔所述指定时间后,所述令牌管理单元就向所述令牌集中添加令牌。所述指定时间可以是恒定的也可以是变化的。In this embodiment, the specified time may be preset or may be set according to a current network condition, and the token management unit adds to the token set every time after the specified time interval Token. The specified time may be constant or varied.
具体地,所述令牌管理单元预先设定,每当间隔2秒就向令牌集中添加一定数量的令牌;或者所述令牌管理单元预先设定,第一次向业务单元发送令牌后,间隔2秒向令牌集补充令牌,第二次向业务单元发送令牌后,间隔5秒向令牌集补充令牌,每次向业务单元发送令牌后,间隔不同时间补充令牌;或者当前需要处理的网络数据较多时,每间隔1秒就向令牌集补充令牌,当需要处理的网络数据较少时,调整指定时间,每间隔5秒就像令牌集补充令牌。Specifically, the token management unit presets that a certain number of tokens are added to the token set every 2 seconds; or the token management unit presets to send a token to the business unit for the first time. After that, the token is added to the token set at intervals of 2 seconds. After the token is sent to the service unit for the second time, the token is added to the token set at intervals of 5 seconds. After each token is sent to the service unit, the interval is supplemented at different intervals. Card; or when there is more network data to be processed at present, the token is added to the token set every 1 second. When the network data to be processed is small, the specified time is adjusted, and the interval is 5 seconds. brand.
在本实施方式中,所述指定数量可以是预先设定的也可以是根据当前网络状况设定的,每当间隔预先设定的指定时间,所述令牌管理单元就向所述令牌集中添加所述指定数量的令牌。所述指定数量可以是恒定的也可以是变化的。In this embodiment, the specified number may be preset or may be set according to a current network condition, and the token management unit concentrates on the token every time the interval is preset. Add the specified number of tokens. The specified number can be constant or varied.
具体地,所述令牌管理单元预先设定,每隔2秒就向就向令牌集中添加2个令牌,无论每一次令牌发放间隔时间多少每次都添加两个令牌;或者所述令牌管理单元预先设定,第一次向业务单元发送令牌后,间隔2秒向令牌集补充2个令牌,第二次向业务单元发送令牌后,间隔5秒向令牌集补充5个令牌,每次向令牌集添加令牌后,间隔不同的时间发送不同数量的令牌;或者当需要处理的网络数据较多时,每次补充5张令牌, 当需要处理的网络数据较少时,调整指定数量,每次补充1张令牌。Specifically, the token management unit presets to add two tokens to the token set every 2 seconds, and adds two tokens each time the token issuance interval; or The token management unit presets that after sending the token to the service unit for the first time, the token set is supplemented with two tokens at intervals of 2 seconds, and after the token is sent to the service unit for the second time, the token is sent to the token for 5 seconds. The set adds 5 tokens, each time a token is added to the token set, and a different number of tokens are sent at different intervals; or when there are more network data to be processed, 5 tokens are added each time, when it needs to be processed When the network data is small, adjust the specified quantity and add one token at a time.
在本实施方式中,所述令牌管理单元预先设定或根据当前获取网络状况设定,在业务单元获取并使用从令牌管理单元获取的令牌后,所述业务单元使用了多少令牌,就由令牌管理单元向令牌集补充多少令牌。In this embodiment, the token management unit presets or according to the current acquisition network status setting, how many tokens are used by the service unit after the service unit acquires and uses the token acquired from the token management unit. How many tokens are added to the token set by the token management unit.
具体地,令牌管理单元向业务单元发送5个令牌,业务单元将这5个令牌全部使用了,这时令牌管理单元就向所述令牌集补充5个令牌。Specifically, the token management unit sends 5 tokens to the service unit, and the service unit uses all 5 tokens. At this time, the token management unit adds 5 tokens to the token set.
在本实施方式中,通过指定一定的规则,由令牌管理单元向所述令牌集中补充令牌的方式。根据网络状况,控制令牌补充的速率和数量,进一步完善网络流量的整形,避免网络拥塞。In the present embodiment, the token management unit adds a token to the token set by specifying a certain rule. According to the network status, control the rate and quantity of token replenishment, further improve the shaping of network traffic and avoid network congestion.
在一个实施方式中,在所述令牌集中令牌的数量达到最大令牌数时,停止向所述令牌集中添加令牌。In one embodiment, when the number of tokens in the token set reaches a maximum number of tokens, the addition of tokens to the token set is stopped.
在本实施方式中,所述令牌集数量达到最大令牌数可以为,所述令牌集存在数量阀值,该阀值即为该令牌集的最大容量。所述令牌集的数量阀值必须小于或等于所述处理单元的最大处理能力,否则就不能起到限流的作用。In this embodiment, the number of token sets reaching the maximum number of tokens may be, the token set has a quantity threshold, and the threshold is the maximum capacity of the token set. The threshold of the number of tokens must be less than or equal to the maximum processing capacity of the processing unit, otherwise it will not function as a current limit.
在本实施方式中,所述令牌管理单元可以预先设定当令牌集中的令牌数量达到最大令牌数时,无论满足任何令牌补充规则,都不再向令牌集中补充令牌。只有当令牌集中的令牌没有达到令牌最大令牌数,且满足预先设定的令牌补充规则时,才可以向所述令牌集补充令牌。In this embodiment, the token management unit may preset that when the number of tokens in the token set reaches the maximum number of tokens, the token is no longer replenished to the token set regardless of any token supplementation rules. The token can be replenished to the token set only if the token in the token set does not reach the token maximum token count and the predetermined token supplementation rule is met.
在本实施方式中,通过设定最大令牌数的方式限制令牌管理单元向所述令牌集补充令牌的方式。在令牌集达到最大令牌数后停止向令牌集补充令牌可以节约网络资源。In the present embodiment, the manner in which the token management unit replenishes the token set to the token set is restricted by setting the maximum number of tokens. Stopping the token to the token set after the token set reaches the maximum number of tokens can save network resources.
在一个实施方式中,在所述令牌管理单元接收到所述令牌获取请求时,所述令牌集中没有令牌的情况下,所述令牌管理单元对所述令牌获取请求的处理方式包括至少以下之一:向发出所述令牌获取请求的业务单元发出反馈信息,以通知所述业务单元重新发出令牌获取请求;或者,将所述令牌获取请求放入请求队列,在所述令牌集中具有令牌时,将所述令牌分配给所述请求队列中令牌获取请求对应的业务单元;或者,将所述令牌获取请求放入请求队列,在所述令牌集中具有令牌时,向所述请求队列中的令牌获取请求对应的业务单元发出通知信息,以通知所述业务单元重新发出令牌获取请求。In an embodiment, when the token management unit receives the token acquisition request, if the token set has no token, the token management unit processes the token acquisition request. The method includes at least one of: sending a feedback message to a service unit that issues the token acquisition request to notify the service unit to reissue a token acquisition request; or placing the token acquisition request into a request queue, When the token set has a token, the token is allocated to the service unit corresponding to the token acquisition request in the request queue; or the token acquisition request is placed in the request queue, where the token is When the token has a token, the service unit corresponding to the token acquisition request in the request queue issues notification information to notify the service unit to reissue the token acquisition request.
在本实施方式中,所述反馈信息可以是按照固定格式编写的字符串或代码,所述令 牌管理单元查询当前令牌集中的令牌数量,若令牌集中令牌数量为0,向业务单元发送所述反馈信息。其中,所述反馈信息中可以包括:当前令牌集中令牌的数量,间隔多长时间业务单元可以再次发送令牌获取请求,可以请求的令牌数量等。通知所述业务单元令牌获取失败,在间隔一定时间后或者立即再次发送令牌获取请求的时间信息等。In this embodiment, the feedback information may be a character string or code written in a fixed format, and the token management unit queries the number of tokens in the current token set. If the number of tokens in the token set is 0, the service is sent to the service. The unit sends the feedback information. The feedback information may include: the number of tokens in the current token set, and how long the service unit can send the token acquisition request, the number of tokens that can be requested, and the like. Notifying the service unit that the token acquisition fails, and transmitting the time information of the token acquisition request, etc., after a certain time interval or immediately.
具体地,业务单元向令牌管理单元发送令牌获取请求,令牌管理单元查询当前令牌集中的令牌数量,当前令牌集中的令牌数量为0,令牌管理单元向业务单元发送反馈信息,通知业务单元当前令牌集中令牌数量为0,并通知业务单元在1秒后再次向令牌管理单元发送令牌获取请求。Specifically, the service unit sends a token acquisition request to the token management unit, and the token management unit queries the number of tokens in the current token set. The number of tokens in the current token set is 0, and the token management unit sends feedback to the service unit. The information informs the service unit that the current token set number of tokens is 0, and notifies the service unit to send the token acquisition request to the token management unit again after 1 second.
在本实施方式中,所述请求队列可以是缓存区或者是存储单元,用于存储所述未请求到令牌的令牌获取请求。请求队列对进入请求队列的令牌获取请求编号,编号的方式可以包括,按照进入的时间来编号;按照发送令牌获取请求业务单元或者任务的优先级编号,优先级越高,编号越靠前,在所述令牌集补充令牌后,按照编号依次对令牌获取请求对应的业务单元分配令牌。In this embodiment, the request queue may be a buffer area or a storage unit, and is configured to store the token acquisition request that is not requested to the token. The request queue obtains the request number of the token that enters the request queue. The numbering method may include: numbering according to the time of entry; obtaining the priority number of the service unit or task according to the sending token, the higher the priority, the higher the number After the token set is supplemented with the token, the token is obtained by assigning the token to the service unit corresponding to the token acquisition request.
具体地,多个业务单元可以同时向令牌管理单元发送令牌获取请求,令牌管理单元查询当前令牌集中的令牌数量,当令牌集中令牌数量为0时,可以将令牌获取请求按照请求时间依次放入请求队列并编号,当令牌集补充令牌后,对请求队列中的令牌获取请求对应的业务单元按照编号依次分配令牌。Specifically, the multiple service units may simultaneously send a token acquisition request to the token management unit, and the token management unit queries the number of tokens in the current token set. When the number of tokens in the token set is 0, the token may be acquired. The request is placed in the request queue and numbered according to the request time. After the token set is supplemented with the token, the service unit corresponding to the token acquisition request in the request queue is sequentially assigned the token according to the number.
在本实施方式中,在令牌集补充令牌后,可以由令牌补充单元按照编号依次向所述请求队列中的令牌获取请求对应的业务单元发送通知信息,通知所述业务单元可以立即或者间隔一段时间后再次发送令牌获取请求。In this embodiment, after the token set is supplemented with the token, the token supplementing unit may sequentially send the notification information to the service unit corresponding to the token acquisition request in the request queue according to the number, and notify the service unit that the service unit can immediately Or send the token acquisition request again after a period of time.
在本实施方式中,在所述令牌集中没有令牌的情况下,通过向所述业务单元发送反馈信息和/或将令牌获取请求放入请求队列的方式分配令牌。减少了当业务单元发送令牌获取请求时刚好令牌集中没有令牌所导致的业务数据处理失败的情况,提高了处理业务数据的效率与稳定性。In the present embodiment, in the case where there is no token in the token set, the token is allocated by transmitting feedback information to the service unit and/or placing the token acquisition request in the request queue. The service data processing failure caused by the absence of the token in the token set when the service unit sends the token acquisition request is reduced, and the efficiency and stability of processing the service data are improved.
在一个实施方式中,所述令牌集的数量为多个;所述指定规则包括:在多个令牌集中选择一个令牌集,将所述令牌集与相邻的令牌集数量进行比较,在数量较少的令牌集中增加指定数量的令牌。In one embodiment, the number of the token sets is plural; the specifying rule includes: selecting one token set in a plurality of token sets, and performing the token set with an adjacent token set number Compare, add a specified number of tokens in a small number of token sets.
在本实施方式中,所述令牌管理单元可以管理多个令牌集,通过管理多个令牌集,防止所述业务单元对单一令牌集每秒的读写次数变大造成的系统可靠性降低。In this embodiment, the token management unit may manage a plurality of token sets, and by managing a plurality of token sets, prevent the service unit from being reliable in a system in which the number of reads and writes per second of the single token set is increased. Reduced sex.
在所述多个令牌集中,所述令牌管理单元可以随机选择一个令牌集,也可以指向性或按照预先设定的规则选择一个令牌集。查询被选择的令牌集的当前令牌数量,并查询与被选择的令牌集前后相邻或者左右相邻或者上下相邻的令牌集的令牌数量。比较这些令牌集的令牌数量,选择数量较少的令牌集,对数量较小的令牌集补充令牌。In the plurality of token sets, the token management unit may randomly select a token set, or may select a token set by directivity or according to a preset rule. Query the current number of tokens of the selected token set, and query the number of tokens of the token set adjacent to or adjacent to or adjacent to the selected token set. Compare the number of tokens for these token sets, select a smaller number of token sets, and replenish the tokens for a smaller number of token sets.
在本实施方式中,所述指定数量可以是预先设定的也可以是根据当前网络状况设定的,可以包括,增加固定的令牌数量;增加变化的令牌数量;间隔固定的时间增加固定的令牌数量;间隔固定的时间增加变化的令牌数量;间隔变化的时间增加固定的令牌数量;间隔变化的时间增加变化的令牌数量等。In this embodiment, the specified number may be preset or may be set according to current network conditions, and may include: increasing the number of fixed tokens; increasing the number of changed tokens; and increasing the fixed interval time. The number of tokens; the fixed interval increases the number of tokens changed; the interval change time increases the number of fixed tokens; the interval change time increases the number of tokens changed, and so on.
在本实施方式中,通过管理多个令牌集,并从中选择一个令牌集,比较被选择的令牌集与相邻的令牌集的令牌数的多少,为令牌数较少的令牌集补充令牌的方式,进一步降低了业务单元发送令牌获取请求后,所述令牌管理单元选择到空令牌集向业务单元分配令牌的可能性,并减少了令牌获取的等待时间。In this embodiment, by managing a plurality of token sets and selecting a token set therefrom, the number of tokens of the selected token set and the adjacent token set is compared, and the number of tokens is small. The manner in which the token set is supplemented with the token further reduces the possibility that the token management unit selects the empty token set to allocate the token to the service unit after the service unit sends the token acquisition request, and reduces the token acquisition. waiting time.
在一个实施方式中,在所述被选择的令牌集及其相邻的令牌集中令牌的数量均达到最大令牌数时,停止添加令牌。In one embodiment, the addition of the token is stopped when the number of tokens in the selected token set and its neighboring token set reaches the maximum number of tokens.
在本实施方式中,所述令牌管理单元可以预先设定,当选择令牌集后,查询被选择的令牌集当前的令牌数量与被选择的令牌集相邻的令牌集的当前令牌数量,如果被选择的令牌集与被选择的令牌集相邻的令牌集的令牌数量均达到各自的最大令牌数时,则无论满足任何令牌补充规则都停止令牌的补充。In this embodiment, the token management unit may preset, after selecting the token set, query the current token number of the selected token set and the token set adjacent to the selected token set. The current number of tokens, if the number of tokens of the selected token set and the token set adjacent to the selected token set reaches their respective maximum number of tokens, then the stop order is satisfied regardless of any token supplemental rules. Card supplement.
在本实施方式中,通过设定最大令牌数的方式限制令牌管理单元向被选择的令牌集以及与被选择的令牌集相邻的令牌集补充令牌。在令牌集达到最大令牌数后停止向令牌集补充令牌可以节约网络资源。In the present embodiment, the token management unit is restricted from replenishing the token set to the selected token set and the token set adjacent to the selected token set by setting the maximum number of tokens. Stopping the token to the token set after the token set reaches the maximum number of tokens can save network resources.
在一个实施方式中,所述令牌集的数量为多个;每个所述令牌集对应一个最大令牌数;其中,至少部分令牌集的最大令牌数与其他令牌的最大令牌数不同。In an embodiment, the number of the token sets is multiple; each of the token sets corresponds to a maximum number of tokens; wherein, the maximum number of tokens of at least part of the token set and the maximum number of other tokens The number of cards is different.
在本实施方式中,令牌管理单元管理多个令牌集,其中每一个令牌集都对应一个最大令牌数,且最大令牌数小于或者等与所述处理单元的业务数据处理能力。在所述令牌管理单元管理的令牌集中可以至少有一个与其他的令牌集的令牌数量不同,也可以所有的令牌集的令牌数量均不同。In this embodiment, the token management unit manages a plurality of token sets, wherein each token set corresponds to a maximum number of tokens, and the maximum number of tokens is less than or equal to the service data processing capability of the processing unit. At least one of the token sets managed by the token management unit may be different from the number of tokens of other token sets, or the number of tokens of all token sets may be different.
具体地,令牌管理单元管理5个令牌集,这5个令牌集中的最大令牌数分别为5个, 4个,6个,7个,2个,令牌集之间最大令牌个数互不相同。Specifically, the token management unit manages five token sets, and the maximum number of tokens in the five token sets is five, four, six, seven, and two, and the maximum token between the token sets The numbers are different from each other.
在本实施方式中,令牌管理单元可以随意设置多个令牌集的最大令牌数量,令牌管理单元管理的总令牌数小于或等于所述处理单元的处理能力即可,没有将各个令牌集的最大令牌数设置为相同的必要。In this embodiment, the token management unit can arbitrarily set the maximum number of tokens of the plurality of token sets, and the total number of tokens managed by the token management unit is less than or equal to the processing capability of the processing unit, and no The maximum number of tokens for the token set is set to the same as necessary.
在一个实施方式中,所述令牌集的数量为多个;所述令牌管理单元在接收到令牌获取请求后,选择一个令牌集,将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较多的令牌集中分配令牌给发出所述令牌获取请求的业务单元。In one embodiment, the number of the token sets is multiple; after receiving the token acquisition request, the token management unit selects a token set, and the token set and the adjacent token The set performs a token quantity comparison, and assigns a token to a business unit that issues the token acquisition request in a larger number of token sets.
在本实施方式中,所述令牌管理单元可以比较选择的令牌集以及与被选择的令牌集相邻的令牌集的令牌数量。从中选择令牌数较多的令牌集,并从该令牌数较多的令牌集中分配令牌给相应的业务单元。In this embodiment, the token management unit may compare the selected token set with the number of tokens of the token set adjacent to the selected token set. Select a token set with a large number of tokens, and assign a token to the corresponding business unit from the token set with a larger number of tokens.
在本实施方式中,通过比较被选择的令牌集以及与被选择的令牌集相邻的令牌集的令牌数量,选择令牌较多的令牌集分配令牌给相应的业务单元的方式。提高所述业务单元在发送令牌获取请求后不需要等待即可以获得令牌的可能性,提高了相应业务数据被处理的效率。In this embodiment, by comparing the selected token set and the number of tokens of the token set adjacent to the selected token set, the token set allocation token with more tokens is selected for the corresponding business unit. The way. The possibility that the service unit can obtain the token without waiting after sending the token acquisition request is improved, and the efficiency of processing the corresponding service data is improved.
在一个实施方式中,所述令牌集数量为多个,所述令牌管理单元在接收到所述令牌获取请求后,选择一个令牌集,在所述令牌集中令牌数量不能匹配所述令牌获取请求时,在与所述令牌集相邻的令牌集中分配令牌给发出所述令牌获取请求的业务单元。In an embodiment, the number of the token sets is multiple, and after receiving the token obtaining request, the token management unit selects a token set, and the number of tokens in the token set cannot match. When the token acquires a request, a token is allocated to a service unit that issues the token acquisition request in a token set adjacent to the token set.
在本实施方式中,所述令牌管理单元在接收到业务单元发送的令牌获取请求后,可以选择一个令牌集向业务单元分配令牌。In this embodiment, after receiving the token acquisition request sent by the service unit, the token management unit may select a token set to allocate a token to the service unit.
在本实施方式中,如果被选择的令牌集中的令牌数量小于令牌获取请求中请求的令牌数量,所述令牌管理单元可以查询与被选择的令牌集相邻的令牌集当前的令牌数量。In this embodiment, if the number of tokens in the selected token set is smaller than the number of tokens requested in the token acquisition request, the token management unit may query the token set adjacent to the selected token set. The current number of tokens.
在本实施方式中,如果从与被选择的令牌集相邻的令牌集中有一个满足令牌获取请求的请求数量,则从满足令牌获取请求的请求数量的令牌集中分配令牌给业务单元。In this embodiment, if there is one request quantity satisfying the token acquisition request from the token set adjacent to the selected token set, the token is assigned from the token set that satisfies the request quantity of the token acquisition request. Commercian unit.
在本实施方式中,如果相邻的令牌集都满足令牌获取请求的请求数额,可以从相邻的令牌集中随机选择一个令牌集,从中分配令牌给业务单元;也可以从相邻的令牌集中选择当前令牌数最多的令牌集,从中分配令牌给业务单元。In this embodiment, if the adjacent token sets satisfy the request amount of the token acquisition request, a token set may be randomly selected from the adjacent token set, and the token is allocated to the service unit; The neighbor tokens select the token set with the largest number of tokens, and assign tokens to the business unit.
在本实施方式中,如果相邻令牌集的当前令牌数都不能满足令牌获取请求的请求数额,则通知所述业务单元等待一段时间再次获取。In this embodiment, if the current number of tokens of the adjacent token set cannot satisfy the request amount of the token acquisition request, the service unit is notified to wait for a period of time to acquire again.
在本实施方式中,通过从与被选择的令牌集相邻的令牌集中分配令牌给所述业务单元的方式解决了当所述令牌管理单元选择的令牌集无法满足所述业务单元发送的令牌获取请求中的请求数量是而造成的所述业务单元获取不到令牌或者需要等待才能够获取令牌的问题。从而进一步提高了业务单元获取到令牌的可能性,提高了业务数据处理的效率。In this embodiment, it is solved that the token set selected by the token management unit cannot satisfy the service by assigning a token to the service unit from a token set adjacent to the selected token set. The problem that the number of requests in the token acquisition request sent by the unit is caused by the business unit not acquiring the token or waiting to be able to acquire the token. Thereby, the possibility that the business unit acquires the token is further improved, and the efficiency of the business data processing is improved.
本说明书实施方式提供的一种数据处理系统,通过业务单元向令牌管理单元发送令牌获取请求,由令牌管理单元从其管理的至少一个令牌集中分配令牌给业务单元,业务单元的业务数据在有令牌的情况下才能够被处理单元所处理的方式,限制了网络中数据流量的速度,调整了数据流量输出速率,降低了系统过载的可能性,并提高了业务数据的处理效率与性能,并且本系统可以适用于任何需要流量整形和速率限制的场景。The data processing system provided by the embodiment of the present specification sends a token acquisition request to the token management unit through the service unit, and the token management unit allocates the token to the service unit from the at least one token group managed by the token management unit, and the service unit The way service data can be processed by the processing unit in the case of tokens limits the speed of data traffic in the network, adjusts the data traffic output rate, reduces the possibility of system overload, and improves the processing of service data. Efficiency and performance, and the system can be applied to any scenario that requires traffic shaping and rate limiting.
请参阅图6,本说明书实施方式提供一种数据处理方法,所述数据处理方法可以应用于业务单元。所述方法可以包括以下步骤。Referring to FIG. 6, an embodiment of the present specification provides a data processing method, which may be applied to a service unit. The method can include the following steps.
步骤S60:业务单元向令牌管理单元发送令牌获取请求。Step S60: The service unit sends a token acquisition request to the token management unit.
步骤S62:接收令牌管理单元反馈的令牌;其中,所述令牌管理单元管理至少一个令牌集,并按照指定规则维持所述令牌集中令牌的数量。Step S62: Receive a token fed back by the token management unit; wherein the token management unit manages at least one token set and maintains the number of tokens in the token set according to a specified rule.
步骤S64:将业务数据和所述令牌提供给处理单元;其中,所述处理单元按照指定处理规则对具有所述令牌的业务数据进行处理。Step S64: Providing the service data and the token to the processing unit; wherein the processing unit processes the service data having the token according to a specified processing rule.
在本实施方式中,执行上述步骤的主体可以是业务单元。In the present embodiment, the subject performing the above steps may be a business unit.
在本实施方式中,所述业务单元可以发送令牌获取请求、接收所述令牌管理单元反馈的令牌、向处理单元提供业务数据和所述令牌。所述业务单元可以提供有预定端口,通过该预定端口可以向所述令牌管理单元发送令牌获取请求信息、接收所述令牌管理单元反馈的配令牌、向处理单元提供业务数据和所述令牌。所述业务服务器可以基于HTTP、TCP/IP或FTP等网络协议与令牌管理单元进行网络数据交互。In this embodiment, the service unit may send a token acquisition request, receive a token fed back by the token management unit, provide service data to the processing unit, and the token. The service unit may be provided with a predetermined port through which token acquisition request information may be sent to the token management unit, a token assigned by the token management unit is received, service data is provided to the processing unit, and Describe the token. The service server may perform network data interaction with the token management unit based on a network protocol such as HTTP, TCP/IP or FTP.
本实施方式中所提及的术语和功能,请参照其它实施方式对照解释,在此不再赘述。For the terms and functions mentioned in the present embodiment, please refer to other embodiments for comparison and explanation, and details are not described herein again.
请参阅图7,本说明书实施方式提供一种数据处理方法,所述数据处理方法可以应用于令牌管理单元。所述方法可以包括以下步骤。Referring to FIG. 7, an embodiment of the present specification provides a data processing method, which may be applied to a token management unit. The method can include the following steps.
步骤S70:接收业务单元发出的令牌获取请求。Step S70: Receive a token acquisition request sent by the service unit.
步骤S72:将令牌集中的令牌发送给所述业务单元,以用于所述业务单元将所述令牌和业务数据提供给处理单元;其中,所述处理单元对具有所述令牌的业务单元提供的业务数据进行处理;其中,所述令牌集的数量为至少一个,所述令牌集中令牌的数量被依照指定规则维持。Step S72: Sending a token in the token set to the service unit, where the service unit provides the token and service data to a processing unit; wherein the processing unit pairs have the token The service data provided by the service unit is processed; wherein the number of the token sets is at least one, and the number of tokens in the token set is maintained according to a specified rule.
本实施方式中所提及的术语和功能,请参照其它实施方式对照解释,在此不再赘述。For the terms and functions mentioned in the present embodiment, please refer to other embodiments for comparison and explanation, and details are not described herein again.
请参阅图8,本说明书实施方式提供一种数据处理方法,所述数据处理方法可以应用于处理单元。所述方法可以包括以下步骤。Referring to FIG. 8, an embodiment of the present specification provides a data processing method, which may be applied to a processing unit. The method can include the following steps.
步骤S80:接收业务单元的业务处理请求。Step S80: Receive a service processing request of the service unit.
步骤S82:在所述业务处理请求具有令牌的情况下,根据指定处理规则对所述业务处理请求附带的业务数据进行处理;其中,所述业务单元从令牌管理单元得到所述令牌。Step S82: If the service processing request has a token, process the service data attached to the service processing request according to the specified processing rule; wherein the service unit obtains the token from the token management unit.
在本实施方式中,所述业务处理请求可以是,满足通信协议并遵循一定格式的字符串或代码,其可以用于表示发出该业务处理请求的业务单元有需要所述处理单元处理的业务数据。所述业务处理请求可以包括,用户通过客户端向搜索引擎发出的搜索请求;平台向用户推送消息的推送请求等。In this embodiment, the service processing request may be a string or code that satisfies a communication protocol and follows a certain format, and may be used to indicate that the service unit that issues the service processing request has service data that needs to be processed by the processing unit. . The service processing request may include a search request sent by the user to the search engine by the client; a push request of the platform pushing the message to the user, and the like.
在本实施方式中,在所述业务单元获得令牌后,可以将令牌附带在业务处理请求中发送给所述处理单元,处理单元可以根据所述业务处理请求是否具有令牌选择是否对业务处理请求中附带的业务数据进行处理。在具有令牌的情况下,所述处理单元可以按照业务处理请求对相应的业务数据进行处理。具体地,2个用户同时使用客户端向搜索引擎发送搜索娱乐新闻的搜索请求,这两个搜索请求一个具有令牌一个没有令牌,搜索引擎可以处理有令牌的搜索请求,搜索相关的娱乐新闻;对于没有令牌的搜索请求可以不做处理。In this embodiment, after the service unit obtains the token, the token may be sent to the processing unit in the service processing request, and the processing unit may select whether the token has a service according to the service processing request. Process the business data attached to the request for processing. In the case of having a token, the processing unit may process the corresponding service data according to the service processing request. Specifically, two users simultaneously use the client to send a search request for searching for entertainment news to the search engine. The two search requests have one token with no token, and the search engine can process the search request with the token to search for related entertainment. News; search requests without tokens can be left unprocessed.
在本实施方式中,所述指定处理规则可以是预先设定的也可是根据当前网络状况而变化的。当业务单元提供的业务数据满足至少一个预先设定的指定处理规则时,便可以对所述业务数据进行处理。所述指定处理规则可以包括,当业务单元提供的业务数据中包含有令牌时,则所述处理单元对业务数据进行处理;当多个具有不同优先级且包含有令牌的业务数据同时到达时,将优先级高的业务数据优先处理。In this embodiment, the specified processing rule may be preset or may be changed according to current network conditions. The business data can be processed when the business data provided by the business unit satisfies at least one predetermined specified processing rule. The specified processing rule may include: when the service data provided by the service unit includes a token, the processing unit processes the service data; when a plurality of service data having different priorities and containing the token arrive at the same time Priority is given to prioritizing business data with high priority.
在本实施方式中,所述处理单元通过接收所述业务单元发送的业务处理请求,处理具有令牌的业务处理请求,可以调整了数据流量输出速率,降低了系统过载的可能性,并提高了业务数据处理的效率与性能。In this implementation manner, the processing unit processes the service processing request with the token by receiving the service processing request sent by the service unit, can adjust the data traffic output rate, reduces the possibility of system overload, and improves the The efficiency and performance of business data processing.
请参阅图9,本说明书实施方式提供一种令牌管理方法,所述令牌管理方法可以应用于令牌管理单元,所述令牌管理单元可以维持有至少两个令牌集。所述方法可以包括以下步骤。Referring to FIG. 9, an embodiment of the present specification provides a token management method, which may be applied to a token management unit, and the token management unit may maintain at least two token sets. The method can include the following steps.
S90:选择一个所述令牌集。S90: Select one of the token sets.
S92:将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较少的令牌集中增加指定数量的令牌;或者,将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较多的令牌集中减少指定数量的令牌。S92: Compare the token set with an adjacent token set by a number of tokens, and add a specified number of tokens in a smaller number of token sets; or, combine the token set with an adjacent token The set compares the number of tokens and reduces the specified number of tokens in a larger number of tokens.
在本实施方式中,选择一个所述令牌集的方式可以包括,从所述至少两个令牌集中随机选择一个令牌集;从所述至少两个令牌集中选择一个指定的令牌集,具体地,例如,为所述至少两个令牌集编号,选择指定编号的令牌集,或者根据所述至少两个令牌集中令牌集的位置选择一个令牌集,例如,选择最左边的令牌集或者最右边的令牌集等。In this embodiment, the manner of selecting one of the token sets may include: randomly selecting one token set from the at least two token sets; and selecting a specified token set from the at least two token sets Specifically, for example, selecting the token set of the specified number for the at least two token set numbers, or selecting a token set according to the location of the token set of the at least two token sets, for example, selecting the most The token set on the left or the rightmost token set.
在本实施方式中,所述相邻的令牌集可以包括,与选择的一个所述令牌集前后相邻,左右相邻,上下相邻等。In this embodiment, the adjacent token set may include adjacent to the selected one of the token sets, left and right adjacent, up and down adjacent, and the like.
在本实施方式中,所述令牌管理单元可以查询选择的一个所述令牌集以及与该选择的一个所述令牌集相邻的令牌集中令牌的数量,在数量较少的令牌集中增加指定数量的令牌或者在数量较多的令牌集中减少指定数量的令牌。In this embodiment, the token management unit may query the selected one of the token set and the number of tokens in the token set adjacent to the selected one of the token sets, in a smaller number of orders Add a specified number of tokens in a card set or reduce a specified number of tokens in a larger number of token sets.
在本实施方式中,所述指定数量可以是预先设定的也可以是根据当前网络状况设定的,可以包括,增加固定的令牌数量;增加变化的令牌数量;间隔固定的时间增加固定的令牌数量;间隔固定的时间增加变化的令牌数量;间隔变化的时间增加固定的令牌数量;间隔变化的时间增加变化的令牌数量等。In this embodiment, the specified number may be preset or may be set according to current network conditions, and may include: increasing the number of fixed tokens; increasing the number of changed tokens; and increasing the fixed interval time. The number of tokens; the fixed interval increases the number of tokens changed; the interval change time increases the number of fixed tokens; the interval change time increases the number of tokens changed, and so on.
在本实施方式中,所述令牌管理单元通过管理至少两个令牌集,并从中选择一个令牌集,比较被选择的令牌集与相邻的令牌集的令牌数的多少,为令牌数较少的令牌集补充令牌,从令牌数多的令牌集中减少令牌的方式,降低了业务单元发送令牌获取请求后,所述令牌管理单元选择到空令牌集向业务单元分配令牌的可能性,并减少了令牌获取的等待时间。In this embodiment, the token management unit compares the number of tokens of the selected token set and the adjacent token set by managing at least two token sets and selecting one token set therefrom. Replenishing a token for a token set with a small number of tokens, reducing the token from a token set with a large number of tokens, and reducing the token selection unit to select an empty command after the service unit sends a token acquisition request The card set assigns a token to the business unit and reduces the wait time for token acquisition.
本说明书提供数据处理系统、方法及令牌管理方法,所述数据处理系统包括:业务单元、令牌管理单元和处理单元,其中,所述业务单元用于向所述令牌管理单元发送令牌获取请求,以获得所述令牌后将业务数据提供给所述处理单元进行处理;所述令牌管 理单元用于管理至少一个令牌集,并按照指定规则维持所述令牌集中令牌的数量;所述令牌管理单元在接收到所述令牌获取请求的情况下,将所述令牌集中的令牌发送给发出所述令牌获取请求的业务单元;所述处理单元用于按照指定处理规则对具有所述令牌的业务单元提供的业务数据进行处理。本说明书提供的数据处理系统限制了网络中数据流量的速度,调整了数据流量输出速率,降低了系统过载的可能性,并提高了业务数据处理的效率与性能。The present specification provides a data processing system, method, and token management method, the data processing system including: a service unit, a token management unit, and a processing unit, wherein the service unit is configured to send a token to the token management unit Acquiring a request to obtain the token and then providing the service data to the processing unit for processing; the token management unit is configured to manage at least one token set, and maintain the token set token according to a specified rule a quantity; the token management unit, when receiving the token acquisition request, transmitting a token in the token set to a service unit that issues the token acquisition request; the processing unit is configured to follow The specified processing rule processes the business data provided by the business unit having the token. The data processing system provided in this specification limits the speed of data traffic in the network, adjusts the data traffic output rate, reduces the possibility of system overload, and improves the efficiency and performance of service data processing.
上面对本说明书的各种实施方式的描述以描述的目的提供给本领域技术人员。其不旨在是穷举的、或者不旨在将本发明限制于单个公开的实施方式。如上所述,本说明书的各种替代和变化对于上述技术所属领域技术人员而言将是显而易见的。因此,虽然已经具体讨论了一些另选的实施方式,但是其它实施方式将是显而易见的,或者本领域技术人员相对容易得出。本说明书旨在包括在此已经讨论过的本发明的所有替代、修改、和变化,以及落在上述申请的精神和范围内的其它实施方式。The above description of various embodiments of the specification is provided to those skilled in the art for the purpose of description. It is not intended to be exhaustive or to limit the invention to the single disclosed embodiments. As described above, various alternatives and variations of the present specification will be apparent to those skilled in the art. Thus, while a few alternative embodiments have been discussed in detail, other embodiments will be apparent or apparent to those skilled in the art. The description is intended to cover all alternatives, modifications, and variations of the present invention, and other embodiments that are within the spirit and scope of the application.
本说明书中的各个实施方式均采用递进的方式描述,各个实施方式之间相同相似的部分互相参见即可,每个实施方式重点说明的都是与其他实施方式的不同之处。尤其,对于应用于业务单元的数据处理方法、应用于令牌管理单元的数据处理方法、应用于处理单元的数据处理方法以及令牌管理方法的实施方式而言,由于其基本相似于数据处理系统的实施方式,所以描述的比较简单,相关之处参见数据处理系统的实施方式的部分说明即可。The various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on differences from other embodiments. In particular, the data processing method applied to the business unit, the data processing method applied to the token management unit, the data processing method applied to the processing unit, and the token management method are basically similar to the data processing system The description of the implementation is relatively simple, and the relevant parts can be referred to the description of the implementation of the data processing system.
本说明书可用于众多通用或专用的计算机系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。This description can be used in a variety of general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor based systems, set-top boxes, programmable consumer electronics devices, network PCs, small computers, mainframe computers, including A distributed computing environment of any of the above systems or devices, and the like.
虽然通过实施方式描绘了本说明书,本领域普通技术人员知道,本说明书有许多变形和变化而不脱离本说明书的精神,希望所附的权利要求包括这些变形和变化而不脱离本说明书的精神。While the specification has been described by the embodiments of the invention, it will be understood that

Claims (22)

  1. 一种数据处理系统,其特征在于,包括:业务单元、令牌管理单元和处理单元,其中,A data processing system, comprising: a service unit, a token management unit, and a processing unit, wherein
    所述业务单元用于向所述令牌管理单元发送令牌获取请求,以获得所述令牌后将业务数据提供给所述处理单元进行处理;The service unit is configured to send a token acquisition request to the token management unit, to obtain the token, and then provide the service data to the processing unit for processing;
    所述令牌管理单元用于管理至少一个令牌集,并按照指定规则维持所述令牌集中令牌的数量;所述令牌管理单元在接收到所述令牌获取请求的情况下,将所述令牌集中的令牌发送给发出所述令牌获取请求的业务单元;The token management unit is configured to manage at least one token set and maintain the number of tokens in the token set according to a specified rule; if the token management unit receives the token acquisition request, The token in the token set is sent to a service unit that issues the token acquisition request;
    所述处理单元用于按照指定处理规则对具有所述令牌的业务单元提供的业务数据进行处理。The processing unit is configured to process the service data provided by the service unit having the token according to a specified processing rule.
  2. 根据权利要求1所述的系统,其特征在于,所述业务单元具有需要被所述处理单元进行处理的业务数据之后,才向所述令牌管理单元发送所述令牌获取请求。The system according to claim 1, wherein said service unit has said service request data to be processed by said processing unit before said token acquisition request is sent to said token management unit.
  3. 根据权利要求1所述的系统,其特征在于,所述业务单元包括多个任务,该多个任务具有不同的任务优先级;具有指定任务优先级的任务能在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求。The system according to claim 1, wherein said service unit comprises a plurality of tasks having different task priorities; and tasks having a specified task priority can be said to have said service data before said The token management unit sends the token acquisition request.
  4. 根据权利要求1所述的系统,其特征在于,所述业务单元之间具有不同的业务优先级;具有指定业务优先级的业务单元的任务能在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求。The system according to claim 1, wherein said service units have different service priorities; and a task of a service unit having a specified service priority can be directed to said token management unit before having service data Send the token acquisition request.
  5. 根据权利要求1所述的系统,其特征在于,所述指定规则包括以下至少之一:每间隔指定时间,向所述令牌集中添加指定数量的令牌;或者,当所述业务单元使用得到的令牌之后,所述令牌管理单元向所述令牌集增加相应数量的令牌。The system according to claim 1, wherein the specified rule comprises at least one of: adding a specified number of tokens to the token set every specified time interval; or, when the service unit is used After the token, the token management unit adds a corresponding number of tokens to the token set.
  6. 根据权利要求5所述的系统,其特征在于,在所述令牌集中令牌的数量达到最大令牌数时,停止向所述令牌集中添加令牌。The system of claim 5 wherein when the number of tokens in the token set reaches a maximum number of tokens, the adding of tokens to the token set is stopped.
  7. 根据权利要求1所述的系统,其特征在于,在所述令牌管理单元接收到所述令 牌获取请求时,所述令牌集中没有令牌的情况下,所述令牌管理单元对所述令牌获取请求的处理方式包括至少以下之一:向发出所述令牌获取请求的业务单元发出反馈信息,以通知所述业务单元重新发出令牌获取请求;或者,将所述令牌获取请求放入请求队列,在所述令牌集中具有令牌时,将所述令牌分配给所述请求队列中令牌获取请求对应的业务单元;或者,将所述令牌获取请求放入请求队列,在所述令牌集中具有令牌时,向所述请求队列中的令牌获取请求对应的业务单元发出通知信息,以通知所述业务单元重新发出令牌获取请求。The system according to claim 1, wherein when the token management unit receives the token acquisition request, if there is no token in the token set, the token management unit The processing manner of the token obtaining request includes at least one of: sending a feedback message to the service unit that issues the token obtaining request to notify the service unit to reissue the token obtaining request; or acquiring the token The request is placed in the request queue, and when the token has a token, the token is allocated to the service unit corresponding to the token acquisition request in the request queue; or the token acquisition request is placed in the request The queue, when the token has a token, sends a notification message to the service unit corresponding to the token acquisition request in the request queue to notify the service unit to reissue the token acquisition request.
  8. 根据权利要求1所述的系统,其特征在于,所述令牌集的数量为多个;所述指定规则包括:在多个令牌集中选择一个令牌集,将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较少的令牌集中增加指定数量的令牌。The system according to claim 1, wherein the number of the token sets is plural; the specifying rule comprises: selecting a token set in a plurality of token sets, and the token set and phase The neighbor token set compares the number of tokens and adds a specified number of tokens in a smaller number of token sets.
  9. 根据权利要求8所述的系统,其特征在于,在被选择的令牌集及其相邻的令牌集中令牌的数量均到达最大令牌数时,停止添加令牌。The system of claim 8 wherein the adding of the token is stopped when the number of selected token sets and their adjacent token set tokens all reach a maximum number of tokens.
  10. 根据权利要求1所述的系统,其特征在于,所述令牌集的数量为多个;每个所述令牌集对应一个最大令牌数;其中,至少部分令牌集的最大令牌数与其它令牌集的最大令牌数不同。The system according to claim 1, wherein the number of token sets is plural; each of the token sets corresponds to a maximum number of tokens; wherein at least a portion of the maximum number of tokens of the token set Different from the maximum number of tokens in other token sets.
  11. 根据权利要求1所述的系统,其特征在于,所述令牌集的数量为多个;所述令牌管理单元在接收到令牌获取请求后,选择一个令牌集,将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较多的令牌集中分配令牌给发出所述令牌获取请求的业务单元。The system according to claim 1, wherein the number of the token sets is plural; after receiving the token acquisition request, the token management unit selects a token set, and the token is The set compares the number of tokens with the adjacent token set, and assigns the token to the business unit that issued the token acquisition request in a larger number of token sets.
  12. 根据权利要求1所述的系统,其特征在于,所述令牌集的数量为多个,所述令牌管理单元在接收到所述令牌获取请求后,选择一个令牌集,在所述令牌集中令牌的数量不能匹配所述令牌获取请求时,在与所述令牌集相邻的令牌集中分配令牌给发出所述令牌获取请求的业务单元。The system according to claim 1, wherein the number of the token sets is plural, and the token management unit selects a token set after receiving the token acquisition request, When the number of tokens in the token set cannot match the token acquisition request, the token is assigned to the service unit that issued the token acquisition request in the token set adjacent to the token set.
  13. 一种数据处理方法,其特征在于,应用于业务单元;所述方法包括:A data processing method is characterized in that it is applied to a service unit; the method includes:
    业务单元向令牌管理单元发送令牌获取请求;The service unit sends a token acquisition request to the token management unit;
    接收令牌管理单元反馈的令牌;其中,所述令牌管理单元管理至少一个令牌集,并按照指定规则维持所述令牌集中令牌的数量;Receiving a token fed back by the token management unit; wherein the token management unit manages at least one token set and maintaining the number of tokens in the token set according to a specified rule;
    将业务数据和所述令牌提供给处理单元;其中,所述处理单元按照指定处理规则对具有所述令牌的业务数据进行处理。Providing the service data and the token to a processing unit; wherein the processing unit processes the service data having the token in accordance with a specified processing rule.
  14. 根据权利要求13所述的方法,其特征在于,当业务单元具有需要被所述处理单元进行处理的业务数据之后,向所述令牌管理单元发送所述令牌获取请求。The method of claim 13, wherein the token acquisition request is sent to the token management unit after the business unit has business data that needs to be processed by the processing unit.
  15. 根据权利要求13所述的方法,其特征在于,所述业务单元包括多个任务,该多个任务具有不同的任务优先级;具有指定任务优先级的任务能在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求。The method according to claim 13, wherein said service unit comprises a plurality of tasks having different task priorities; and a task having a specified task priority can be said to have said service data before said The token management unit sends the token acquisition request.
  16. 根据权利要求13所述的方法,其特征在于,所述业务单元之间具有不同的业务优先级;具有指定业务优先级的业务单元能在具有业务数据之前,向所述令牌管理单元发送所述令牌获取请求。The method according to claim 13, wherein said service units have different service priorities; and said service unit having a specified service priority can transmit to said token management unit before having service data The token acquisition request.
  17. 一种数据处理方法,其特征在于,应用于令牌管理单元;所述方法包括:A data processing method, which is applied to a token management unit; the method includes:
    接收业务单元发出的令牌获取请求;Receiving a token acquisition request issued by the business unit;
    将令牌集中的令牌发送给所述业务单元,以用于所述业务单元将所述令牌和业务数据提供给处理单元;其中,所述处理单元对具有所述令牌的业务单元提供的业务数据进行处理;其中,所述令牌集的数量为至少一个,所述令牌集中令牌的数量被依照指定规则维持。Transmitting a token in the token set to the service unit for the service unit to provide the token and service data to a processing unit; wherein the processing unit provides a service unit having the token The service data is processed; wherein the number of the token sets is at least one, and the number of tokens in the token set is maintained according to a specified rule.
  18. 根据权利要求17所述的方法,其特征在于,所述指定规则包括以下至少之一:每间隔指定时间,向所述令牌集添加指定数量的令牌;或者,当所述业务单元使用得到的令牌之后,所述令牌管理单元向所述令牌集增加相应数量的令牌。The method according to claim 17, wherein the specified rule comprises at least one of: adding a specified number of tokens to the token set every specified time interval; or when the service unit is used After the token, the token management unit adds a corresponding number of tokens to the token set.
  19. 根据权利要求18所述的方法,其特征在于,在所述令牌集中令牌的数量达到最大令牌数时,停止向所述令牌集中添加令牌。The method of claim 18, wherein when the number of tokens in the token set reaches a maximum number of tokens, stopping adding tokens to the token set is stopped.
  20. 根据权利要求17所述的方法,其特征在于,在所述令牌管理单元接收到所述令牌获取请求时,所述令牌集中没有令牌的情况下,所述令牌管理单元对所述令牌获取请求的处理方式包括至少以下之一:向发出所述令牌获取请求的业务单元发出反馈信息,以通知所述业务单元重新发出令牌获取请求;或者,将所述令牌获取请求放入请求队列,在所述令牌集中具有令牌时,将所述令牌分配给所述请求队列中令牌获取请求对应的业务单元;或者,将所述令牌获取请求放入请求队列,在所述令牌集中具有令牌时,向所述请求队列中的令牌获取请求对应的业务单元发出通知信息,以通知所述业务单元重新发出令牌获取请求。The method according to claim 17, wherein when the token management unit receives the token acquisition request, if there is no token in the token set, the token management unit The processing manner of the token obtaining request includes at least one of: sending a feedback message to the service unit that issues the token obtaining request to notify the service unit to reissue the token obtaining request; or acquiring the token The request is placed in the request queue, and when the token has a token, the token is allocated to the service unit corresponding to the token acquisition request in the request queue; or the token acquisition request is placed in the request The queue, when the token has a token, sends a notification message to the service unit corresponding to the token acquisition request in the request queue to notify the service unit to reissue the token acquisition request.
  21. 一种数据处理方法,其特征在于,应用于处理单元,所述方法包括:A data processing method is characterized in that it is applied to a processing unit, and the method includes:
    接收业务单元的业务处理请求;Receiving a business processing request of the business unit;
    在所述业务处理请求具有令牌的情况下,根据指定处理规则对所述业务处理请求附带的业务数据进行处理;其中,所述业务单元从令牌管理单元得到所述令牌。In the case that the service processing request has a token, the service data attached to the service processing request is processed according to the specified processing rule; wherein the service unit obtains the token from the token management unit.
  22. 一种令牌管理方法,其特征在于,应用于令牌管理单元,所述令牌管理单元维持有至少两个令牌集;包括:A token management method, which is applied to a token management unit, wherein the token management unit maintains at least two token sets;
    选择一个所述令牌集;Select one of the token sets;
    将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较少的令牌集中增加指定数量的令牌;或者,将所述令牌集与相邻的令牌集进行令牌数量比较,在数量较多的令牌集中减少指定数量的令牌。Comparing the token set with the adjacent token set for the number of tokens, adding a specified number of tokens in a smaller number of token sets; or, performing the token set with an adjacent token set The number of tokens is compared, reducing the specified number of tokens in a larger number of token sets.
PCT/CN2018/114348 2017-11-16 2018-11-07 Data processing system and method, and token management method WO2019096046A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711138960.4 2017-11-16
CN201711138960.4A CN109802895B (en) 2017-11-16 2017-11-16 Data processing system, method and token management method

Publications (1)

Publication Number Publication Date
WO2019096046A1 true WO2019096046A1 (en) 2019-05-23

Family

ID=66539376

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/114348 WO2019096046A1 (en) 2017-11-16 2018-11-07 Data processing system and method, and token management method

Country Status (2)

Country Link
CN (1) CN109802895B (en)
WO (1) WO2019096046A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111585913A (en) * 2020-04-30 2020-08-25 武汉众邦银行股份有限公司 Service flow limiting method based on recovery token and storage medium

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110175078B (en) * 2019-05-30 2020-12-01 口碑(上海)信息技术有限公司 Service processing method and device
CN110708234B (en) * 2019-09-24 2022-05-17 深圳证券交易所 Message transmission processing method, message transmission processing device and storage medium
CN110912794B (en) * 2019-11-15 2021-07-16 国网安徽省电力有限公司安庆供电公司 Approximate matching strategy based on token set
CN111027033B (en) * 2019-11-27 2022-05-27 中国银行股份有限公司 Interface access method and device
CN112866136B (en) * 2021-03-31 2023-05-02 中国工商银行股份有限公司 Service data processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102640455A (en) * 2009-11-23 2012-08-15 爱立信(中国)通信有限公司 License redistributing method, moderator and license controlling system thereof
US20140380324A1 (en) * 2013-06-25 2014-12-25 Amazon Technologies, Inc. Burst-mode admission control using token buckets
CN105409171A (en) * 2013-06-25 2016-03-16 亚马逊科技公司 Burst mode control
CN106375238A (en) * 2015-07-21 2017-02-01 深圳市中兴微电子技术有限公司 Flow supervision method and apparatus

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100454897C (en) * 2005-08-25 2009-01-21 华为技术有限公司 Method for effectively preventing attack of network apparatus
US7719968B2 (en) * 2005-12-30 2010-05-18 Extreme Networks, Inc. Multi-priority multi-color markers for traffic metering
CN101360049B (en) * 2008-09-23 2011-02-09 福建星网锐捷网络有限公司 Packet forwarding method and apparatus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102640455A (en) * 2009-11-23 2012-08-15 爱立信(中国)通信有限公司 License redistributing method, moderator and license controlling system thereof
US20140380324A1 (en) * 2013-06-25 2014-12-25 Amazon Technologies, Inc. Burst-mode admission control using token buckets
CN105409171A (en) * 2013-06-25 2016-03-16 亚马逊科技公司 Burst mode control
CN106375238A (en) * 2015-07-21 2017-02-01 深圳市中兴微电子技术有限公司 Flow supervision method and apparatus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111585913A (en) * 2020-04-30 2020-08-25 武汉众邦银行股份有限公司 Service flow limiting method based on recovery token and storage medium
CN111585913B (en) * 2020-04-30 2023-04-07 武汉众邦银行股份有限公司 Service flow limiting method based on recovery token and storage medium

Also Published As

Publication number Publication date
CN109802895B (en) 2023-01-13
CN109802895A (en) 2019-05-24

Similar Documents

Publication Publication Date Title
WO2019096046A1 (en) Data processing system and method, and token management method
US11762703B2 (en) Multi-region request-driven code execution system
US10372499B1 (en) Efficient region selection system for executing request-driven code
Kliazovich et al. CA-DAG: Modeling communication-aware applications for scheduling in cloud computing
US10169060B1 (en) Optimization of packet processing by delaying a processor from entering an idle state
KR101670642B1 (en) System and method for scheduling packet transmission on a client device
US8832063B1 (en) Dynamic request throttling
WO2018130163A1 (en) Scheduling method and device for mobile cloud computing platform
EP2783490B1 (en) Time-sensitive data delivery
US8149846B2 (en) Data processing system and method
CN110383764B (en) System and method for processing events using historical data in a serverless system
US9525644B2 (en) Method and system for managing resources among different clients for an exclusive use
WO2020019743A1 (en) Traffic control method and device
US11316916B2 (en) Packet processing method, related device, and computer storage medium
CN111565154B (en) Image identification request processing method and device, computer equipment and storage medium
EP3575979A1 (en) Query priority and operation-aware communication buffer management
CN109002364B (en) Method for optimizing inter-process communication, electronic device and readable storage medium
CN114155026A (en) Resource allocation method, device, server and storage medium
CN112600761A (en) Resource allocation method, device and storage medium
CN107294911A (en) A kind of packet monitor method and device, RPC system, equipment
US10154116B1 (en) Efficient synchronization of locally-available content
CN114911602A (en) Load balancing method, device, equipment and storage medium for server cluster
CN106790632B (en) Streaming data concurrent transmission method and device
US10728291B1 (en) Persistent duplex connections and communication protocol for content distribution
WO2022240590A1 (en) Application-centric design for 5g and edge computing applications

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18879135

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18879135

Country of ref document: EP

Kind code of ref document: A1