CN113726885B - Flow quota adjusting method and device - Google Patents

Flow quota adjusting method and device Download PDF

Info

Publication number
CN113726885B
CN113726885B CN202111005526.5A CN202111005526A CN113726885B CN 113726885 B CN113726885 B CN 113726885B CN 202111005526 A CN202111005526 A CN 202111005526A CN 113726885 B CN113726885 B CN 113726885B
Authority
CN
China
Prior art keywords
data object
flow
user identifier
object set
transmission request
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.)
Active
Application number
CN202111005526.5A
Other languages
Chinese (zh)
Other versions
CN113726885A (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 Skyguard Network Security Technology Co ltd
Original Assignee
Beijing Skyguard Network Security Technology Co ltd
Filing date
Publication date
Application filed by Beijing Skyguard Network Security Technology Co ltd filed Critical Beijing Skyguard Network Security Technology Co ltd
Priority to CN202111005526.5A priority Critical patent/CN113726885B/en
Publication of CN113726885A publication Critical patent/CN113726885A/en
Application granted granted Critical
Publication of CN113726885B publication Critical patent/CN113726885B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a method and a device for adjusting flow quota, and relates to the technical field of computers. One embodiment of the method comprises the following steps: receiving one or more flow transmission requests, and determining a user identifier according to request information in the flow transmission requests for each flow transmission request; searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set; and adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set. According to the flow quota adjusting method and device, the flow statistics efficiency and the flow quota adjusting efficiency are improved, and the accuracy of the adjusted flow quota is guaranteed.

Description

Flow quota adjusting method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for adjusting a flow quota.
Background
As a bridge for connecting one network terminal (such as a client) and another network terminal (such as a target server), the proxy server is required to ensure the privacy and safety of the network terminal, count the flow value corresponding to the network terminal in the flow transmission process, adjust the flow quota (residual flow quota) corresponding to the network terminal by combining the flow quota policy, and execute corresponding operations (such as warning, current limiting, etc.).
The prior art has at least the following problems:
When the statistical flow value of the external database is adopted in the existing method, the performance of the external database is required to be depended on, and the database is required to be regularly maintained; when the flow value is counted in a log recording mode, the real-time statistics is difficult to realize, and the counted flow value has certain hysteresis, so that the accuracy of the adjusted flow quota is low; and by adopting a single-process multithreading mode, the flow values counted respectively are inserted into the values, so that locking and unlocking operations are needed to be executed, the counting time of the flow values is prolonged, and the adjustment efficiency is low.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a method and an apparatus for adjusting a flow quota, which can construct a data object for each client in a proxy server, and only need to find a corresponding data object when a flow transmission request is initiated each time, so that a flow value corresponding to the client in a flow transmission process can be counted in real time, thereby improving flow counting efficiency, further improving efficiency of adjusting the flow quota, and guaranteeing accuracy of the adjusted flow quota.
In order to achieve the above object, according to a first aspect of an embodiment of the present invention, there is provided a method for adjusting a flow quota, including:
Receiving one or more flow transmission requests, and determining a user identifier according to request information in the flow transmission requests for each flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server;
Searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier;
Carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set;
and adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set.
Further, if the first data object corresponding to the user identifier does not exist in the searching process of the data object set, the method further includes:
creating a second data object according to the user identification;
and carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the second data object, and writing the statistical operation result into the second data object.
Further, after the step of writing the statistical operation result to the second data object, the method further includes:
judging whether a data object corresponding to the user identifier exists in the data object set or not;
If so, acquiring an address corresponding to the data object corresponding to the user identifier in the data object set, and writing the flow value counted in the second data object into the address;
And if not, locking the data object set, and inserting the second data object into the data object set successfully locked.
Further, locking the data object set, inserting the second data object into the data object set successfully locked, including:
locking the data object set, and judging whether the locking is successful or not;
And if the locking processing fails, placing the second data object in the candidate queue, so that the candidate queue carries out locking processing on the data object set again until the locking processing is successful.
Further, if the locking process is successful, the method further comprises:
Judging whether the data object corresponding to the user identifier exists in the data object set successfully locked according to the user identifier again;
If the traffic value exists, taking a data object corresponding to the user identifier in the data object set as a target data object, and writing the traffic value counted in the second data object into the target data object;
if not, inserting the second data object into the data object set.
Further, the statistical operation for the traffic value corresponding to the traffic transmission request corresponding to the first data object includes:
and counting the traffic value corresponding to the traffic transmission request corresponding to the first data object in an atomic operation mode.
According to a second aspect of an embodiment of the present invention, there is provided a flow quota adjusting apparatus, including:
The receiving module is used for receiving one or more flow transmission requests, and determining a user identifier according to request information in the flow transmission requests for each flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server;
The first data object determining module is used for searching from the data object set according to the user identification to determine a first data object and acquiring a corresponding address of the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier;
The statistics module is used for carrying out statistics operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistics operation result into the address corresponding to the first data object in the data object set;
the adjusting module is used for adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set.
Further, the system also comprises a second data object creation module, and if the first data object corresponding to the user identifier does not exist in the searching process of the data object set; a second data object creation module for:
creating a second data object according to the user identification;
and carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the second data object, and writing the statistical operation result into the second data object.
According to a third aspect of an embodiment of the present invention, there is provided an electronic apparatus including:
One or more processors;
Storage means for storing one or more programs,
When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement a method for adjusting a flow quota as any one of the above.
According to a fourth aspect of an embodiment of the present invention, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method of adjusting a flow quota as any one of the above.
One embodiment of the above invention has the following advantages or benefits: because the method adopts the steps of receiving one or more flow transmission requests, for each flow transmission request, determining a user identifier according to request information in the flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server; searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set; the technical means of adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set overcomes the technical problems of low adjustment efficiency and low accuracy of the adjusted flow quota existing in the existing method due to the dependence on the performance of an external database, and further achieves the technical effects of improving the flow statistics efficiency, improving the efficiency of adjusting the flow quota and guaranteeing the accuracy of the adjusted flow quota.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a method for adjusting a flow quota according to a first embodiment of the invention;
Fig. 2 is a schematic diagram of a main flow of a flow quota adjustment method according to a second embodiment of the invention;
fig. 3 is a schematic diagram of main modules of a flow quota adjusting device provided according to an embodiment of the invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 5 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a main flow of a method for adjusting a flow quota according to a first embodiment of the invention; as shown in fig. 1, the method for adjusting flow quota provided by the embodiment of the present invention mainly includes:
Step S101, receiving one or more flow transmission requests, and determining a user identifier according to request information in the flow transmission requests for each flow transmission request; the flow transmission request comprises an access request sent by the client in the current flow transmission request and a response request returned by the target server.
Specifically, according to the embodiment of the present invention, for the above-mentioned multiple traffic transmission requests, the traffic transmission requests may be sent by one network terminal, or may be sent by multiple network terminals, and one network terminal (such as a client) may initiate multiple traffic transmission requests at the same time.
Further, according to the embodiment of the present invention, an interaction between the client and the target server is involved in one traffic transmission process, and the subsequent determination of the traffic value in the current traffic transmission process also refers to the traffic value generated in one interaction process (request and response).
The request information includes information such as a user number, an IP address, a port number, etc., and a unique user identifier is determined according to the request information, so that a data object corresponding to the user identifier can be determined later, and statistics can be performed on a traffic value in a traffic transmission process.
Step S102, searching from the data object set according to the user identification to determine a first data object, and acquiring a corresponding address of the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier.
Through the arrangement, the first data object is determined from the data object set according to the unique user identifier corresponding to the flow transmission request, so that the flow value in the flow transmission request is counted on the basis of the counted flow value of the data object, the corresponding total flow value of the user in the process of multiple flow transmission requests is conveniently determined, and the flow quota is conveniently adjusted subsequently. On the other hand, the address corresponding to the first data object in the data object set is acquired, so that the flow value counted in the current flow transmission process can be directly written into the address, namely, the flow value is directly written into the first data object corresponding to the user identifier in the data object set, the real-time counting of the flow value is realized, the counting efficiency of the flow value is improved, and the adjustment efficiency of the flow quota is further improved.
Further, according to an embodiment of the present invention, if in the process of searching the data object set, it is determined that the first data object corresponding to the user identifier does not exist, the method further includes:
creating a second data object according to the user identification;
and carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the second data object, and writing the statistical operation result into the second data object.
In the actual implementation process, after determining the user identifier, firstly querying and judging whether a first data object corresponding to the user identifier exists in the data object set, and if so, acquiring the address corresponding to the first data object in the data object set; if the data object does not exist, the first data object corresponding to the user identifier does not exist in the data object set, namely, the client corresponding to the user identifier does not initiate a flow transmission request and does not generate a flow value, and at the moment, the second data object is reconstructed according to the user identifier and is used as the data object for flow value statistics in the current transmission process. Through the arrangement, even if the client initiating the flow transmission request does not have a corresponding data object in the data object set, the flow value statistics can be performed by creating the data object, and then the data object set is updated according to the second data object, so that the statistics efficiency and the statistics accuracy of the flow value are ensured, and meanwhile, even if a plurality of flow transmission requests initiated by the client corresponding to the user identifier are received, the flow value corresponding to each flow transmission request can be simultaneously counted, the iteration statistics is performed on the total flow value, the statistics efficiency is improved, and the statistics error is avoided.
Preferably, according to an embodiment of the present invention, after the step of writing the statistical operation result to the second data object, the method further includes:
judging whether a data object corresponding to the user identifier exists in the data object set or not;
if yes, an address corresponding to the data object corresponding to the user identifier in the data object set is obtained, and the flow value counted in the second data object is written into the address;
And if not, carrying out locking processing on the data object set, and inserting the second data object into the data object set with successful locking processing.
In a specific embodiment, in the process of constructing a new data object (i.e. the second data object) according to the user identifier, the data object corresponding to the user identifier may already be inserted into the data object set by other statistics units, so as to avoid that a plurality of data objects exist for the same user identifier in the data object set, before inserting the newly constructed target data object into the data object set, it is required to determine whether the data object corresponding to the user identifier exists in the data object set again.
According to another specific implementation manner of the embodiment of the present invention, since the same client may initiate multiple traffic transmission requests at the same time, at this time, a second data object is respectively constructed for the user identifier corresponding to each traffic transmission request, that is, before inserting the data object set, a plurality of second data objects may be already constructed for the same user identifier, if the second data object is directly inserted into the data object set, after the client initiates the traffic transmission request again, the client may query a plurality of data objects corresponding to the user identifier in the data object set, thereby increasing complexity of determining the target data object, increasing difficulty coefficient for summarizing the total traffic value corresponding to the user identifier, and consuming more statistical time of the traffic value. Therefore, when a newly constructed second data object is inserted into the data object set, locking processing needs to be performed on the data object set, and after locking is successful, the newly constructed second data object is inserted into the data object set.
Through the arrangement, before the flow value statistics is executed, the existence of the data object corresponding to the user identifier is effectively ensured, the flow value generated in the flow transmission process of the client corresponding to the user identifier is counted (if the first data corresponds to the data set, the flow value counted in the current flow transmission process is directly summarized to the flow value counted in the original according to the address of the first data object), the instantaneity of the flow statistics is ensured, and the adjustment efficiency of the flow quota is improved.
Illustratively, according to an embodiment of the present invention, performing locking processing on a data object set, and inserting a second data object into the data object set where the locking processing is successful includes:
locking the data object set, and judging whether the locking is successful or not;
And if the locking processing fails, placing the second data object in the candidate queue, so that the candidate queue carries out locking processing on the data object set again until the locking processing is successful.
Specifically, when the locking fails, the target data object to be inserted into the data object set is placed in a candidate queue, so that the locking process is conveniently executed again.
Further, according to an embodiment of the present invention, if the locking process is successful, the method further includes:
Judging whether the data object corresponding to the user identifier exists in the data object set successfully locked according to the user identifier again;
If the traffic value exists, taking a data object corresponding to the user identifier in the data object set as a target data object, and writing the traffic value counted in the second data object into the target data object;
if not, inserting the second data object into the data object set.
In the implementation, when the locking process is performed last time, corresponding data objects are inserted for the same user identifier, so that only the data object corresponding to the same user identifier exists in the data object set, and whether the data object corresponding to the user identifier exists in the data object set needs to be queried and judged again. If the user identification exists, taking a data object corresponding to the user identification in the data object set as a target data object corresponding to the user identification, namely updating the target data object, and acquiring the address of the target data object; if the data object does not exist, inserting a second data object which is newly created and completes flow value statistics in the current flow transmission process into the data object set, and updating the data object set.
Step S103, carrying out statistics operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistics operation result into the address corresponding to the first data object in the data object set.
Specifically, according to an embodiment of the present invention, the performing a statistical operation on a traffic value corresponding to a traffic transmission request corresponding to a first data object includes:
and counting the traffic value corresponding to the traffic transmission request corresponding to the first data object in an atomic operation mode.
An atomic operation refers to an operation that is not interrupted by a thread scheduling mechanism, and once started, runs to the end without switching to another thread in the middle. Statistics are performed in an atomic operation mode: when a plurality of threads perform locking operation on the same counter (the traffic values counted by a plurality of traffic transmission requests initiated by the same client are superimposed on the original statistics values of the same data object), if the counter values (superimposed total statistics values) are inaccurate due to the fact that locking is not performed, if the same counter values are subjected to locking operation, the plurality of threads can compete for the same lock, and therefore calculation efficiency is reduced. By using atomic operation, an operation lock is not needed, the calculation operation is completed by a compiler and hardware, the calculation performance is improved, and the realization of logic is simpler.
According to the embodiment of the invention, in specific implementation, the same client may initiate a plurality of traffic transmission requests at the same time, that is, a plurality of statistics units acquire data object addresses corresponding to the same user identifier from the data object set, and write corresponding traffic values into corresponding addresses in respective statistical traffic transmission processes. Through atomic operation, multiple times of writing aiming at the same data object are realized, and errors caused by writing of a plurality of statistical values (summarizing, and overlapping new writing to the flow value of the original statistics) are avoided.
Step S104, the flow quota corresponding to each data object is adjusted according to the flow quota strategy and the flow value of each data object in the data object set.
The proxy server formulates a flow quota strategy according to network bandwidth, data of a network terminal (client) initiating access and the like, adjusts the flow quota (residual flow quota) corresponding to each data object by combining flow values (total flow values updated in real time and including flow values generated in each flow transmission process) corresponding to each data object in the data object set, and executes corresponding operations (such as warning, current limiting and the like) according to the flow quota of each data object.
According to the technical scheme of the embodiment of the invention, because one or more flow transmission requests are received, for each flow transmission request, the user identification is determined according to the request information in the flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server; searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set; the technical means of adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set overcomes the technical problems of low adjustment efficiency and low accuracy of the adjusted flow quota existing in the existing method due to the dependence on the performance of an external database, and further achieves the technical effects of improving the flow statistics efficiency, improving the efficiency of adjusting the flow quota and guaranteeing the accuracy of the adjusted flow quota.
Fig. 2 is a schematic diagram of a main flow of a flow quota adjustment method according to a second embodiment of the invention; as shown in fig. 2, the method for adjusting flow quota provided by the embodiment of the present invention mainly includes:
Step S201, one or more flow transmission requests are received, and for each flow transmission request, a user identifier is determined according to the request information in the flow transmission request. The flow transmission request comprises an access request sent by the client in the current flow transmission request and a response request returned by the target server.
Specifically, according to the embodiment of the present invention, for the above-mentioned multiple traffic transmission requests, the traffic transmission requests may be sent by one network terminal, or may be sent by multiple network terminals, and one network terminal (such as a client) may initiate multiple traffic transmission requests at the same time.
The request information includes information such as a user number, an IP address, a port number, etc., and a unique user identifier is determined according to the request information, so that a data object corresponding to the user identifier can be determined later, and statistics can be performed on a traffic value in a traffic transmission process.
Further, according to an embodiment of the present invention, a state machine in a proxy server may be used to receive a traffic transmission request, and a traffic value generated during an interaction (including a request from a client and a response from a server) between a client and a server is counted by one state machine.
Step S202, searching from the data object set according to the user identification, and judging whether a first data object corresponding to the user identification exists or not. If so, execute step S203; if not, go to step S204.
Specifically, the data object is used for indicating the corresponding relation between the user identifier and the traffic value correspondingly transmitted by the user identifier.
Step S203, the corresponding address of the first data object in the data object set is obtained, the statistical operation is performed on the traffic value corresponding to the traffic transmission request corresponding to the first data object, and the statistical operation result is written into the corresponding address of the first data object in the data object set.
Through the arrangement, the first data object is determined from the data object set according to the unique user identifier corresponding to the flow transmission request, so that the flow value in the flow transmission request is counted on the basis of the counted flow value of the data object, the corresponding total flow value of the user in the process of multiple flow transmission requests is conveniently determined, and the flow quota is conveniently adjusted subsequently. On the other hand, the address corresponding to the first data object in the data object set is acquired, so that the flow value counted in the current flow transmission process can be directly written into the address, namely, the flow value is directly written into the first data object corresponding to the user identifier in the data object set, the real-time counting of the flow value is realized, the counting efficiency of the flow value is improved, and the adjustment efficiency of the flow quota is further improved.
Step S204, creating a second data object according to the user identification; and carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the second data object, and writing the statistical operation result into the second data object.
In the actual implementation process, after determining the user identifier, firstly querying and judging whether a first data object corresponding to the user identifier exists in the data object set, and if so, acquiring the address corresponding to the first data object in the data object set; if the data object does not exist, the first data object corresponding to the user identifier does not exist in the data object set, namely, the client corresponding to the user identifier does not initiate a flow transmission request and does not generate a flow value, and at the moment, the second data object is reconstructed according to the user identifier and is used as the data object for flow value statistics in the current transmission process. Through the arrangement, even if the client initiating the flow transmission request does not have a corresponding data object in the data object set, the flow value statistics can be performed by creating the data object, and then the data object set is updated according to the second data object, so that the statistics efficiency and the statistics accuracy of the flow value are ensured, and meanwhile, even if a plurality of flow transmission requests initiated by the client corresponding to the user identifier are received, the flow value corresponding to each flow transmission request can be simultaneously counted, the iteration statistics is performed on the total flow value, the statistics efficiency is improved, and the statistics error is avoided.
According to an embodiment of the present invention, in order to facilitate distinguishing a first data object (already stored in a data object set) from a second data object (newly created and not yet inserted into the data object set), the distinguishing may be performed according to a parameter in db of the data object, where in db parameter is true for the data object already stored in the data object set; if not already stored in the data object set (e.g., the newly created second data object), its in db parameter is false.
Step S205, judging whether a data object corresponding to the user identifier exists in the data object set; if so, acquiring an address corresponding to the data object corresponding to the user identifier in the data object set, and writing the flow value counted in the second data object into the address; and if not, locking the data object set, and inserting the second data object into the data object set successfully locked.
In a specific embodiment, in the process of constructing a new data object (i.e. the second data object) according to the user identifier, the data object corresponding to the user identifier may already be inserted into the data object set by other statistics units, so as to avoid that a plurality of data objects exist for the same user identifier in the data object set, before inserting the newly constructed target data object into the data object set, it is required to determine whether the data object corresponding to the user identifier exists in the data object set again.
According to another specific implementation manner of the embodiment of the present invention, since the same client may initiate multiple traffic transmission requests at the same time, at this time, a second data object is respectively constructed for the user identifier corresponding to each traffic transmission request, that is, before inserting the data object set, a plurality of second data objects may be already constructed for the same user identifier, if the second data object is directly inserted into the data object set, after the client initiates the traffic transmission request again, the client may query a plurality of data objects corresponding to the user identifier in the data object set, thereby increasing complexity of determining the target data object, increasing difficulty coefficient for summarizing the total traffic value corresponding to the user identifier, and consuming more statistical time of the traffic value. Therefore, when a newly constructed second data object is inserted into the data object set, locking processing needs to be performed on the data object set, and after locking is successful, the newly constructed second data object is inserted into the data object set.
Through the arrangement, before the flow value statistics is executed, the existence of the data object corresponding to the user identifier is effectively ensured, the flow value generated in the flow transmission process of the client corresponding to the user identifier is counted (if the first data corresponds to the data set, the flow value counted in the current flow transmission process is directly summarized to the flow value counted in the original according to the address of the first data object), the instantaneity of the flow statistics is ensured, and the adjustment efficiency of the flow quota is improved.
Illustratively, according to an embodiment of the present invention, performing locking processing on a data object set, and inserting a second data object into the data object set where the locking processing is successful includes:
locking the data object set, and judging whether the locking is successful or not;
And if the locking processing fails, placing the second data object in the candidate queue, so that the candidate queue carries out locking processing on the data object set again until the locking processing is successful.
Specifically, when the locking fails, the target data object to be inserted into the data object set is placed in a candidate queue, so that the locking process is conveniently executed again.
Further, according to an embodiment of the present invention, if the locking process is successful, the method further includes:
Judging whether the data object corresponding to the user identifier exists in the data object set successfully locked according to the user identifier again;
If the traffic value exists, taking a data object corresponding to the user identifier in the data object set as a target data object, and writing the traffic value counted in the second data object into the target data object;
if not, inserting the second data object into the data object set.
In the implementation, when the locking process is performed last time, corresponding data objects are inserted for the same user identifier, so that only the data object corresponding to the same user identifier exists in the data object set, and whether the data object corresponding to the user identifier exists in the data object set needs to be queried and judged again. If the user identification exists, taking a data object corresponding to the user identification in the data object set as a target data object corresponding to the user identification, namely updating the target data object, and acquiring the address of the target data object; if the data object does not exist, inserting a second data object which is newly created and completes flow value statistics in the current flow transmission process into the data object set, and updating the data object set.
Specifically, according to the embodiment of the present invention, the statistical operation is performed in an atomic operation manner when the traffic value corresponding to the traffic transmission request is performed.
An atomic operation refers to an operation that is not interrupted by a thread scheduling mechanism, and once started, runs to the end without switching to another thread in the middle. Statistics are performed in an atomic operation mode: when a plurality of threads perform locking operation on the same counter (the traffic values counted by a plurality of traffic transmission requests initiated by the same client are superimposed on the original statistics values of the same data object), if the counter values (superimposed total statistics values) are inaccurate due to the fact that locking is not performed, if the same counter values are subjected to locking operation, the plurality of threads can compete for the same lock, and therefore calculation efficiency is reduced. By using atomic operation, an operation lock is not needed, the calculation operation is completed by a compiler and hardware, the calculation performance is improved, and the realization of logic is simpler.
According to the embodiment of the invention, in specific implementation, the same client may initiate a plurality of traffic transmission requests at the same time, that is, a plurality of statistics units acquire data object addresses corresponding to the same user identifier from the data object set, and write corresponding traffic values into corresponding addresses in respective statistical traffic transmission processes. Through atomic operation, multiple times of writing aiming at the same data object are realized, and errors caused by writing of a plurality of statistical values (summarizing, and overlapping new writing to the flow value of the original statistics) are avoided.
Step S206, the flow quota corresponding to each data object is adjusted according to the flow quota strategy and the flow value of each data object in the data object set.
The proxy server formulates a flow quota strategy according to network bandwidth, data of a network terminal (client) initiating access and the like, adjusts the flow quota (residual flow quota) corresponding to each data object by combining flow values (total flow values updated in real time and including flow values generated in each flow transmission process) corresponding to each data object in the data object set, and executes corresponding operations (such as warning, current limiting and the like) according to the flow quota of each data object.
According to the technical scheme of the embodiment of the invention, because one or more flow transmission requests are received, for each flow transmission request, the user identification is determined according to the request information in the flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server; searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set; the technical means of adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set overcomes the technical problems of low adjustment efficiency and low accuracy of the adjusted flow quota existing in the existing method due to the dependence on the performance of an external database, and further achieves the technical effects of improving the flow statistics efficiency, improving the efficiency of adjusting the flow quota and guaranteeing the accuracy of the adjusted flow quota.
Fig. 3 is a schematic diagram of main modules of a flow quota adjusting device provided according to an embodiment of the invention; as shown in fig. 3, the flow quota adjusting apparatus 300 provided in the embodiment of the present invention mainly includes:
A receiving module 301, configured to receive one or more traffic transmission requests, and for each traffic transmission request, determine a user identifier according to request information in the traffic transmission request; the flow transmission request comprises an access request sent by the client in the current flow transmission request and a response request returned by the target server.
Specifically, according to the embodiment of the present invention, for the above-mentioned multiple traffic transmission requests, the traffic transmission requests may be sent by one network terminal, or may be sent by multiple network terminals, and one network terminal (such as a client) may initiate multiple traffic transmission requests at the same time.
Further, according to the embodiment of the present invention, an interaction between the client and the target server is involved in one traffic transmission process, and the subsequent determination of the traffic value in the current traffic transmission process also refers to the traffic value generated in one interaction process (request and response).
The request information includes information such as a user number, an IP address, a port number, etc., and the user identifier is determined according to the request information, so that a data object corresponding to the user identifier is determined later, and statistics is performed on the traffic value in the traffic transmission process.
The first data object determining module 302 searches from the data object set according to the user identifier to determine a first data object, and obtains an address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier.
Through the arrangement, the first data object is determined from the data object set according to the unique user identifier corresponding to the flow transmission request, so that the flow value in the flow transmission request is counted on the basis of the counted flow value of the data object, the corresponding total flow value of the user in the process of multiple flow transmission requests is conveniently determined, and the flow quota is conveniently adjusted subsequently. On the other hand, the address corresponding to the first data object in the data object set is acquired, so that the flow value counted in the current flow transmission process can be directly written into the address, namely, the flow value is directly written into the first data object corresponding to the user identifier in the data object set, the real-time counting of the flow value is realized, the counting efficiency of the flow value is improved, and the adjustment efficiency of the flow quota is further improved.
Further, according to an embodiment of the present invention, the flow quota adjusting apparatus 300 further includes a second data object determining module, configured to determine that the first data object corresponding to the user identifier does not exist in the process of searching the data object set; a second data object creation module for:
creating a second data object according to the user identification;
and carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the second data object, and writing the statistical operation result into the second data object.
In the actual implementation process, after determining the user identifier, firstly querying and judging whether a first data object corresponding to the user identifier exists in the data object set, and if so, acquiring the address corresponding to the first data object in the data object set; if the data object does not exist, the first data object corresponding to the user identifier does not exist in the data object set, namely, the client corresponding to the user identifier does not initiate a flow transmission request and does not generate a flow value, and at the moment, the second data object is reconstructed according to the user identifier and is used as the data object for flow value statistics in the current transmission process. Through the arrangement, even if the client initiating the flow transmission request does not have a corresponding data object in the data object set, the flow value statistics can be performed by creating the data object, and then the data object set is updated according to the second data object, so that the statistics efficiency and the statistics accuracy of the flow value are ensured, and meanwhile, even if a plurality of flow transmission requests initiated by the client corresponding to the user identifier are received, the flow value corresponding to each flow transmission request can be simultaneously counted, the iteration statistics is performed on the total flow value, the statistics efficiency is improved, and the statistics error is avoided.
And the statistics module 303 is configured to perform a statistics operation on a flow value transmitted by the target data object in the current flow transmission process, and write a result of the statistics operation into an address corresponding to the target data object in the data object set.
Specifically, according to an embodiment of the present invention, after the step of writing the statistical operation result to the second data object, the statistical module 303 is further configured to:
judging whether a data object corresponding to the user identifier exists in the data object set or not;
if yes, an address corresponding to the data object corresponding to the user identifier in the data object set is obtained, and the flow value counted in the second data object is written into the address;
And if not, carrying out locking processing on the data object set, and inserting the second data object into the data object set with successful locking processing.
In a specific embodiment, in the process of constructing a new data object (i.e. the second data object) according to the user identifier, the data object corresponding to the user identifier may already be inserted into the data object set by other statistics units, so as to avoid that a plurality of data objects exist for the same user identifier in the data object set, before inserting the newly constructed target data object into the data object set, it is required to determine whether the data object corresponding to the user identifier exists in the data object set again.
According to another specific implementation manner of the embodiment of the present invention, since the same client may initiate multiple traffic transmission requests at the same time, at this time, a second data object is respectively constructed for the user identifier corresponding to each traffic transmission request, that is, before inserting the data object set, a plurality of second data objects may be already constructed for the same user identifier, if the second data object is directly inserted into the data object set, after the client initiates the traffic transmission request again, the client may query a plurality of data objects corresponding to the user identifier in the data object set, thereby increasing complexity of determining the target data object, increasing difficulty coefficient for summarizing the total traffic value corresponding to the user identifier, and consuming more statistical time of the traffic value. Therefore, when a newly constructed second data object is inserted into the data object set, locking processing needs to be performed on the data object set, and after locking is successful, the newly constructed second data object is inserted into the data object set.
Through the arrangement, before the flow value statistics is executed, the existence of the data object corresponding to the user identifier is effectively ensured, the flow value generated in the flow transmission process of the client corresponding to the user identifier is counted (if the first data corresponds to the data set, the flow value counted in the current flow transmission process is directly summarized to the flow value counted in the original according to the address of the first data object), the instantaneity of the flow statistics is ensured, and the adjustment efficiency of the flow quota is improved.
Illustratively, the statistics module 303 is further configured to:
locking the data object set, and judging whether the locking is successful or not;
And if the locking processing fails, placing the second data object in the candidate queue, so that the candidate queue carries out locking processing on the data object set again until the locking processing is successful.
Specifically, when the locking fails, the target data object to be inserted into the data object set is placed in a candidate queue, so that the locking process is conveniently executed again.
Further, according to an embodiment of the present invention, if the locking process is successful, the statistics module 303 is further configured to:
Judging whether the data object corresponding to the user identifier exists in the data object set successfully locked according to the user identifier again;
If the traffic value exists, taking a data object corresponding to the user identifier in the data object set as a target data object, and writing the traffic value counted in the second data object into the target data object;
if not, inserting the second data object into the data object set.
In the implementation, when the locking process is performed last time, corresponding data objects are inserted for the same user identifier, so that only the data object corresponding to the same user identifier exists in the data object set, and whether the data object corresponding to the user identifier exists in the data object set needs to be queried and judged again. If the user identification exists, taking a data object corresponding to the user identification in the data object set as a target data object corresponding to the user identification, namely updating the target data object, and acquiring the address of the target data object; if the data object does not exist, inserting a second data object which is newly created and completes flow value statistics in the current flow transmission process into the data object set, and updating the data object set.
Specifically, according to an embodiment of the present invention, the statistics module 303 is further configured to:
and counting the traffic value corresponding to the traffic transmission request corresponding to the first data object in an atomic operation mode.
An atomic operation refers to an operation that is not interrupted by a thread scheduling mechanism, and once started, runs to the end without switching to another thread in the middle. Statistics are performed in an atomic operation mode: when a plurality of threads perform locking operation on the same counter (the traffic values counted by a plurality of traffic transmission requests initiated by the same client are superimposed on the original statistics values of the same data object), if the counter values (superimposed total statistics values) are inaccurate due to the fact that locking is not performed, if the same counter values are subjected to locking operation, the plurality of threads can compete for the same lock, and therefore calculation efficiency is reduced. By using atomic operation, an operation lock is not needed, the calculation operation is completed by a compiler and hardware, the calculation performance is improved, and the realization of logic is simpler.
According to the embodiment of the invention, in specific implementation, the same client may initiate a plurality of traffic transmission requests at the same time, that is, a plurality of statistics units acquire data object addresses corresponding to the same user identifier from the data object set, and write corresponding traffic values into corresponding addresses in respective statistical traffic transmission processes. Through atomic operation, multiple times of writing aiming at the same data object are realized, and errors caused by writing of a plurality of statistical values (summarizing, and overlapping new writing to the flow value of the original statistics) are avoided.
The adjustment module 304 is configured to adjust a flow quota corresponding to each data object according to the flow quota policy and a flow value of each data object in the data object set.
The proxy server formulates a flow quota strategy according to network bandwidth, data of a network terminal (client) initiating access and the like, adjusts the flow quota (residual flow quota) corresponding to each data object by combining flow values (total flow values updated in real time and including flow values generated in each flow transmission process) corresponding to each data object in the data object set, and executes corresponding operations (such as warning, current limiting and the like) according to the flow quota of each data object.
According to the technical scheme of the embodiment of the invention, because one or more flow transmission requests are received, for each flow transmission request, the user identification is determined according to the request information in the flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server; searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set; the technical means of adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set overcomes the technical problems of low adjustment efficiency and low accuracy of the adjusted flow quota existing in the existing method due to the dependence on the performance of an external database, and further achieves the technical effects of improving the flow statistics efficiency, improving the efficiency of adjusting the flow quota and guaranteeing the accuracy of the adjusted flow quota.
Fig. 4 illustrates an exemplary system architecture 400 to which the flow quota adjustment method or the flow quota adjustment device of the embodiments of the invention may be applied.
As shown in fig. 4, a system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405 (this architecture is merely an example, and the components contained in a particular architecture may be tailored to the application specific case). The network 404 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various communication client applications, such as a data processing class application, a web browser application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only) may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, such as a server (for example only) that utilizes (performs data processing on) the terminal devices 401, 402, 403 to the user. The server may analyze and process the received data such as the traffic transmission request, and feed back the processing result (e.g. the statistical operation result, the target data object—only an example) to the terminal device.
It should be noted that, the method for adjusting the flow quota provided in the embodiment of the present invention is generally executed by the server 405, and accordingly, the device for adjusting the flow quota is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing a terminal device or server in accordance with an embodiment of the present invention. The terminal device or server shown in fig. 5 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a receiving module, a first data object determination module, a statistics module, and an adjustment module. The names of these modules do not in some cases limit the module itself, for example, the receiving module may also be described as "for receiving one or more traffic transmission requests, and for each traffic transmission request, determining the user identifier according to the request information in the traffic transmission request; the traffic transmission request comprises an access request sent by the client side in the current traffic transmission request and a response request returned by the target server.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: receiving one or more flow transmission requests, and determining a user identifier according to request information in the flow transmission requests for each flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server; searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set; and adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set.
According to the technical scheme of the embodiment of the invention, because one or more flow transmission requests are received, for each flow transmission request, the user identification is determined according to the request information in the flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server; searching from the data object set according to the user identification to determine a first data object, and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set; the technical means of adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set overcomes the technical problems of low adjustment efficiency and low accuracy of the adjusted flow quota existing in the existing method due to the dependence on the performance of an external database, and further achieves the technical effects of improving the flow statistics efficiency, improving the efficiency of adjusting the flow quota and guaranteeing the accuracy of the adjusted flow quota.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (7)

