CN110430142A - Method and apparatus for controlling flow - Google Patents

Method and apparatus for controlling flow Download PDF

Info

Publication number
CN110430142A
CN110430142A CN201910758905.8A CN201910758905A CN110430142A CN 110430142 A CN110430142 A CN 110430142A CN 201910758905 A CN201910758905 A CN 201910758905A CN 110430142 A CN110430142 A CN 110430142A
Authority
CN
China
Prior art keywords
flow
consumption
terminal
data
user
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910758905.8A
Other languages
Chinese (zh)
Other versions
CN110430142B (en
Inventor
付胜博
王华勇
周文静
严彪
周飞龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910758905.8A priority Critical patent/CN110430142B/en
Publication of CN110430142A publication Critical patent/CN110430142A/en
Application granted granted Critical
Publication of CN110430142B publication Critical patent/CN110430142B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/29Flow control; Congestion control using a combination of thresholds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Embodiment of the disclosure discloses the method and apparatus for controlling flow.This method is applied to the Service Instance of the portal service in multiple-stage and split, and a specific embodiment of this method includes: user's request data in response to receiving terminal transmission, determines whether present load amount is more than load threshold;In response to determining that present load amount is more than load threshold, the present flow rate consumption of terminal is obtained, the size relation with flow of contracting is consumed according to the present flow rate of terminal, it is determined whether abandon user's request data.In the embodiment, it may be implemented to control flow from the source of flow, both it can ensure that the traffic load of each Service Instance of portal service was maintained in metastable range, it may insure that the traffic load respectively serviced after portal service is maintained in metastable range again, help to improve the stability of system.

Description

Method and apparatus for controlling flow
Technical field
Embodiment of the disclosure is related to field of computer technology, and in particular to the method and apparatus for controlling flow.
Background technique
In a distributed system, multiple services are usually deployed, and each service can have many Service Instances.System System is when receiving user's request, it usually needs each service in multiple-stage and split is advised according to preset processing sequence and processing Then respond received user's request.
In the related technology, when flow of services increases suddenly, the calling frequency between service, resource occupation, service delay all can It increases accordingly, system crash can be caused when serious, cause system stability not high.
Summary of the invention
Embodiment of the disclosure proposes the method and apparatus for controlling flow.
In a first aspect, embodiment of the disclosure provides a kind of method for controlling flow, it is applied in multiple-stage and split Portal service Service Instance, this method comprises: being determined current negative in response to the user's request data for receiving terminal transmission Whether carrying capacity is more than load threshold;In response to determining that present load amount is more than load threshold, the present flow rate for obtaining terminal is consumed, The size relation with flow of contracting is consumed according to the present flow rate of terminal, it is determined whether abandons user's request data.
In some embodiments, present flow rate consumption includes: the global traffic consumption that terminal counts the period upper one, terminal It is consumed in the local flow in current count period;Wherein, global traffic consumption counts the period to portal service upper one for terminal The flow of user's request data of submission consumes, and local flow consumption is what terminal was submitted in the current count period to Service Instance The flow of user's request data consumes.
In some embodiments, the present flow rate consumption for obtaining terminal includes: to send asynchronous query to counting service node Request is disappeared with obtaining global traffic of terminal of the counting service node based on asynchronous query request transmission in a upper counting period Consumption;Local flow of the terminal in the current count period is obtained from preset memory locations to consume.
In some embodiments, the size relation with flow of contracting is consumed according to the present flow rate of terminal, it is determined whether lose Abandon family request data, comprising: in response to determining that global traffic consumption is sky, and local flow consumption is greater than flow of contracting, really Surely user's request data is abandoned;In response to determining that global traffic consumption is non-empty, and global traffic consumption is greater than signing flow, really Surely user's request data is abandoned.
In some embodiments, load threshold includes first threshold, second threshold and third threshold value, and present flow rate consumption is also It is consumed including multiple backup flows, multiple backup flow consumption are terminal respectively in multiple history meters in addition to upper one counts the period The flow for user's request data that one number time submits to portal service consumes;And in response to determining that present load amount is more than load Threshold value, obtains the present flow rate consumption of terminal, consumes the size relation with flow of contracting according to the present flow rate of terminal, determination is No discarding user's request data, comprising: in response to determining present load amount greater than first threshold and being less than second threshold, and it is current Global traffic consumption and/or local flow consumption in flow consumption are greater than signing flow, abandon user's request data;In response to Determine that present load amount is greater than second threshold and is less than third threshold value, and in multiple backup flows consumption in present flow rate consumption It is greater than signing flow in the presence of the consumption of backup flow or global traffic consumption is greater than signing flow, abandons user's request data.
In some embodiments, method further include: in response to determining that present load amount is less than load threshold, determination is not lost Abandon family request data.
In some embodiments, method further include: do not abandon user's request data in response to determining, execute following steps: Update present load amount;Determine demand volume needed for institute's request content in user's request data, flow update according to demand is worked as The preceding local flow consumption for counting the period;Terminal identity mark and demand volume, coding based on terminal obtain count information, will Obtained count information is stored in count information queue, and count information queue is the lock-free queue with fixed length memory, will count Count information in message queue is sent to counting service node and is counted, and is disappeared with the global traffic for obtaining the current count period Consumption.
In some embodiments, the count information in count information queue is sent to counting service node and carries out counting packet It includes: based on preset process cycle, each count information of counterpart terminal identity in count information queue being closed And the count information of counterpart terminal is obtained, and the count information of terminal is sent to counting service node.
In some embodiments, the global traffic in current count period is consumed via counting service node as follows Counted to get: count pick up information, and using terminal as granularity stores received count information to presetting The first data store organisation, the first data store organisation be without lock data structure;In response to determining that current time is to count week The end of phase counts the total flow of terminal in the first data store organisation, using total flow as the global flow in current count period Amount consumption, and the data that the first data store organisation is stored are stored in preset second data store organisation group Second data store organisation, and the data stored in the first data store organisation are deleted, in the second data store organisation group Second data store organisation is without lock data structure.
In some embodiments, preset second data are stored in the data for being stored the first data store organisation Before the second data store organisation in storage organization group, further includes: occupied in the second data store organisation group in response to determining The number of second data store organisation is more than preset number threshold value, is deleted current occupied in the second data store organisation group The data stored in longest second data store organisation of duration.
Second aspect, embodiment of the disclosure provide it is a kind of for controlling the device of flow, applied to service node Any Service Instance processing unit, Service Instance processing unit are used to run the Service Instance of the portal service in multiple-stage and split, Wherein, which includes: the first determination unit, is configured in response to receive user's request data of terminal transmission, determine Whether present load amount is more than load threshold;Second determination unit is configured in response to determine that present load amount is more than load Threshold value, obtains the present flow rate consumption of terminal, consumes the size relation with flow of contracting according to the present flow rate of terminal, determination is No discarding user's request data.
In some embodiments, present flow rate consumption includes: the global traffic consumption that terminal counts the period upper one, terminal It is consumed in the local flow in current count period;Wherein, global traffic consumption counts the period to portal service upper one for terminal The flow of user's request data of submission consumes, and local flow consumption is what terminal was submitted in the current count period to Service Instance The flow of user's request data consumes.
In some embodiments, in the second determination unit, the present flow rate consumption for obtaining terminal includes: to save to the service of counting Point sends asynchronous query request, counts the period upper one to obtain the terminal that counting service node is sent based on asynchronous query request Global traffic consumption;Local flow of the terminal in the current count period is obtained from preset memory locations to consume.
In some embodiments, in the second determination unit, the size with flow of contracting is consumed according to the present flow rate of terminal Relationship, it is determined whether abandon user's request data, comprising: in response to determining that global traffic consumes to be empty, and local flow consumption Greater than signing flow, determines and abandon user's request data;In response to determining that global traffic consumption is non-empty, and global traffic consumes Greater than signing flow, determines and abandon user's request data.
In some embodiments, load threshold includes first threshold, second threshold and third threshold value, and present flow rate consumption is also It is consumed including multiple backup flows, multiple backup flow consumption are terminal respectively in multiple history meters in addition to upper one counts the period The flow for user's request data that one number time submits to portal service consumes;And second determination unit be further configured to: In response to determining present load amount greater than first threshold and being less than second threshold, and the global traffic consumption in present flow rate consumption And/or local flow consumption is greater than signing flow, abandons user's request data;In response to determining that present load amount is greater than the second threshold It is worth and is less than third threshold value, and is consumed in multiple backup flows consumption in present flow rate consumption in the presence of backup flow and be greater than signing Flow or global traffic consumption are greater than signing flow, abandon user's request data.
In some embodiments, device further include: third determination unit is configured in response to determine present load amount It is less than load threshold, determination does not abandon user's request data.
In some embodiments, device further include: step execution unit is configured in response to determination and does not abandon user Request data executes following steps: updating present load amount;Determine the flow of requirement needed for institute's request content in user's request data Amount, flow updates the local flow consumption in current count period according to demand;Terminal identity mark and the flow of requirement based on terminal Amount, coding obtain count information, obtained count information are stored in count information queue, count information queue is with fixed length Count information in count information queue is sent to counting service node and counted, to be worked as by the lock-free queue of memory The preceding global traffic consumption for counting the period.
In some embodiments, in step execution unit, the count information in count information queue is sent to counting clothes It includes: based on preset process cycle, by counterpart terminal identity in count information queue that business node, which count, Each count information merges, and obtains the count information of counterpart terminal, and the count information of terminal is sent to counting service Node.
In some embodiments, the global traffic in current count period is consumed via counting service node as follows Counted to get: count pick up information, and using terminal as granularity stores received count information to presetting The first data store organisation, the first data store organisation be without lock data structure;In response to determining that current time is to count week The end of phase counts the total flow of terminal in the first data store organisation, using total flow as the global flow in current count period Amount consumption, and the data that the first data store organisation is stored are stored in preset second data store organisation group Second data store organisation, and the data stored in the first data store organisation are deleted, in the second data store organisation group Second data store organisation is without lock data structure.
In some embodiments, preset second data are stored in the data for being stored the first data store organisation Before the second data store organisation in storage organization group, further includes: occupied in the second data store organisation group in response to determining The number of second data store organisation is more than preset number threshold value, is deleted current occupied in the second data store organisation group The data stored in longest second data store organisation of duration.
The third aspect, embodiment of the disclosure provide a kind of electronic equipment, which includes: one or more places Manage device;Storage device is stored thereon with one or more programs;When the one or more program is by the one or more processors It executes, so that the one or more processors realize the method as described in implementation any in first aspect.
Fourth aspect, embodiment of the disclosure provide a kind of computer-readable medium, are stored thereon with computer program, The method as described in implementation any in first aspect is realized when the program is executed by processor.
The method and apparatus for controlling flow that embodiment of the disclosure provides can be sent in response to receiving terminal User's request data, determine whether present load amount is more than load threshold.Then, in response to determining that present load amount is more than negative Threshold value is carried, the present flow rate consumption of terminal is obtained, the size relation with flow of contracting is consumed according to the present flow rate of terminal, is determined Whether user request data is abandoned.The method and apparatus that embodiment of the disclosure provides, since portal service is in multiple-stage and split The service for responding user's request data at first determines whether that abandoning user asks by each Service Instance of the portal service of multiple-stage and split Data are sought, may be implemented to control flow from the source of flow, can both ensure the stream of each Service Instance of portal service Amount load is maintained in metastable range, and may insure that the traffic load respectively serviced after portal service is maintained at phase To in stable range, the stability of system is helped to improve.In addition, each Service Instance of portal service passes through in combination with certainly The present load amount of body and the present flow rate of terminal consume two and abandon user's request data because usually determining whether, real in service The use for ensureing the signing flow of user within the scope of the processing capacity of example as far as possible, may be implemented the fair conjunction to user's request data Reason abandons, and helps to realize the effective use to data processing resources.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the disclosure is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is that one embodiment of the disclosure can be applied to exemplary system architecture figure therein;
Fig. 2 is the flow chart according to one embodiment of the method for controlling flow of the disclosure;
Fig. 3 is according to an embodiment of the present disclosure for controlling the schematic diagram of an application scenarios of the method for flow;
Fig. 4 is the flow chart according to another embodiment of the method for controlling flow of the disclosure;
Fig. 5 is the structural schematic diagram according to one embodiment of the device for controlling flow of the disclosure;
Fig. 6 is adapted for the structural schematic diagram for realizing the electronic equipment of embodiment of the disclosure.
Specific embodiment
The disclosure is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the disclosure can phase Mutually combination.The disclosure is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can the method for controlling flow using embodiment of the disclosure or the dress for controlling flow The exemplary system architecture 100 set.
As shown in Figure 1, system architecture 100 may include user terminal 101, network 102 and service node 103.Network 102 To provide the medium of communication link between user terminal 101 and service node 103.Network 102 may include various connections Type, such as wired, wireless communication link or fiber optic cables etc..
User terminal 101 can be interacted by network 102 with service node 103, to receive or send message etc..User is whole Various applications, such as searching class application, the application of debugging class, shopping class application etc. can be installed on end 101.
User terminal 101 can be hardware, be also possible to software.When user terminal 101 is hardware, it can be support and use Family request data input various electronic equipments, including but not limited to smart phone, tablet computer, pocket computer on knee and Desktop computer etc..When user terminal 101 is software, may be mounted in above-mentioned cited electronic equipment.It can be with It is implemented as multiple softwares or software module (such as providing multiple softwares of Distributed Services or software module), it can also be real Ready-made single software or software module.It is not specifically limited herein.
Service node 103 can be the server of the Service Instance of the portal service in operation multiple-stage and split.Service node The Service Instance run on 103 can determine present load when receiving user's request data of the transmission of user terminal 101 Whether amount is more than load threshold, in response to determining that present load amount is more than load threshold, obtains the present flow rate consumption of terminal, root According to the present flow rate consumption and the size relation of signing flow of terminal, it is determined whether abandon user's request data.
It should be noted that server can be hardware, it is also possible to software.When server is hardware, may be implemented At the distributed server cluster that multiple servers form, individual server also may be implemented into.It, can when server is software It, can also be with to be implemented as multiple softwares or software module (such as providing multiple softwares of Distributed Services or software module) It is implemented as single software or software module.It is not specifically limited herein.
It should be noted that for controlling the method for flow generally by service node provided by embodiment of the disclosure The Service Instance run on 103 executes, and correspondingly, the device for controlling flow, which is generally positioned in service node 103, to be used In the Service Instance processing unit of the Service Instance of operation portal service.
It should be understood that the number of user terminal, network and service node in Fig. 1 is only schematical.According to realization It needs, can have any number of user terminal, network and service node.
With continued reference to Fig. 2, the process of one embodiment of the method for controlling flow according to the disclosure is shown 200.The method for being used to control flow is applied to the Service Instance of the portal service in multiple-stage and split, comprising the following steps:
Step 201, the user's request data sent in response to receiving terminal determines whether present load amount is more than load Threshold value.
Wherein, the portal service in above-mentioned multiple-stage and split typically refers to respond user's request data in multiple-stage and split at first Service.As an example, if including that A service and B are serviced, and user's request data needs to first pass through the place of A service in multiple-stage and split Reason, using the processing that B is serviced, then the process that above-mentioned multiple-stage and split responds above-mentioned user's request data can be with are as follows: terminal to A clothes Business, A service are serviced to B, and B service is serviced to A, A service to terminal.At this point, since A service is to respond user's request data at first Service (in other words, A service is the service directly with terminal interaction), therefore A service be multiple-stage and split in portal service.It needs It is noted that the Service Instance respectively serviced in multiple-stage and split is usually process.
Above-mentioned user's request data can be the data for requesting to service of terminal transmission.As an example, above-mentioned user Request data can be terminal transmission for request read data service data, be also possible to terminal transmission be used for request Write the data of the service of data.
Above-mentioned present load amount typically refers to the number that above-mentioned executing subject is presently in the request of reason.Above-mentioned load threshold It can be preset data value.
In the present embodiment, it can be asked in the user for receiving terminal transmission for controlling the executing subject of the method for flow When seeking data, determine whether present load amount is more than load threshold.Here, above-mentioned executing subject can using present load amount with Load threshold is compared, and realizes determine whether present load amount is more than load threshold.
Step 202, in response to determining that present load amount is more than load threshold, the present flow rate for obtaining terminal is consumed, according to The present flow rate consumption and the size relation of signing flow of terminal, it is determined whether abandon user's request data.
Wherein, the present flow rate consumption of above-mentioned terminal typically refers to the flow consumption of the terminal currently recorded.As showing Example, the present flow rate consumption of above-mentioned terminal can include but is not limited to terminal and exists in the flow consumption in current count period, terminal Upper one counts the flow consumption in period, and terminal counts the flow consumption in period etc. at upper two.Wherein, the above-mentioned counting period can be with It is preset data value, such as 10 seconds.Above-mentioned signing flow typically refers to the previously selected flow consumption of terminal.
In the present embodiment, when determining that present load amount is more than load threshold, the above-mentioned available terminal of executing subject Present flow rate consumption.Here, as an example, above-mentioned executing subject can be directly from preset for storing working as terminal The storage address of preceding flow consumption obtains the present flow rate consumption of terminal.
In the present embodiment, after the present flow rate consumption for obtaining terminal, above-mentioned executing subject can disappear present flow rate Consumption is compared with signing flow, thus the size relation based on the two, it is determined whether abandons user's request data.As showing Example can determine when present flow rate consumes and is greater than signing flow and abandon user's request data.
The method that embodiment of the disclosure provides, since portal service is to respond user's request data in multiple-stage and split at first Service, by each Service Instance of the portal service of multiple-stage and split determine whether abandon user's request data, may be implemented from stream The source of amount controls flow, can both ensure that the traffic load of each Service Instance of portal service is maintained at relatively stable In the range of, and may insure that the traffic load respectively serviced after portal service is maintained in metastable range, it helps In the stability of the system of raising.In addition, each Service Instance of portal service passed through in combination with the present load amount of itself and end The present flow rate at end consumes two and abandons user's request data because usually determining whether, within the scope of the processing capacity of Service Instance The use for ensureing the signing flow of user as far as possible, may be implemented the fair and reasonable discarding to user's request data, helps to realize Effective use to data processing resources.
In the optional implementation of each embodiment of the disclosure, above-mentioned present flow rate consumption may include: terminal In the global traffic consumption that upper one counts the period, local flow of the terminal in the current count period is consumed.Wherein, global traffic disappears Consumption is the flow consumption that terminal counts user's request data that the period submits to portal service upper one, and local flow consumption is eventually End is consumed in the flow for user's request data that the current count period submits to Service Instance.
In this implementation, global traffic consumption can consume feelings from the nearest flow of the angle reflection terminal entirely serviced Condition has stronger reference value to current whole flow Expenditure Levels, in addition, local flow consumption can be from current service The current local flow Expenditure Levels of the angle reflection terminal of example, while two are consumed from global traffic consumption and local flow Aspect accounts for, and may be implemented preferably to ensure fair and reasonable discarding to user's request data, and further increases pair The effective use of data processing resources.
In above-mentioned implementation, the present flow rate consumption of above-mentioned acquisition terminal may include:
It obtains global traffic consumption: sending asynchronous query request to service node is counted, count service node base to obtain In the global traffic consumption that the terminal that asynchronous query request is sent counts the period upper one.
Wherein, above-mentioned counting service node is asked in the counting period to the user that portal service is submitted commonly used in statistics terminal The flow of data is asked to consume.Above-mentioned counting service node can be a process and be also possible to an independent server.It is above-mentioned Asynchronous query request is usually the solicited message for requesting asynchronous query.
Here, above-mentioned executing subject can send asynchronous query request to service node is counted.In this way, counting service node The global traffic consumption that terminal counts the period upper one can be sent to above-mentioned execution master when receiving asynchronous query request Body.
In addition, above-mentioned executing subject can also be by removing executing subject into portal service as another implementation Outer other Service Instances send asynchronous query request respectively, are consumed with obtaining terminal in the local flow of each Service Instance, from And consume the consumption of the local flow of each Service Instance obtained as global traffic with value, terminal is got to realize Global traffic consumption.
It obtains local flow consumption: obtaining local flow of the terminal in the current count period from preset memory locations and consume.
Wherein, above-mentioned preset memory locations can be preset for storing terminal current in above-mentioned executing subject Count the storage address of the local flow consumption in period.
Here, above-mentioned executing subject directly can get terminal in the local in current count period from preset memory locations Flow consumption.
In this implementation, global traffic consumption is obtained by way of asynchronous query, may be implemented do not influencing to execute Global traffic consumption is obtained in time while other operations of main body, helps to improve data-handling efficiency.
In above-mentioned implementation, the above-mentioned size relation consumed according to the present flow rate of terminal with flow of contracting is determined Whether user request data is abandoned, comprising:
In response to determining that global traffic consumption is sky, and local flow consumption is greater than flow of contracting, and determines that abandoning user asks Seek data.In response to determining that global traffic consumption is non-empty, and global traffic consumption is greater than signing flow, determines that abandoning user asks Seek data.
In this implementation, the needs that the request of above-mentioned asynchronous query is responded due to above-mentioned counting service node it is certain when Between, it is thus typically necessary to which global traffic consumption can just be obtained by waiting for a period of time.Here, in order to improve data processing speed, on Global traffic consumption can be not yet received by stating executing subject, i.e., when global traffic consumption is empty, local flow is consumed and signed About flow is compared, and when the consumption of local flow is greater than signing flow, is determined and abandoned user's request data.Conversely, In When local flow consumption is less than signing flow, determination does not abandon user's request data.
In addition, above-mentioned executing subject can be consumed using global traffic to flow with signing after obtaining global traffic consumption Amount is compared, and when global traffic consumption is greater than signing flow, is determined and abandoned user's request data.Conversely, in the overall situation When flow consumption is less than signing flow, determination does not abandon user's request data.
It should be pointed out that since the consumption of local flow is the terminal that voluntarily counts of executing subject in the current count period Flow consumption, executing subject is always available to local flow consumption, even between executing subject and counting service node Communication there is failure, still can help to improve system stability with safeguards system stable operation.
In some optional implementations of the present embodiment, load threshold includes first threshold, second threshold and third Threshold value, present flow rate consumption include global traffic consumption, local flow consumption, the consumption of multiple backup flows.Multiple backup flows Consumption is user's number of request that terminal was submitted in multiple historical counts periods in addition to a upper counting period to portal service respectively According to flow consumption.Wherein, above-mentioned first threshold, second threshold and third threshold value can be the value of preset load, And first threshold is less than second threshold, second threshold is less than third threshold value.
At this point, above-mentioned, in response to determining that present load amount is more than load threshold, the present flow rate for obtaining terminal is consumed, according to The present flow rate consumption and the size relation of signing flow of terminal, it is determined whether abandon user's request data, comprising: firstly, ringing First threshold should be greater than in determining present load amount and be less than second threshold, and the global traffic consumption in present flow rate consumption And/or local flow consumption is greater than signing flow, abandons user's request data.Then, in response to determining that present load amount is greater than Second threshold and be less than third threshold value, and present flow rate consumption in multiple backup flows consumption in exist backup flow consumption greatly It is greater than signing flow in signing flow or global traffic consumption, abandons user's request data.In response to determining that present load amount is big In third threshold value, user's request data is abandoned.
Here, for example, if the largest request amount that above-mentioned executing subject is capable of handling is 100, first threshold 80, Second threshold is 90, and third threshold value is 100.When above-mentioned executing subject receives active user's request data, if present load Amount is 60, then above-mentioned executing subject can not have to consider whether to abandon active user's request data.If present load is 85, on Active user can be abandoned when determining that global traffic consumption and/or local flow consumption are greater than signing flow by stating executing subject Request data.If present load amount is 96, above-mentioned executing subject can have backup flow in the consumption of multiple backup flows When consumption is greater than signing flow or global traffic consumption greater than signing flow, active user's request data is abandoned.If present load Amount is 100, then above-mentioned executing subject can directly abandon active user's request data.
In this implementation, above-mentioned executing subject hierarchically can be asked user in conjunction with the request processing capacity of itself Data are asked to be abandoned.It may be implemented preferably to ensure the fair and reasonable discarding to user's request data, and further increase Effective use to data processing resources.
It is one of the application scenarios 300 of the method according to the present embodiment for controlling flow with continued reference to Fig. 3, Fig. 3 Schematic diagram.In the application scenarios of Fig. 3, the Service Instance 3011 of portal service 301 receives user's request of the transmission of terminal 302 Data, and execute following steps:
Firstly, present load amount X1 can be compared by Service Instance 3011 with load threshold T1, it is current negative to determine Whether carrying capacity X1 is more than load threshold T1.
Then, when determining that present load amount X1 is more than load threshold T1, the available terminal 302 of Service Instance 3011 Present flow rate consumes X2.
It is compared finally, present flow rate can be consumed X2 by Service Instance 3011 with signing flow T2, it is current to determine Flow consumes the size relation of X2 and the flow T2 that contracts, determines whether to abandon user's request data.
The method provided by the above embodiment for controlling flow of the disclosure, due to portal service be in multiple-stage and split most The service for first responding user's request data is determined whether to abandon user's request by each Service Instance of the portal service of multiple-stage and split Data, may be implemented to control flow from the source of flow, can both ensure the flow of each Service Instance of portal service Load is maintained in metastable range, and may insure that the traffic load respectively serviced after portal service is maintained at opposite In stable range, the stability of system is helped to improve.In addition, each Service Instance of portal service passes through in combination with itself Present load amount and terminal present flow rate consume two because usually determine whether abandon user's request data, in Service Instance Processing capacity within the scope of ensure as far as possible user signing flow use, may be implemented to the fair and reasonable of user's request data It abandons, helps to realize the effective use to data processing resources.
With further reference to Fig. 4, it illustrates the processes 400 of another embodiment of the method for controlling flow.The use In the process 400 of the method for control flow, comprising the following steps:
Step 401, the user's request data sent in response to receiving terminal determines whether present load amount is more than load Threshold value.
Step 402, in response to determining that present load amount is more than load threshold, the present flow rate for obtaining terminal is consumed, according to The present flow rate consumption and the size relation of signing flow of terminal, it is determined whether abandon user's request data.
In the present embodiment, the behaviour of the concrete operations of step 401-402 and step 201-202 in embodiment shown in Fig. 2 Make essentially identical, details are not described herein.
Step 403, in response to determining that present load amount is less than load threshold, determination does not abandon user's request data.
In the present embodiment, when present load amount is less than load threshold, user's request data is not abandoned.In this way, can To ensure the demand for services of terminal within the scope of the processing capacity of executing subject, may be implemented preferably to ensure to user's number of request According to fair and reasonable discarding, and further increase the effective use to data processing resources.
Step 404, user's request data is not abandoned in response to determining, above-mentioned executing subject can execute step 4041- step Rapid 4043:
Step 4041, present load amount is updated.
In the present embodiment, present load amount can be added preset incremental value by above-mentioned executing subject, to realize Present load amount is updated, and obtains updated present load amount.Wherein, above-mentioned preset incremental value can be in advance The numerical value of setting.As an example, above-mentioned preset incremental value can be 1, or 2.
Step 4042, demand volume needed for institute's request content in user's request data is determined, flow updates according to demand The local flow in current count period consumes.
In the present embodiment, above-mentioned executing subject can parse user's request data, obtain user's request data Requested content, and flow, i.e. demand volume needed for obtaining institute's request content.After obtaining the demand flow, on Stating executing subject can be consumed local flow and the demand by plus the demand flow, realizing the consumption of local flow Flow is used as updated local flow consumption with value.
Step 4043, the terminal identity mark based on terminal and demand volume, coding obtain count information, will be obtained Count information is stored in count information queue, and count information queue is the lock-free queue with fixed length memory, by count information queue In count information be sent to count service node counted, with obtain the current count period global traffic consumption.
In the present embodiment, above-mentioned executing subject can be using the terminal identity mark and the demand flow coding of terminal Obtain count information.At this point, obtained count information includes terminal identity mark and demand volume.Obtaining count information Afterwards, obtained count information can be stored in count information queue by above-mentioned executing subject.In this way, can be by count information queue In count information be sent to count service node counted, with obtain the current count period global traffic consumption.
It should be pointed out that be latched into due to the nothing that data may be implemented in lock-free queue and read without lock, it counts Message queue is the lock-free queue with fixed length memory, helps to improve reading and writing data speed.In addition, due in fixed length memory Each storage unit usually only stores the element of same size, and can directly be deleted after data have been read using fixed length memory Except the data being read, without storage unit is discharged, it is possible to reduce the time of the creation and release of storage unit, and due to Count information usually has fixed format and in the same size, and therefore, the count information queue in the present embodiment is with fixed length The lock-free queue of memory, helps to improve data-handling efficiency.
In the present embodiment, determining that above-mentioned executing subject can respond above-mentioned user when not abandoning user's request data Request data, the present load amount that timely updates and local flow consumption, and the global traffic in statistics current count period in time Consumption, facilitates safeguards system stable operation.
In some optional implementations of the present embodiment, the above-mentioned count information by count information queue is sent to Counting service node and count may include: based on preset process cycle, by counterpart terminal in count information queue Each count information of identity merges, and obtains the count information of counterpart terminal, and the count information of terminal is sent To counting service node.
Wherein, above-mentioned preset process cycle can be preset time span value.As an example, above-mentioned place Managing the period can be 2 seconds, 5 seconds etc..It should be pointed out that above-mentioned process cycle is typically less than or equal to the above-mentioned counting period.On It states and merges each count information of counterpart terminal identity in count information queue, typically refer to that a terminal will be corresponded to Demand volume in each count information of identity is overlapped, and is merged and is obtained a tale for terminal identity mark Information.As an example, if there are 2 count informations, respectively count information A and count information for terminal identity mark 001 B.Wherein, count information A are as follows: 001,20, count information B are as follows: 50 in 20 and B in 001,50, A are demand volume. At this point, count information A and count information B are merged, available tale information are as follows: 001,70.
In this implementation, above-mentioned executing subject sends counting to service node is counted according to preset process cycle Information, when once there is count information to send, it is possible to reduce executing subject and count the number of communications between service node, help In saving the process resource that communication is spent therebetween, the utilization rate to data processing resources is helped to improve, is improved simultaneously The data-handling efficiency of executing subject.
In addition, above-mentioned executing subject will just be sent to counting service node after the merging of the count information of same terminal, It can reduce executing subject and count the size of the Content of Communication between service node, help speed up communication speed, improve number According to treatment effeciency.
In above-mentioned implementation, the global traffic consumption in above-mentioned current count period passes through such as via service node is counted Lower step is counted to get:
The first step, count pick up information, and using terminal as granularity store received count information to setting in advance The first fixed data store organisation, the first data store organisation are without lock data structure.
Here, service node is counted after receiving count information, received count information can be stored in first In data store organisation at position corresponding with the terminal of the count information.It should be pointed out that the first data store organisation can To store the count information of multiple terminals.
Second step counts terminal in the first data store organisation in response to determining that current time is the end for counting the period Total flow, consumed total flow as the global traffic in current count period, and the first data store organisation stored Data be stored in the second data store organisation in preset second data store organisation group, and delete the storage of the first data The data stored in structure, the second data store organisation in the second data store organisation group are without lock data structure.
Wherein, count information of the first above-mentioned data store organisation commonly used in storage terminal in the current count period, And flow of the second above-mentioned data store organisation commonly used in storage terminal in the historical counts period consumes.
Here, in the end for counting the period, each terminal can be counted in the overall situation in current count period by counting service node Flow consumption.In this way, can be at next counting period, above-mentioned executing subject can be by the current count period obtained overall situation The global traffic consumption that flow consumption counts the period upper one as it.
In this implementation, the first data store organisation and the second data store organisation be without lock data structure, can be with It realizes reading without lock and being written without lock to data, reading and writing data speed is helped to improve, to improve data-handling efficiency.
In addition, the form of the first data store organisation can include but is not limited to following one: skip list, Hash table, tree.The Two data store organisations can include but is not limited to following one: skip list, Hash table, tree.It should be pointed out that due to skip list knot Structure helps to improve the access efficiency to data to be had when the first data store organisation and/or the second data store organisation are skip list The access efficiency for helping improve data, to help to improve data processing speed.
It is preset in the above-mentioned data deposit for being stored the first data store organisation in above-mentioned implementation Before the second data store organisation in second data store organisation group, further includes: in response to determining the second data store organisation In group the number of occupied second data store organisation be more than preset number threshold value, delete the second data store organisation group in when The data stored in preceding longest second data store organisation of occupied duration.
Wherein, above-mentioned preset number threshold value can be preset data value.As an example, above-mentioned preset number threshold value It can be 5,6,7 etc..
Herein, due in the second data store organisation group the second data store organisation commonly used in storage terminal in history Count the flow consumption in period.Again due to and interval too long historical counts period flow consumption to terminal in current count week The reference value very little of the flow Expenditure Levels of phase.Therefore, occupied second data are deposited in the second data store organisation group When the number of storage structure is more than preset number threshold value, longest second data store organisation of occupied duration is deleted, Ke Yijie About memory space.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, present disclose provides one kind for controlling stream One embodiment of the device of amount, the Installation practice is corresponding with embodiment of the method shown in Fig. 2, which can specifically answer For in various electronic equipments.
As shown in figure 5, the present embodiment includes: the first determination unit 501 for controlling the device 500 of flow, it is configured At user's request data in response to receiving terminal transmission, determine whether present load amount is more than load threshold;Second determines Unit 502 is configured in response to determine that present load amount is more than load threshold, obtains the present flow rate consumption of terminal, according to The present flow rate consumption and the size relation of signing flow of terminal, it is determined whether abandon user's request data.
In some optional implementations of the present embodiment, present flow rate consumption included: terminal in a upper counting period Global traffic consumption, terminal the current count period local flow consume.Wherein, global traffic consumption is terminal upper one The flow consumption for user's request data that the period submits to portal service is counted, local flow consumption is terminal in current count week The flow for user's request data that phase submits to Service Instance consumes.
In some optional implementations of the present embodiment, in the second determination unit 502, the present flow rate of terminal is obtained Consumption includes: to be based on asynchronous query to service node transmission asynchronous query request is counted with acquisition counting service node and request hair The global traffic consumption that the terminal sent counts the period upper one.Terminal is obtained in the sheet in current count period from preset memory locations The consumption of ground flow.
In some optional implementations of the present embodiment, in the second determination unit 502, according to the present flow rate of terminal The size relation of consumption and signing flow, it is determined whether abandon user's request data, comprising: in response to determining global traffic consumption For sky, and local flow consumption is greater than signing flow, determines and abandons user's request data.It is in response to determining that global traffic consumes Non-empty, and global traffic consumption is greater than signing flow, determines and abandons user's request data.
In some optional implementations of the present embodiment, load threshold includes first threshold, second threshold and third Threshold value, present flow rate consumption further include multiple backup flow consumption, and multiple backup flow consumption are terminal respectively except a upper meter The flow for user's request data that multiple historical counts periods outside one number time submit to portal service consumes.And second determine Unit 502 is further configured to: in response to determining present load amount greater than first threshold and being less than second threshold, and current stream Global traffic consumption and/or local flow consumption in amount consumption are greater than signing flow, abandon user's request data.In response to true Settled preceding load capacity is greater than second threshold and is less than third threshold value, and deposits in multiple backup flows consumption in present flow rate consumption It is greater than signing flow in the consumption of backup flow or global traffic consumption is greater than signing flow, abandons user's request data.
In some optional implementations of the present embodiment, device can also include that third determination unit (is not shown in figure Out).Third determination unit may be configured in response to determining that present load amount is less than load threshold, and determination does not abandon user Request data.
In some optional implementations of the present embodiment, device can also include that step execution unit (does not show in figure Out).Step execution unit may be configured to not abandon user's request data in response to determining, execute following steps: firstly, more New present load amount.Then, it is determined that demand volume needed for institute's request content in user's request data, flow updates according to demand The local flow in current count period consumes.Finally, terminal identity mark and demand volume, coding based on terminal are counted Obtained count information is stored in count information queue by information, and count information queue is the lock-free queue with fixed length memory, Count information in count information queue is sent to counting service node to count, to obtain the overall situation in current count period Flow consumption.
In some optional implementations of the present embodiment, in step execution unit, by the meter in count information queue Number information be sent to count service node carry out count include: based on preset process cycle, will be in count information queue Each count information of counterpart terminal identity merges, and obtains the count information of counterpart terminal, and by the counting of terminal Information is sent to counting service node.
In some optional implementations of the present embodiment, the global traffic consumption in current count period takes via counting Business node is counted to get as follows: count pick up information, and using terminal as granularity, by received counting Information is stored to preset first data store organisation, and the first data store organisation is without lock data structure.In response to true Determining current time is the end for counting the period, counts the total flow of terminal in the first data store organisation, using total flow as working as The preceding global traffic consumption for counting the period, and the data deposit preset second that the first data store organisation is stored The second data store organisation in data store organisation group, and the data stored in the first data store organisation are deleted, second The second data store organisation in data store organisation group is without lock data structure.
In some optional implementations of the present embodiment, in the data deposit for being stored the first data store organisation Before the second data store organisation in preset second data store organisation group, further includes: in response to determining the second number Number according to the second data store organisation occupied in storage organization group is more than preset number threshold value, deletes the storage of the second data The data stored in current occupied longest second data store organisation of duration in structure group.
The device provided by the above embodiment of the disclosure, the use that the first determination unit 501 is sent in response to receiving terminal Family request data determines whether present load amount is more than load threshold.Second determination unit 502 is in response to determining present load amount More than load threshold, the present flow rate consumption of terminal is obtained, is consumed according to the present flow rate of terminal and is closed with the size for flow of contracting System, it is determined whether abandon user's request data.The device of the present embodiment, since portal service is that response is used at first in multiple-stage and split The service of family request data determines whether discarding user's request data by each Service Instance of the portal service of multiple-stage and split, can Flow is controlled from the source of flow with realizing, can both ensure that the traffic load of each Service Instance of portal service is kept In metastable range, and it may insure that the traffic load respectively serviced after portal service is maintained at metastable model In enclosing, the stability of system is helped to improve.In addition, each Service Instance of portal service passes through in combination with the current negative of itself The present flow rate of carrying capacity and terminal consumes two and abandons user's request data because usually determining whether, in the processing energy of Service Instance The use for ensureing the signing flow of user within the scope of power as far as possible, may be implemented the fair and reasonable discarding to user's request data, has Help realize the effective use to data processing resources.
Below with reference to Fig. 6, it illustrates the electronic equipment that is suitable for being used to realize embodiment of the disclosure, (example is as shown in figure 1 Service node) 600 structural schematic diagram.Electronic equipment shown in Fig. 6 is only an example, should not be to embodiment of the disclosure Function and use scope bring any restrictions.
As shown in fig. 6, electronic equipment 600 may include processing unit (such as central processing unit (CPU), graphics process Device etc.) 601, can according to the program being stored in read-only memory (ROM) 602 or from storage device 608 be loaded into Machine accesses the program in memory (RAM) 603 and executes various movements appropriate and processing.In RAM 603, it is also stored with electricity Sub- equipment 600 operates required various programs and data.Processing unit 601, ROM 602 and RAM 603 by bus 604 that This is connected.Input/output (I/O) interface 605 is also connected to bus 604.
In general, following device can connect to I/O interface 605: including such as touch screen, touch tablet, keyboard, mouse, taking the photograph As the input unit 606 of head, microphone, accelerometer, gyroscope etc.;Including such as liquid crystal display (LCD), loudspeaker, vibration The output device 607 of dynamic device etc.;Storage device 608 including such as tape, hard disk etc.;And communication device 609.Communication device 609, which can permit electronic equipment 600, is wirelessly or non-wirelessly communicated with other equipment to exchange data.Although Fig. 6 shows tool There is the electronic equipment 600 of various devices, it should be understood that being not required for implementing or having all devices shown.It can be with Alternatively implement or have more or fewer devices.Each box shown in Fig. 6 can represent a device, can also root According to needing to represent multiple devices.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium On computer program, which includes the program code for method shown in execution flow chart.In such reality It applies in example, which can be downloaded and installed from network by communication device 609, or from storage device 608 It is mounted, or is mounted from ROM 602.When the computer program is executed by processing unit 601, the implementation of the disclosure is executed The above-mentioned function of being limited in the method for example.It should be noted that the computer-readable medium of embodiment of the disclosure can be meter Calculation machine readable signal medium or computer readable storage medium either the two any combination.Computer-readable storage Medium for example may be-but not limited to-system, device or the device of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, Or any above combination.The more specific example of computer readable storage medium can include but is not limited to: have one Or the electrical connections of multiple conducting wires, portable computer diskette, hard disk, random access storage device (RAM), read-only memory (ROM), Erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light Memory device, magnetic memory device or above-mentioned any appropriate combination.In embodiment of the disclosure, computer-readable to deposit Storage media can be any tangible medium for including or store program, which can be commanded execution system, device or device Part use or in connection.And in embodiment of the disclosure, computer-readable signal media may include in base band In or as carrier wave a part propagate data-signal, wherein carrying computer-readable program code.This propagation Data-signal can take various forms, including but not limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Meter Calculation machine readable signal medium can also be any computer-readable medium other than computer readable storage medium, which can Read signal medium can be sent, propagated or be transmitted for being used by instruction execution system, device or device or being tied with it Close the program used.The program code for including on computer-readable medium can transmit with any suitable medium, including but not It is limited to: electric wire, optical cable, RF (radio frequency) etc. or above-mentioned any appropriate combination.
Above-mentioned computer-readable medium can be included in above-mentioned electronic equipment;It is also possible to individualism, and not It is fitted into the electronic equipment.Above-mentioned computer-readable medium carries one or more program, when said one or more When a program is executed by the electronic equipment, so that the electronic equipment: user's request data in response to receiving terminal transmission, really Whether settled preceding load capacity is more than load threshold;In response to determining that present load amount is more than load threshold, the current of terminal is obtained Flow consumption consumes the size relation with flow of contracting according to the present flow rate of terminal, it is determined whether abandon user's request data.
The behaviour for executing embodiment of the disclosure can be write with one or more programming languages or combinations thereof The computer program code of work, programming language include object oriented program language-such as Java, Smalltalk, C++ further include conventional procedural programming language-such as " C " language or similar program design language Speech.Program code can be executed fully on the user computer, partly be executed on the user computer, as an independence Software package execute, part on the user computer part execute on the remote computer or completely in remote computer or It is executed on server.In situations involving remote computers, remote computer can pass through the network of any kind --- packet It includes local area network (LAN) or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as benefit It is connected with ISP by internet).
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the disclosure, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction Combination realize.
Being described in unit involved in embodiment of the disclosure can be realized by way of software, can also be passed through The mode of hardware is realized.Described unit also can be set in the processor, for example, can be described as: a kind of processor Including the first determination unit and the second determination unit.Wherein, the title of these units is not constituted under certain conditions to the list The restriction of member itself, for example, the first determination unit is also described as " in response to receiving user's number of request of terminal transmission According to, determine present load amount whether be more than load threshold unit ".
Above description is only the preferred embodiment of the disclosure and the explanation to institute's application technology principle.Those skilled in the art Member is it should be appreciated that invention scope involved in the disclosure, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed in the disclosure Can technical characteristic replaced mutually and the technical solution that is formed.

