11 I Welcome- The Apache HT x )→c Ohttpdapache.org □ HACTOM棒槿堂年花金石回MSDN回csDN⊙做回翻虾米胃颗亮曾言e站回c开源中围□掌示□常用网址 移动版书签 APACHE TTP SERVER PROJECT APACHECON 日 agirMrtorspachecon ne wtn the current Http standards Essentials Downed The Apache Http Server cntpd)was launehed in 1995 and it nas been the most popuar web serwer on the intemet since April 1906. It nas celebrated as 20ih birthday as a project n February 2015 The Apache Http Server is a proect of iHe aPache sofware Erndaron 803-17 hs latest release from the 2 4 x stable branch represents availabe version of Apache Generl Informaton DoMnladi change oo for 243[ comple chaneLo1or24IN Apachehttpd22End-of-life n24 As previousy announced. the Apache HiP Server Project has discontinued all dewelopment and patch rewew of the 2.2x senes of releases he Apache Http Server Project had bong commited to provice mantenance releases of the 2 2 x nawor through June of 2017, and to contnue to publish some secunty source code patches untl December of 2017 The tinal release 2.234 was published in Juy 2017. and no further evalation at securty risks wit be published for 22x releases hope that by making n easier to use aur muros, we wil be able tD promde a beter downed esperence Subprojects Want anglishamllua Hed w Help Wanted-a task crredory ser Acdde preis 南中医药大学/阮晓龙/13938213680/http://inux.xg.hactcm.edu.cn/http://www.51xueweb.cn
河南中医药大学 / 阮晓龙 / 13938213680 / http://linux.xg.hactcm.edu.cn / http://www.51xueweb.cn 2.Apache服务器 11 2.1Apache简介
2 )→c Ohttpdapacheorg/does/2a/newfeatures2 □ HACTOM福堂花回MsDN园csDN⑥回翻虾米胃颗亮曾言站回c开源中围□献掌示□用网址 移动版书签 APACHE a■ HttpSerVeR ProJecT Apache Http Server Version 2.4 Overview of new features in Apache Http Server 2.4 Ths documen cestnbes some of the major changes between the 22 and 2 4 versons of ne apAche Http Server For new features snce verson 20. see tne 22new leatures document O nts Module Enhancements Run-time Loadable MPMs MPMs can now be bu at comple time The MPM of choKe can be configured at run time wa waedModule directive Event PM Event MeM is no longer expenmental but b now tuly supported Module eloper Chinois See also Bener support for asynchronous read/write for supporting MPMs and patrons be configured per module and per rectory New levels tracel to tracel added above the debug log level <If>, cElaeIE> and cLaes sections can be used to set me configuraton based on pef-request antena A new expression parser alows to specify complex conditons using a common syntax in directives ke setEnvIEXxTr, Revrttecend: Mender. <IE> and( ND longer needed and is now deprecated -aat drecire alows more nne grained control whch ir lower,hac能aes ane varables in the configuraton, allowing a claer representation if the same valuc s used at many places n the contour ate many new features, 2. 4 x lenas to use ess memory than 2.2x Bod proxy fogi ocol backend for rod proxy mod proxy express 南中医药大学/阮晓龙/13938213680/http://inux.xg.hactcm.edu.cn/http://www.51xueweb.cn
河南中医药大学 / 阮晓龙 / 13938213680 / http://linux.xg.hactcm.edu.cn / http://www.51xueweb.cn 2.Apache服务器 12 2.1Apache简介
3 2 Apache服务器 22 Apache工作原理 ¤ Apache处理模式: perfor 个单独的控制进程(父进程)负责产生子进程,子进程用于监听请求并 作出应答。 Apache试图保持一些备用的(spae)或是空闲子进程用于迎 接即将到来的请求,客户端不需要在得到服务前等候子进程的产生。 perfor下有 StartServers、 MinSpareServers、 MaxSpareServers、 MaxRequestWorkersl四个指令用于调节父进程如何产生子进程。 口通常情况下 Apache具有很强的自我调节能力,当需要处理的并发请求较高时, 服务器可能就需要增加Ma× RequestWorkers的值。 StartServers:初始的工作进程数。 Minspareservers:空闲子进程的最小数量。 MaxSpareServers:空闲子进程的最大数量 MaxRequestWorkers:最大空闲线程数。 南中医药大学/阮晓龙/13938213680/http://inux.xg.hactcm.edu.cn/http://www.51xueweb.cn
河南中医药大学 / 阮晓龙 / 13938213680 / http://linux.xg.hactcm.edu.cn / http://www.51xueweb.cn 2.Apache服务器 Apache处理模式:perfork ◼ 一个单独的控制进程(父进程)负责产生子进程,子进程用于监听请求并 作出应答。Apache试图保持一些备用的(spare)或是空闲子进程用于迎 接即将到来的请求,客户端不需要在得到服务前等候子进程的产生。 ◼ perfork下有StartServers、MinSpareServers、MaxSpareServers、 MaxRequestWorkers四个指令用于调节父进程如何产生子进程。 通常情况下Apache具有很强的自我调节能力,当需要处理的并发请求较高时, 服务器可能就需要增加MaxRequestWorkers的值。 ▪ StartServers:初始的工作进程数。 ▪ MinSpareServers:空闲子进程的最小数量。 ▪ MaxSpareServers:空闲子进程的最大数量。 ▪ MaxRequestWorkers:最大空闲线程数。 13 2.2Apache工作原理
2 Apache服务器 22 Apache工作原理 ¤ Apache处理模式: worker worker模式相对于 perfor来说,使用了多进程和多线程混合的模式。 ¤ Worker模式预先分了几个子进程(数量比较少),然后每个子进程创建一些线 程,同时包括一个监听线程。每个请求过来,会被分配到一个线程来服务。因 为线程通常会共享父进程的内存空间,所以内存的占用会减少一些,线程处理 比起进程会更轻量。 a worker模式在高并发情况下,比 prefork有更多可用进程,表现会更优秀一些 a worke不完全使用多线程,引入多进程的原因是需要考虑稳定性,如果一个线 程出错,会导致父进程连同其它正常的子线程都岀错,使用多个进程再加多个 线程,如果某个线程出现异常,受影响的只是 Apache的一部分服务,而不是整 个服务。 南中医药大学/阮晓龙/13938213680/http://inux.xg.hactcm.edu.cn/http://www.51xueweb.cn
河南中医药大学 / 阮晓龙 / 13938213680 / http://linux.xg.hactcm.edu.cn / http://www.51xueweb.cn 2.Apache服务器 Apache处理模式:worker ◼ worker模式相对于perfork来说,使用了多进程和多线程混合的模式。 Worker模式预先分了几个子进程(数量比较少),然后每个子进程创建一些线 程,同时包括一个监听线程。每个请求过来,会被分配到一个线程来服务。因 为线程通常会共享父进程的内存空间,所以内存的占用会减少一些,线程处理 比起进程会更轻量。 worker模式在高并发情况下,比prefork有更多可用进程,表现会更优秀一些。 worker不完全使用多线程,引入多进程的原因是需要考虑稳定性,如果一个线 程出错,会导致父进程连同其它正常的子线程都出错,使用多个进程再加多个 线程,如果某个线程出现异常,受影响的只是Apache的一部分服务,而不是整 个服务。 14 2.2Apache工作原理
5 2 Apache服务器 22 Apache工作原理 ¤ Apache处理模式: event event和 worker模式很像,最大的区别在于它解决了keep-alve场景下,线 程长期被占用而造成的资源浪费问题,如某个线程因为被ke-aive空挂 着等待,长时间没有请求,甚至等到超期。 ■ event模式中,会有一个专门的线程来管理这些keep- alive类型的线程,当 有真实请求时,将请求传递给服务线程,执行完毕后,又允许它释放,这 样增强了高并发场景下的请求处理能力 南中医药大学/阮晓龙/13938213680/http://inux.xg.hactcm.edu.cn/http://www.51xueweb.cn
河南中医药大学 / 阮晓龙 / 13938213680 / http://linux.xg.hactcm.edu.cn / http://www.51xueweb.cn 2.Apache服务器 Apache处理模式:event ◼ event和worker模式很像,最大的区别在于它解决了keep-alive场景下,线 程长期被占用而造成的资源浪费问题,如某个线程因为被keep-alive空挂 着等待,长时间没有请求,甚至等到超期。 ◼ event模式中,会有一个专门的线程来管理这些keep-alive类型的线程,当 有真实请求时,将请求传递给服务线程,执行完毕后,又允许它释放,这 样增强了高并发场景下的请求处理能力。 15 2.2Apache工作原理