1. The method for adjusting the flow quota is characterized by comprising the following steps:
Receiving one or more flow transmission requests, and determining a user identifier according to request information in each flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server;
Searching from a data object set according to the user identification to determine a first data object, and acquiring a corresponding address of the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier;
Carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistical operation result into the address corresponding to the first data object in the data object set;
Adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set;
if, in the process of searching the data object set, it is determined that the first data object corresponding to the user identifier does not exist, the method further includes:
Creating a second data object according to the user identification; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the second data object, and writing the statistical operation result into the second data object;
Judging whether a data object corresponding to the user identifier exists in the data object set or not; if not, carrying out locking processing on the data object set, and judging whether the locking is successful; if the locking processing is successful, judging whether a data object corresponding to the user identifier exists in the data object set which is successful in the locking processing again according to the user identifier;
if the data object exists, taking the data object corresponding to the user identifier in the data object set as a target data object, and writing the flow value counted in the second data object into the target data object;
and if not, inserting the second data object into the data object set.
2. The method for adjusting a flow quota according to claim 1, further comprising, after determining that a data object corresponding to the user identifier exists in the data object set:
And acquiring an address corresponding to the data object corresponding to the user identifier in the data object set, and writing the flow value counted in the second data object into the address.
3. The method for adjusting a traffic quota according to claim 2, wherein the locking the data object set, inserting the second data object into the data object set that is successfully locked, further comprises:
and if the locking processing fails, placing the second data object in a candidate queue, so that the candidate queue carries out locking processing on the data object set again until the locking processing is successful.
4. The method for adjusting a flow quota according to claim 1, wherein the performing a statistical operation on the flow value corresponding to the transmission of the flow transmission request corresponding to the first data object includes:
and counting the flow value corresponding to the transmission of the flow transmission request corresponding to the first data object in an atomic operation mode.
5. A flow quota adjustment device, comprising:
the receiving module is used for receiving one or more flow transmission requests, and determining a user identifier according to request information in the flow transmission requests for each flow transmission request; the traffic transmission request comprises an access request sent by a client in the current traffic transmission request and a response request returned by a target server;
The first data object determining module is used for searching from the data object set according to the user identifier to determine a first data object and acquiring the address corresponding to the first data object in the data object set; the data object is used for indicating the corresponding relation between the user identifier and the flow value correspondingly transmitted by the user identifier;
the statistics module is used for carrying out statistics operation on the flow value corresponding to the flow transmission request corresponding to the first data object, and writing the statistics operation result into the address corresponding to the first data object in the data object set;
The adjustment module is used for adjusting the flow quota corresponding to each data object according to the flow quota strategy and the flow value of each data object in the data object set;
The second data object creating module is used for creating a second data object according to the user identification when the first data object corresponding to the user identification does not exist in the searching process of the data object set; carrying out statistical operation on the flow value corresponding to the flow transmission request corresponding to the second data object, and writing the statistical operation result into the second data object; judging whether a data object corresponding to the user identifier exists in the data object set or not; if not, carrying out locking processing on the data object set, and judging whether the locking is successful; if the locking processing is successful, judging whether a data object corresponding to the user identifier exists in the data object set which is successful in the locking processing again according to the user identifier; if the data object exists, taking the data object corresponding to the user identifier in the data object set as a target data object, and writing the flow value counted in the second data object into the target data object; and if not, inserting the second data object into the data object set.
6. An electronic device, comprising:
One or more processors;
Storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-4.
7. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-4.
CN202111005526.5A 2021-08-30 Flow quota adjusting method and device Active CN113726885B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111005526.5A CN113726885B (en) 2021-08-30 Flow quota adjusting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111005526.5A CN113726885B (en) 2021-08-30 Flow quota adjusting method and device

