Syntax: Limit_req_log_level info|notice|warn|error Default value: Warn Working with Fields: HTTP Specifies the level of logging.
Limit_req_zone
Syntax: Limit_req_zone $session _variable zone=name_of_zone:size rate=rate Default value: None Working with Fields: HTTP The instruction describes the session-state storage area. The instruction describes an area of the session state store, and the value of the session is based on the given variable, as in the following example:
In this case, a 10MB is assigned to a zone named "One", which has an average query speed of up to 1 requests per second. The session will track each user, but note that it replaces the variable $remote_addr, we are using $BINARY_REMOTE_ADDR to reduce the session size to 64 bytes, and a 1MB range can contain approximately 16,000 session states. The speed can be set to the number of requests processed per second and the number of requests processed per minute, and the value must be an integer, so if you need to specify a request to process fewer than 1 requests per second, and 2 seconds to process a request, you can use "30r/m". 32,000 sessions can theoretically be processed when the session-state storage area is 1M, with each session size of 32 bytes.
Limit_req
Syntax: Limit_req=zone burst=burst [Nodelay] Default value: None Working with fields: HTTP, server, location This instruction specifies the possible maximum request burst value (burst) for the Zone (zone), and if its value exceeds this number, the request is deferred so that the query is processed at a given speed. The extra requests will be deferred until their number is less than the burst value, in which case the request will get a "Service unavailable" (503) code with the default burst value of 0. The following example:
Limit_req_zone $binary _remote_addr zone=one:10m rate=1r/s; server {location/search/{limit_req zone=one burst=5;}
Allows one user to process no more than 1 requests per second, which can handle up to 5 queries at the same time, and use the Nodelay parameter if additional requests outside the burst value are not available:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.