nginx-interpreting built-in non-default modules Ngx_http_stub_status_module

Source: Internet
Author: User

1.Background

The Ngx_http_stub_status_module is an nginx built-in HTTP module that provides status information for Nginx. This module is not compiled by default, so it is necessary to specify the module to be loaded when compiling Nginx:

--with-http_stub_status_module

Of course, if you are recompiling, just-s reload is not enough and may require a smooth upgrade: Research on the configuration and deployment of high performance Web server Nginx (14) Smooth upgrade your nginx.

Why do you take it as an example? Because it is also a short enough module, is a typical handler module. Then we will explain the module process, are:

1). A Brief introduction
2). The instance used
3). Instruction Introduction
4). Source Code Analysis

2.Simple Example

Location/Nginx_status {    #copied from http://blog.kovyrin.net/2006/04/29/ monitoring-nginx-with-rrdtool/    stub_status on;    Access_log off;    Allow SOME. Ip. ADD. RESS;    Deny all;}

We assume that you are experimenting on this machine and that you are opening port 80, then enter in the browser: Http://localhost/nginx_status will see this message:

291 server accepts handled requests 16630948 16630948 31070465  6179106

Its meaning is easy to understand:

First line
    current number of active connections : 291 #个人认为是处于 SYN_RCVD, established status, equals Reading + Writing + waiting
Second line
    the number of connections accepted by the server : 16630948 (accepted connection #), the number of connections received from the client, and the number of connections received by the worker process.
    the number of connections that the server has processed : 16630948 (handled connection #), the total number of connections that have been processed, whose values are generally equal to accepts, unless some resources are limited, such as: Set Worker_ The number of connections is limited.
     requests processed by the server : 31070465 (can be calculated, average 1.8 requests per connection) (Handled connection #)
Third line
Reading–nginx The number of connections that are reading the request header is 6;
The Writting–nginx is reading the request body, processing the request, and sending a response to the client with a number of 179 connections;
waiting– The number of long connections currently active : 106. #只是keep-alive, there is no active connection.


Nginx official explanation is as follows:

Active connections–number of all open connections
Server accepts handled Requests–nginx accepted 16630948 connections, handled 16630948 connections (no one was closed jus T it was accepted), and handles 31070465 requests (1.8 requests per connection)
Reading–nginx Reads request header
Writing–nginx reads request body, processes request, or writes response to a client
Waiting–keep-alive connections, actually it is active-(reading + writing)

3 directives

The only instruction in this module is:

Stub_status

Syntax: Stub_status on
Scope: Location
Function: Statistics The location of the information.

Transferred from: http://blog.csdn.net/poechant/article/details/7627843

nginx-interpreting built-in non-default modules Ngx_http_stub_status_module

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.