Claims (22)

1. a kind of method for controlling flow, the Service Instance applied to the portal service in multiple-stage and split, wherein the side Method includes:
In response to receiving user's request data of terminal transmission, determine whether present load amount is more than load threshold;
In response to determining that present load amount is more than load threshold, the present flow rate consumption of the terminal is obtained, according to the terminal Present flow rate consumption with signing flow size relation, it is determined whether abandon user's request data.
2. according to the method described in claim 1, wherein, the present flow rate consumption includes:
The global traffic consumption that the terminal counts the period upper one, local flow of the terminal in the current count period disappear Consumption;Wherein,
The global traffic consumption is the stream that the terminal counts user's request data that the period submits to portal service upper one Amount consumption, the local flow consumption are user's number of request that the terminal is submitted in the current count period to the Service Instance According to flow consumption.
3. according to the method described in claim 2, wherein, the present flow rate consumption for obtaining the terminal includes:
Asynchronous query request is sent to the counting service node, counts service node based on asynchronous query request to obtain The global traffic consumption that the terminal sent counts the period upper one;
Local flow of the terminal in the current count period is obtained from preset memory locations to consume.
4. described to be consumed and flow of contracting according to the present flow rate of the terminal according to the method described in claim 3, wherein Size relation, it is determined whether abandon user's request data, comprising:
In response to determining that global traffic consumption is sky, and local flow consumption is greater than the signing flow, determining to abandon the use Family request data;
In response to determining that global traffic consumption is non-empty, and global traffic consumption is greater than the signing flow, determines described in abandoning User's request data.
5. according to the method described in claim 2, wherein, the load threshold includes first threshold, second threshold and third threshold Value, the present flow rate consumption further include multiple backup flow consumption, and the multiple backup flow consumption is that the terminal is distinguished In the flow consumption for user's request data that multiple historical counts periods in addition to a upper counting period submit to portal service;With And
It is described in response to determine present load amount be more than load threshold, obtain the terminal present flow rate consumption, according to described The present flow rate consumption and the size relation of signing flow of terminal, it is determined whether abandon user's request data, comprising:
It is greater than first threshold in response to the determination present load amount and is less than second threshold, and in present flow rate consumption The global traffic consumption and/or the local flow consumption are greater than the signing flow, abandon user's request data;
It is greater than second threshold in response to the determination present load amount and is less than third threshold value, and in present flow rate consumption There is the consumption of backup flow in the multiple backup flow consumption to be greater than greater than the signing flow or global traffic consumption The signing flow abandons user's request data.
6. according to the method described in claim 2, wherein, the method also includes: in response to determining that present load amount is less than Load threshold, determination do not abandon user's request data.
7. according to the method described in claim 6, wherein, the method also includes:
User's request data is not abandoned in response to determining, executes following steps:
Update the present load amount;
It determines demand volume needed for institute's request content in user's request data, current meter is updated according to the demand volume The local flow of one number time consumes;
Terminal identity mark and the demand volume based on the terminal, coding obtains count information, by obtained counting Information is stored in count information queue, and the count information queue is the lock-free queue with fixed length memory, by the count information Count information in queue is sent to counting service node and is counted, to obtain the global traffic consumption in current count period.
8. according to the method described in claim 7, wherein, the count information by the count information queue is sent to meter Number service node count
Based on preset process cycle, will be corresponded in count information queue each count information of the terminal identity mark into Row merges, and obtains the count information for corresponding to the terminal, and the count information of the terminal is sent to the counting and is serviced Node.
9. the method according to one of claim 7-8, wherein the global traffic in the current count period is consumed via meter Number service node is counted to get as follows:
Count pick up information, and using terminal as granularity, received count information is stored to preset first number According to storage organization, first data store organisation is without lock data structure;
In response to determining that current time is the end for counting the period, the total of terminal described in first data store organisation is counted Flow is consumed the total flow as the global traffic in the current count period, and first data are stored and are tied The data that structure is stored are stored in the second data store organisation in preset second data store organisation group, and described in deletion The data stored in first data store organisation, the second data store organisation in the second data store organisation group are nothing Lock data structure.
10. according to the method described in claim 9, wherein, in the data for being stored first data store organisation It is stored in front of the second data store organisation in preset second data store organisation group, further includes:
Number in response to occupied second data store organisation in determination the second data store organisation group is more than default Quantity threshold deletes in the second data store organisation group institute in current occupied longest second data store organisation of duration The data of storage.
11. a kind of for controlling the device of flow, applied to any Service Instance processing unit of service node, the service is real Example processing unit is used to run the Service Instance of portal service in multiple-stage and split, wherein described device includes:
First determination unit is configured in response to receive user's request data of terminal transmission, determines that present load amount is No is more than load threshold;
Second determination unit is configured in response to determine that present load amount is more than load threshold, obtains the current of the terminal Flow consumption consumes the size relation with flow of contracting according to the present flow rate of the terminal, it is determined whether abandon the user Request data.
12. device according to claim 11, wherein the present flow rate, which consumes, includes:
The global traffic consumption that the terminal counts the period upper one, local flow of the terminal in the current count period disappear Consumption;Wherein,
The global traffic consumption is the stream that the terminal counts user's request data that the period submits to portal service upper one Amount consumption, the local flow consumption are user's number of request that the terminal is submitted in the current count period to the Service Instance According to flow consumption.
13. device according to claim 12, wherein described to obtain working as the terminal in second determination unit Preceding flow consumes
Asynchronous query request is sent to the counting service node, counts service node based on asynchronous query request to obtain The global traffic consumption that the terminal sent counts the period upper one;
Local flow of the terminal in the current count period is obtained from preset memory locations to consume.
14. device according to claim 13, wherein in second determination unit, the working as according to the terminal The size relation of preceding flow consumption and signing flow, it is determined whether abandon user's request data, comprising:
In response to determining that global traffic consumption is sky, and local flow consumption is greater than the signing flow, determining to abandon the use Family request data;
In response to determining that global traffic consumption is non-empty, and global traffic consumption is greater than the signing flow, determines described in abandoning User's request data.
15. device according to claim 12, wherein the load threshold includes first threshold, second threshold and third Threshold value, the present flow rate consumption further include multiple backup flow consumption, and the multiple backup flow consumption is the terminal point The flow consumption for the user's request data that do not submitted in multiple historical counts periods in addition to a upper counting period to portal service; And
Second determination unit is further configured to:
It is greater than first threshold in response to the determination present load amount and is less than second threshold, and in present flow rate consumption The global traffic consumption and/or the local flow consumption are greater than the signing flow, abandon user's request data;
It is greater than second threshold in response to the determination present load amount and is less than third threshold value, and in present flow rate consumption There is the consumption of backup flow in the multiple backup flow consumption to be greater than greater than the signing flow or global traffic consumption The signing flow abandons user's request data.
16. device according to claim 12, wherein described device further include:
Third determination unit is configured in response to determine that present load amount is less than load threshold, and determination does not abandon the use Family request data.
17. device according to claim 16, wherein described device further include:
Step execution unit is configured in response to determination and does not abandon user's request data, executes following steps:
Update the present load amount;
It determines demand volume needed for institute's request content in user's request data, current meter is updated according to the demand volume The local flow of one number time consumes;
Terminal identity mark and the demand volume based on the terminal, coding obtains count information, by obtained counting Information is stored in count information queue, and the count information queue is the lock-free queue with fixed length memory, by the count information Count information in queue is sent to counting service node and is counted, to obtain the global traffic consumption in current count period.
18. device according to claim 17, wherein described by the count information team in the step execution unit Count information in column is sent to count service node and count
Based on preset process cycle, will be corresponded in count information queue each count information of the terminal identity mark into Row merges, and obtains the count information for corresponding to the terminal, and the count information of the terminal is sent to the counting and is serviced Node.
19. device described in one of 7-18 according to claim 1, wherein the global traffic in the current count period consumes warp It is counted to get as follows by counting service node:
Count pick up information, and using terminal as granularity, received count information is stored to preset first number According to storage organization, first data store organisation is without lock data structure;
In response to determining that current time is the end for counting the period, the total of terminal described in first data store organisation is counted Flow is consumed the total flow as the global traffic in the current count period, and first data are stored and are tied The data that structure is stored are stored in the second data store organisation in preset second data store organisation group, and described in deletion The data stored in first data store organisation, the second data store organisation in the second data store organisation group are nothing Lock data structure.
20. device according to claim 19, wherein in the data for being stored first data store organisation It is stored in front of the second data store organisation in preset second data store organisation group, further includes:
Number in response to occupied second data store organisation in determination the second data store organisation group is more than default Quantity threshold deletes in the second data store organisation group institute in current occupied longest second data store organisation of duration The data of storage.
21. a kind of electronic equipment, comprising:
One or more processors;
Storage device is stored thereon with one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real The now method as described in any in claim 1-10.
22. a kind of computer-readable medium, is stored thereon with computer program, wherein the realization when program is executed by processor Method as described in any in claim 1-10.
CN201910758905.8A 2019-08-16 2019-08-16 Method and device for controlling flow Active CN110430142B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910758905.8A CN110430142B (en) 2019-08-16 2019-08-16 Method and device for controlling flow

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910758905.8A CN110430142B (en) 2019-08-16 2019-08-16 Method and device for controlling flow

