摘要 |
<p>Disclosed are a method and apparatus for monitoring network traffic, the method comprising: obtaining configuration data of user configuration, wherein the configuration data includes a rate limit; obtaining a time period corresponding to the interval of the configured rate limit according to a corresponding relationship between a preset rate limit interval and a time period for adding a token, wherein in the corresponding relationship above, the larger the value of the rate limit interval, the shorter the corresponding time period; updating the time period for configuring a token bucket and adding a token to the obtained time period; monitoring the network traffic by using the token bucket. According to the present invention, the algorithm precision of the token bucket is improved, thus rate limiting precision is enhanced.</p> |