Apache for middleware Monitoring

Source: Internet
Author: User

Compensation system Architecture

The Nginx is converted to an external IP after receiving the request, then forwards the request to Tomcat, and there is a way to forward it to Apache, or to an application server in another language.Ngnix: is a Web server that accepts and forwards requests with no dynamic processingthe browser directly requests CDN (Money with CDN, no money with file server);

CDN content distribution network full name is content Delivery Networks

interview: Cdn's time algorithm, what-based algorithm

mysql: Database serverRedis:cluster: More than one machine, put together, when requested if there is a hang, do not affect the normal use, the number is singular, a leader, multiple follower, half of the cluster hung upMessage Queuing: Send something past, line up, the first person to send a second hair, this order is received by the timeKafka,zk (Zookeeper): One said the two must be clustersLog Analysis: Need to use awk,grep,sedDetermine performance metrics: Log View understanding PVpv:page view, page views or clicks, refresh once the page is calculated once, referred to as PV,UV: A unique Visitor that accesses a computer client of your website as a visitor. The same client in 00:00-24:00 is counted only onceIP (standalone IP): refers to the number of independent IPs. The same IP address within the 00:00-24:00 is computed onceKLE, Maven understands 

Interview questions: How to migrate big data, such as your server has a 10 g of log files, how do you migrate

Pre-pass Verification MD5 ensure consistent data passing through

Guaranteed integrity

Based on network transfer efficiency, consider how the Shard server directly uses SCP commands

Verify MD5 and then assemble after transfer is complete

Storage multipart Multithreading

Fast speed, high safety factor

All files are saved in binary form, depending on what form you open

The mechanism of using Shard Transport + multi-threaded transmission
1. Shard, divide the data of large memory into n slices
2.MD5 algorithm verification, after transmission before transmission, respectively, check the file transfer correctness
3. Multi-line path, using one of the single-threaded n points

70162107

 First, Apache1. Apache IntroductionApache HTTP Server is an open source Web server with simple, fast, high stability features and can also act as a proxy server 2. Apache installation

If you need to integrate PHP with LAMPP integration pack

Find/-name httpd finds all paths under the command/root directory-name by name

Find/|grep httpd Fuzzy Lookup

A, install with Yum

Yum Installation

APACHE/ETC/HTTPD configuration file for httpd.conf executable file

/USR/SBIN/HTTPD launch Apache service httpd start|restart|stop (yum installation as a system service)

B, install using the installation package

C,lampp's Own httpd

Bin directory for all executable files

/OPT/LAMPP/ETC LAMPP configuration file

/opt/lampp/etc/extra Extended Configuration file

To view the Apache version:

/opt/lampp/bin/httpd-v View Apache version

/usr/sbin/httpd-v View details such as the version of Apache you have installed

Configuration file:/opt/lampp/etc/httpd.conf
/etc/httpd/conf/httpd.conf

Common Configuration file Modifications:

ServerRoot "/opt/lampp"

Listen monitoring directly provides port Listen 9090

3. Apache main directory and configuration file

Command:

Configuration file:/opt/lampp/etc/httpd.conf
/etc/httpd/conf/httpd.conf

View process

Ps-ef Ps-aux

Ps-ef

When the Root user starts the main process, some child processes are started

So deploy the PHP project and put the project in the/opt/lamp/htdocs directory

PHP projects are hot start projects that do not stop running

1. Pull Code
2. Modify the configuration file

after deploying the BBS there is an initial username password:in fact, the following files are modified

Apache extension File

Focus: Apache Working mode

Apache/opt/lampp/etc/extra under the httpd-mpm.conf of the system.

Web server Apache currently has a total of three stable mpm (multi-processing module, multi-process processing module) mode. They are prefork, worker and event, respectively.

View current working mode

/opt/lampp/bin/httpd-v View Apache version

/usr/sbin/httpd-v View details such as the version of Apache you have installed

In the Server MPM field

1. Prefork mode single-process single-threaded