Publications (2)

Publication Number Publication Date
CN110430142A true CN110430142A (en) 2019-11-08
CN110430142B CN110430142B (en) 2023-07-18

Family

ID=68415105

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910758905.8A Active CN110430142B (en) 2019-08-16 2019-08-16 Method and device for controlling flow

Country Status (1)

Country Link
CN (1) CN110430142B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965519A (en) * 2021-09-06 2022-01-21 阿里巴巴(中国)有限公司 Flow control method, cluster resource guarantee method, equipment and storage medium
CN114590656A (en) * 2022-01-30 2022-06-07 云知声智能科技股份有限公司 Elevator control method, elevator control device, electronic equipment and storage medium
CN114710447A (en) * 2020-12-16 2022-07-05 百寻信息科技(上海)有限公司 Balanced advertisement flow control method and system
CN115134301A (en) * 2022-06-29 2022-09-30 中国工商银行股份有限公司 Flow control method and device, computer equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1642136A (en) * 2004-01-17 2005-07-20 华为技术有限公司 Data flow band width control method
CN104303473A (en) * 2013-05-06 2015-01-21 华为技术有限公司 Flow control method and apparatus of operator sharing network
CN105577573A (en) * 2015-12-31 2016-05-11 联想(北京)有限公司 Information processing method and electronic device
CN106059940A (en) * 2016-05-25 2016-10-26 杭州昆海信息技术有限公司 Flow control method and device
CN106302211A (en) * 2016-07-18 2017-01-04 网易无尾熊(杭州)科技有限公司 The request amount control method of a kind of Internet resources and device
CN107770088A (en) * 2017-09-06 2018-03-06 阿里巴巴集团控股有限公司 A kind of flow control methods and device
CN108173938A (en) * 2017-12-28 2018-06-15 泰康保险集团股份有限公司 Server load shunt method and device
CN108768870A (en) * 2018-05-04 2018-11-06 Oppo广东移动通信有限公司 Flow control methods, device and mobile terminal
US20190150034A1 (en) * 2016-07-11 2019-05-16 Huawei Technologies Co., Ltd. Service Traffic Control Method and System and Decision Network Element
CN110008050A (en) * 2019-04-11 2019-07-12 北京百度网讯科技有限公司 Method and apparatus for handling information

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1642136A (en) * 2004-01-17 2005-07-20 华为技术有限公司 Data flow band width control method
CN104303473A (en) * 2013-05-06 2015-01-21 华为技术有限公司 Flow control method and apparatus of operator sharing network
CN105577573A (en) * 2015-12-31 2016-05-11 联想(北京)有限公司 Information processing method and electronic device
CN106059940A (en) * 2016-05-25 2016-10-26 杭州昆海信息技术有限公司 Flow control method and device
US20190150034A1 (en) * 2016-07-11 2019-05-16 Huawei Technologies Co., Ltd. Service Traffic Control Method and System and Decision Network Element
CN106302211A (en) * 2016-07-18 2017-01-04 网易无尾熊(杭州)科技有限公司 The request amount control method of a kind of Internet resources and device
CN107770088A (en) * 2017-09-06 2018-03-06 阿里巴巴集团控股有限公司 A kind of flow control methods and device
CN108173938A (en) * 2017-12-28 2018-06-15 泰康保险集团股份有限公司 Server load shunt method and device
CN108768870A (en) * 2018-05-04 2018-11-06 Oppo广东移动通信有限公司 Flow control methods, device and mobile terminal
CN110008050A (en) * 2019-04-11 2019-07-12 北京百度网讯科技有限公司 Method and apparatus for handling information

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114710447A (en) * 2020-12-16 2022-07-05 百寻信息科技(上海)有限公司 Balanced advertisement flow control method and system
CN114710447B (en) * 2020-12-16 2024-05-03 百寻信息科技(上海)有限公司 Balanced advertisement flow control method and system
CN113965519A (en) * 2021-09-06 2022-01-21 阿里巴巴(中国)有限公司 Flow control method, cluster resource guarantee method, equipment and storage medium
CN113965519B (en) * 2021-09-06 2024-01-26 阿里巴巴(中国)有限公司 Flow control and cluster resource guarantee method, equipment and storage medium
CN114590656A (en) * 2022-01-30 2022-06-07 云知声智能科技股份有限公司 Elevator control method, elevator control device, electronic equipment and storage medium
CN114590656B (en) * 2022-01-30 2024-03-26 云知声智能科技股份有限公司 Elevator control method, device, electronic equipment and storage medium
CN115134301A (en) * 2022-06-29 2022-09-30 中国工商银行股份有限公司 Flow control method and device, computer equipment and storage medium
CN115134301B (en) * 2022-06-29 2024-04-05 中国工商银行股份有限公司 Flow control method, flow control device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110430142B (en) 2023-07-18

