Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Apache Summary

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Apache Summary

1. Apache installation

Yum install httpd-y (- y stands for fully automatic installation, automatically selects y during installation, no manual selection is required)

Service httpd start (startup)

Chkconfig httpd on (set to boot)

Yum remmove httpd (uninstall apache)

[note] use rpm-Q httpd to check if apache is installed before installation

Manual installation

Tar xvf xxx.tar.gz

/ configure-- prefix=/usr/local/apache2-- enable-cache-- enable-disk-cache-enable-mem-cache-- enable-file-cache-- with-ssl-- enable-ssl-- enable-so-- enable-mime-magic-- enable-mods-shared=most-- with-mpm=worker

Make

Make install

Installation succeeded.

View the working mode of apache: httpd-l (default is prefork mode)

Switch the operating mode of apache (from prefrok to worker)

Step 1: enter the / usr/sbin directory

Cd / usr/sbin

Step 2: rename the current prefork mode startup file

Mv httpd httpd.prefork

Rename the startup file in worker mode

Mv httpd.worker httpd

Step 3: restart apche

2. Main documents and notes of apache:

Apache_httpd.conf

Httpd-default.conf

Httpd-mpm.conf

3. Apache parameter description

4. Two working modes of apache

Prefork mode: non-threaded, pre-derived

Worker working mode: mixed working mode of process and thread

5. Comparison of processes and threads

Processes are faster than threads, and processes are more efficient than threads.

The process does not support large concurrency because it consumes too much memory. But threads can support large concurrency.

A process is safer than a thread, because there are multiple threads under a process. Once one thread breaks down, it means that the whole process is broken.

This thread affects the thread under the process, so the thread is not safe, the process is safe.

6. Apache parameters

1 is running 74 waits (74 / 3 / 25 / 1)

StartServers 3

MinSpareThreads 25

MaxSpareThreads 250

ThreadsPerChild 25

1 149

StartServers 3

MinSpareThreads 75

MaxSpareThreads 250

ThreadsPerChild 25

1 99

StartServers 3

MinSpareThreads 75

MaxSpareThreads 75

ThreadsPerChild 25

When the number of threads of MinSpareThreads and MaxSpareThreads is equal, MaxSpareThreads becomes invalid, and the default value is MinSpareThreads+1

1 49

StartServers 3

MinSpareThreads 25

MaxSpareThreads 50

ThreadsPerChild 25

At first 1 74, but MaxSpareThreads is not satisfied, kill a process so it is 74-25, the result is 1 49

1 49

StartServers 3

MinSpareThreads 25

MaxSpareThreads 49

ThreadsPerChild 25

1 49

StartServers 3

MinSpareThreads 25

MaxSpareThreads 48

ThreadsPerChild 25

Kill until MinSpareThreads is not enough.

7. Apache tuning principles:

1. Try to keep the minimum number of threads to meet the base value.

two。 Try to make the maximum number of threads meet the high peak.

8. Examine the nature of middleware:

Monitor whether the process pool and thread pool of the middleware are busy.

If it is busy, it means that the process pool thread pool is not enough and the process needs to be added.

If the process pool thread pool has a lot of free time, you need to reduce the size of the process pool thread pool

9. Apache tuning

1. Parameter adjustment

two。 Don't start the killing process frequently.

3. Long connection

4. Turn on GZIP compression

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report