search
HomeOperation and MaintenanceApacheIntroduction to the working mode of apache

Introduction to the working mode of apache

Jun 28, 2020 pm 05:40 PM
apacheOperating mode

Introduction to the working mode of apache

Apache’s working mode

(Recommended tutorial: apache from entry to proficiency)

prefork work Principle

A separate control process (parent process) is responsible for generating child processes, which are used to listen to requests and respond.

Apache always tries to keep some spare or idle child processes for upcoming requests. In this way, the client does not need to wait for the child process to be generated before getting the service. In Unix systems, the parent process usually runs as root to bind port 80, while the child process generated by Apache usually runs as a low-privileged user.

User and Group directives are used to configure low-privilege users for child processes. The user running the child process must have read permissions on the content he is serving, but must have as few permissions as possible on other resources outside the service content.

How worker works

The number of threads each process can have is fixed. The server will increase or decrease the number of processes based on load.

A separate control process (parent process) is responsible for the establishment of child processes. Each child process can establish a ThreadsPerChild number of service threads and a listening thread, which listens for access requests and passes them to the service thread for processing and response. Apache always tries to maintain a spare or idle pool of service threads.

In this way, the client does not need to wait for a new thread or new process to be established before it can be processed. In Unix, in order to be able to bind port 80, the parent process is usually started as root. Subsequently, Apache creates child processes and threads as users with lower privileges. The User and Group directives are used to configure the permissions of the Apache child process. Although the child process must have read access to the content it provides, it should be given as few privileges as possible.

In addition, unless suexec is used, the permissions configured by these instructions will be inherited by the CGI script.

Event MPM

This is the latest working mode of Apache. It is very similar to the worker mode. The difference is that it solves the problem of keeping-alive long connections. The problem of wasted thread resources. In the event working mode, there will be some special threads used to manage these keep-alive type threads. When a real request comes, the request will be passed to the server thread. After the execution is completed, and allowed it to be released.

This enhances request processing in high concurrency scenarios. The apache2.4 version in unix systems uses this mode.

The above is the detailed content of Introduction to the working mode of apache. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:掘金. If there is any infringement, please contact admin@php.cn delete
Apache's Adaptability: Surviving the Evolving WebApache's Adaptability: Surviving the Evolving WebApr 27, 2025 am 12:01 AM

Apache maintains adaptability and vitality through modular design, compatibility with new technologies, and performance optimization. 1. Modular design allows custom functions such as mod_rewrite for URL rewriting. 2. Compatible with cloud computing and containerization technologies, such as running in Docker. 3. Introduce new modules such as mod_http2 to support the HTTP/2 protocol. 4. Performance optimization is performed through configuration file adjustment and cache activation.

Apache's Features: Why It Remains a Popular ChoiceApache's Features: Why It Remains a Popular ChoiceApr 26, 2025 am 12:16 AM

The reason ApacheHTTPServer remains popular is its modular architecture, virtual hosting support, and high performance and reliability. 1) The modular architecture allows for extended functions through modules, such as mod_rewrite and mod_ssl. 2) The virtual hosting function supports hosting multiple websites on one server. 3) The multi-process model ensures high performance and stability in different environments.

Using Apache: Building and Hosting WebsitesUsing Apache: Building and Hosting WebsitesApr 25, 2025 am 12:07 AM

Apache is an open source web server software that is widely used in website hosting. Installation steps: 1. Install using the command line on Ubuntu; 2. The configuration file is located in /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf. Through module extensions, Apache supports static and dynamic content hosting, optimizes performance and security.

Apache: Is It Still Used? A Look at Web Server TrendsApache: Is It Still Used? A Look at Web Server TrendsApr 24, 2025 am 12:17 AM

Apache is still widely used, but its market share has dropped from more than 50% in 2010 to less than 30% in 2023. Its advantage lies in its stability and reliability, which is suitable for enterprise-level applications that require these characteristics; its disadvantage is that multi-process models consume a lot of resources under high concurrency, and Nginx performs better in high concurrency processing.

Apache Web Server: Core Functionality ExplainedApache Web Server: Core Functionality ExplainedApr 23, 2025 am 12:12 AM

The core features of ApacheWebServer include modular design, virtual host configuration, security settings and performance optimization. 1) Modular design enables flexible extensions by loading different modules, such as mod_rewrite for URL rewriting. 2) Virtual host configuration allows multiple websites to be run on one server. 3) Security settings provide SSL/TLS encryption and access control. 4) Performance optimization involves enabling KeepAlive, adjusting MPM configuration, and enabling cache.

Apache's Continuing Importance: Reasons for Its LongevityApache's Continuing Importance: Reasons for Its LongevityApr 22, 2025 am 12:08 AM

Reasons for Apache's continued importance include its diversity, flexibility, strong community support, widespread use and high reliability in enterprise-level applications, and continuous innovation in emerging technologies. Specifically, 1) The Apache project covers multiple fields from web servers to big data processing, providing rich solutions; 2) The global community of the Apache Software Foundation (ASF) provides continuous support and development momentum for the project; 3) Apache shows high stability and scalability in enterprise-level applications such as finance and telecommunications; 4) Apache continues to innovate in emerging technologies such as cloud computing and big data, such as breakthroughs from ApacheFlink and ApacheArrow.

Beyond the Hype: Assessing Apache's Current RoleBeyond the Hype: Assessing Apache's Current RoleApr 21, 2025 am 12:14 AM

Apache remains important in today's technology ecosystem. 1) In the fields of web services and big data processing, ApacheHTTPServer, Kafka and Hadoop are still the first choice. 2) In the future, we need to pay attention to cloud nativeization, performance optimization and ecosystem simplification to maintain competitiveness.

Apache's Impact: Web Hosting and Content DeliveryApache's Impact: Web Hosting and Content DeliveryApr 20, 2025 am 12:12 AM

ApacheHTTPServer has a huge impact on WebHosting and content distribution. 1) Apache started in 1995 and quickly became the first choice in the market, providing modular design and flexibility. 2) In web hosting, Apache is widely used for stability and security and supports multiple operating systems. 3) In terms of content distribution, combining CDN use improves website speed and reliability. 4) Apache significantly improves website performance through performance optimization configurations such as content compression and cache headers.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.