Prefork MPM is a very stable mode, Apache at the beginning of the start, will be pre-derived fork some sub-process, and then wait for the request to come in, and always keep some spare child processes.

Each child process that is derived at the same time has only one thread, and only one request can be processed within a single point in time. Prefork MPM is more efficient than the worker mpm, but it can be much larger in terms of memory usage.

It is not good at handling high concurrent requests, in which case it will put the request into the queue and wait until there are available processes before the request is processed.

Detailed parameters:

Startservers//Specifies the number of child processes that are established when the server starts, by default 5

Minspareservers//Specifies the minimum number of idle child processes, which defaults to 5. If the number of currently idle child processes is less than the number of configurations, Apache creates a new subprocess at a maximum of one per second

Maxspareservers//Specifies the maximum number of idle child processes, which defaults to 10. If there are currently more than the maximum number of processes set to kill the excess process, if the setting is smaller than minspareservers, Then Apache will be modified to minspareservers +1 by default.

Maxrequestworkers//Limit the number of requests for maximum client access for the server at the same time, default is 150. Any request that exceeds this limit enters the waiting queue,

Once a connection is released, the request in the queue will be serviced. It's called maxclients before Apache2.3.

Maxconnectionsperchild//Each child process is allowed the maximum number of requests during its lifetime, and if the total number of requests has reached this value, the subprocess will end;

If set to 0, the child process will never end. If this value is set to a value other than 0, you can prevent a memory leak caused by running PHP.

Serverlimit//maxrequestworkers (maxclitnes) is a maximum of 256 threads and needs to be added if it needs to be larger.

The maximum value for this parameter is 2000 if you need to compile Apache more. Effective premise: Must be placed in front of other directives

The number of processes related to CPU cannot be fully occupied,

Think: If you avoid queuing, can you change the value of prefork directly?

2. Aache Working mode-work mode single-process, multi-threaded one-to-many

Detailed parameters:

Startservers//number of child processes created at server startup

MaxClients//

Minsparethreads//Minimum number of idle threads, this MPM will monitor the number of idle threads based on the entire server. If the number of idle threads in the server is too small, a new idle thread will be created

Maxsparethreads//maximum number of idle threads. This MPM will monitor the number of idle threads based on the entire server. If the total number of idle threads in the server is too many, the child process kills the extra idle threads. Biggest

There is a limit to the range of idle thread counts. Work requires a sum greater than or equal to Minsparethreads and Threadsperchild

Threadsperchild//The number of resident execution threads established by each child process, the child process will not establish a new thread after the thread is established at startup

Maxrequestsperchild//maximum number of access requests that allow simultaneous servo. Any requests that exceed this limit will enter the waiting queue

How many requests each process can handle and then die when processing is complete

Thinking: The following configuration is available

<IFMODULE&NBSP;WORKER.C>
startservers         4  
Span style= "font-family: imitation; Font-size:16px ">maxclients         300
MINSPARETHREADS&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;25&NBSP;
maxsparethreads     75
threadsperchild     25    fixed to 25 immutable
maxrequestsperchild  0       How many requests each process can handle and then dies when processing is complete
</IFMODULE>

4 processes per process allows 25 threads a total of 100 non-compliant maxsparethreads 75

It kills a process, which means it kills 25 threads at a time. maxsparethreads

Between 25 ~ 75

If the minimum minsparethreads25 is not met, a process is created

Work mode is unsafe a process dies and the child threads are all killed.

3, Apache working mode-event mode (specific reference PPT)

Apache Working mode switch

Switch work mode change the file name to default is Prefork

Example: Change this to httpd name, working mode to work

Focus: Apache Surveillance

First, how to get Apache monitoring parameters

Vi/etc/httpd/conf/httpd.conf

Restart Apache

Browser input: Http://ip/server-status

Apache optimization

interview: How to get to Apache tuning? optimization means to change the prefork to Woker and increase the number of supported threadsThe worker may have collapsedAccording to the actual use of the situation, the evaluation of the pressure situation, users, open to see the working mode is which In short, Apache is the best Web server in the world.

Apache for middleware Monitoring

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.