Publications (2)

Publication Number Publication Date
CN113726885A CN113726885A (en) 2021-11-30
CN113726885B true CN113726885B (en) 2024-06-28

Family

ID=

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108259207A (en) * 2016-12-29 2018-07-06 北京国双科技有限公司 Flow statistical method, client, server and system
CN110708258A (en) * 2019-09-29 2020-01-17 Oppo广东移动通信有限公司 Flow control method, flow control device, server and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108259207A (en) * 2016-12-29 2018-07-06 北京国双科技有限公司 Flow statistical method, client, server and system
CN110708258A (en) * 2019-09-29 2020-01-17 Oppo广东移动通信有限公司 Flow control method, flow control device, server and storage medium

Similar Documents

Publication Publication Date Title
US9654433B2 (en) Selective message republishing to subscriber subsets in a publish-subscribe model
US8959229B1 (en) Intelligently provisioning cloud information services
CN110909022A (en) Data query method and device
CN111858586B (en) Data processing method and device
CN107291835B (en) Search term recommendation method and device
CN112948138A (en) Method and device for processing message
CN113726885B (en) Flow quota adjusting method and device
CN113360815A (en) Request retry method and device
US11662927B2 (en) Redirecting access requests between access engines of respective disk management devices
CN113722113A (en) Traffic statistic method and device
CN112131257B (en) Data query method and device
CN111950232B (en) Method and device for automatically switching number segments
CN113760876A (en) Data filtering method and device
CN113726885A (en) Method and device for adjusting flow quota
CN112784139A (en) Query method, query device, electronic equipment and computer readable medium
CN109213815B (en) Method, device, server terminal and readable medium for controlling execution times
CN110019671B (en) Method and system for processing real-time message
CN111291127A (en) Data synchronization method, device, server and storage medium
CN113722193A (en) Method and device for detecting page abnormity
CN110262756B (en) Method and device for caching data
CN116600031B (en) Message processing method, device, equipment and storage medium
CN113407493B (en) Operation method, data reading and writing method, device, electronic equipment and medium
CN110784479B (en) Data verification method and device, electronic equipment and storage medium
CN116431523B (en) Test data management method, device, equipment and storage medium
CN109240878B (en) Data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
CB03 Change of inventor or designer information

Inventor after: Liu Zhongdi

Inventor after: Liu Lin

Inventor after: Chai Sherong

Inventor after: Xu Chao

Inventor before: Liu Zhongdi

Inventor before: Chai Sherong

Inventor before: Xu Chao

GR01 Patent grant