Similar Documents

Publication Publication Date Title
CN110430142A (en) Method and apparatus for controlling flow
CN107729139B (en) Method and device for concurrently acquiring resources
US20200328984A1 (en) Method and apparatus for allocating resource
CN109523187A (en) Method for scheduling task, device and equipment
JP2015537307A (en) Component-oriented hybrid cloud operating system architecture and communication method thereof
WO2021088641A1 (en) Data transmission method, data processing method, data reception method and device, and storage medium
CN110677462B (en) Access processing method, system, device and storage medium for multi-block chain network
CN109947565A (en) Method and apparatus for distributing calculating task
CN109840142A (en) Thread control method, device, electronic equipment and storage medium based on cloud monitoring
WO2024016596A1 (en) Container cluster scheduling method and apparatus, device, and storage medium
CN110390493A (en) Task management method, device, storage medium and electronic equipment
CN111240834A (en) Task execution method and device, electronic equipment and storage medium
CN111309415A (en) UI (user interface) information processing method and device of application program and electronic equipment
CN113760991A (en) Data operation method and device, electronic equipment and computer readable medium
CN109918381A (en) Method and apparatus for storing data
CN109726007A (en) A kind of container layout quota management method and device and container arranging system
CN110401731A (en) Method and apparatus for distributing content distribution nodes
CN112910835B (en) Block chain-based configuration management method, apparatus, system, device, and medium
CN113743879A (en) Automatic rule processing method, system and related equipment
CN110992011A (en) Data splitting method and device, electronic equipment and storage medium
CN108984770A (en) Method and apparatus for handling data
CN111694670B (en) Resource allocation method, apparatus, device and computer readable medium
CN114138427A (en) SLO guarantee method, SLO guarantee device, node, and storage medium
CN109905435A (en) Resource subscription method and system, storage medium, electronic equipment
CN113098960A (en) Service operation method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant