Apache concurrency control, view number of processes, TCP connections, compression feature description

Source: Internet
Author: User

One: Apache related concurrency control

Mainly prefork and worker two one to control. We can use HTTPD-L to determine whether the MPM currently in use is PREFORK.C or WORKER.C.

# httpd-l
Compiled in Modules:
Core.c
Prefork.c
Http_core.c
Mod_so.c

The associated configuration can be found in the httpd.conf

Two: View the number of httpd processes (that is, the number of concurrent requests that Apache can handle in prefork mode):

Ps-ef | grep httpd | Wc–l

The result is the number of concurrent requests currently being processed by Apache, which is automatically tuned according to the load.

Three: View the number of concurrent requests for Apache and its TCP connection status

Netstat-n | awk '/^tcp/{++s[$NF]} end {for (a in S) print A,s[a]} '

Return sample results:

Last_ack 5
SYN_RECV 30
Established 1597
Fin_wait1 51
Fin_wait2 504
Time_wait 1057

The SYN_RECV represents the number of requests waiting to be processed, established represents the normal data transfer status, and Time_wait represents the number of requests that have been processed and waiting for the timeout to end.

Status: Description

CLOSED: No connection is active or in progress

LISTEN: The server is waiting to enter the call

SYN_RECV: A connection request has arrived, waiting for confirmation

Syn_sent: Application has started, open a connection

Established: Normal data transfer status

FIN_WAIT1: Application says it's done

Fin_wait2: The other side has agreed to release

Itmed_wait: Waiting for all groups to die

CLOSING: Both sides try to close at the same time

Time_wait: The other side has initialized a release

Last_ack: Waiting for all groups to die

You can use Webbench under Linux for stress testing.

Extendedstatus on because the extra time sign is written, set off.

Four: Check to see if Apache supports the compression function:

Modules that must be loaded in the http.conf:

LoadModule Headers_module
#modules/mod_headers.so
LoadModule Deflate_module
#modules/mod_deflate.so

Add the following code:

(

Addoutputfilterbytype DEFLATE text/html text/plain text/css application/x-httpd-php application/x-javascript text/css

Deflatecompressionlevel 6

Setoutputfilter DEFLATE

#DeflateFilterNote Input instream

#DeflateFilterNote Output OutStream

#DeflateFilterNote Ratio Ratio

#LogFormat ' "%r"%{outstream}n/%{instream}n (%{ratio}n%%) ' deflate

#CustomLog Logs/deflate_log.log Deflate

)

Perfect part:


Addoutputfilterbytype DEFLATE text/html text/plain text/css application/x-httpd-php application/x-javascript text/css

Addoutputfilter DEFLATE CSS #压缩css文件

Addoutputfilter DEFLATE JS #压缩js文件

# Don ' t compress images #对照片文件不进行压缩处理

Setenvifnocase Request_uri (?: gif|jpe?g|png) $ no-gzip dont-vary

Setenvifnocase Request_uri (?: Exe|t?gz|zip|bz2|sit|rar) $ no-gzip dont-vary

Setenvifnocase Request_uri. pdf$ no-gzip dont-vary

#SetEnvIfNoCase Request_uri. (CSS|JS) $ no-gzip dont-vary

# Make sure proxies don ' t deliver the wrong content

Header Append Vary user-agent env=!dont-vary

Deflatecompressionlevel 6

Setoutputfilter DEFLATE

#DeflateFilterNote Input instream

#DeflateFilterNote Output OutStream

#DeflateFilterNote Ratio Ratio

#LogFormat ' "%r"%{outstream}n/%{instream}n (%{ratio}n%%) ' deflate

#CustomLog Logs/deflate_log.log Deflate

php.ini compression mechanism configuration location: is closed by default.

#vi/etc/php.ini
=================================================
Output_buffering = Off
Output_handler =
Zlib.output_compression = Off

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.