Apache架构与PHP及JavaScript的类结构(2011405)
2011-04-05 22:08
176 查看
着手Apache架构分析的目的是了解WEB应用的实现,不过面对上万行(确切的说,以httpd-2.0.64 UNIX为例,代码为约50万行*)的程序源代码,一个人全部看完的概率几乎为0。好在现在有网络,共享着大家的分析结果。
Apache的发展让我想到了Linux,最早的L只有1万行代码,现今代码行数提升成百上千倍*,超出大多数人类可全部掌握的程度。
以下先引用资料先说明Apache架构的主要内容:
1、Apache官网核心应用架构
coreCore Apache HTTP Server features that are always available这里面的核心部分似乎是文件系统管理与SOCKET应用,主要管理htdos下的文件、连接网络以及管理C/S。此部分类似操作系统的功能,不过对设备的操作通过OS API来完成。这里面的主要头文件包括不限于os.h*等,主要实现各种系统API的封装(包括SOCKET)。核心的实现程序为core.c,4620行,对应头文件有:#include "apr.h"#include "apr_strings.h"#include "apr_lib.h"#include "apr_fnmatch.h"#include "apr_hash.h"#include "apr_thread_proc.h" /* for RLIMIT stuff */#include "apr_hooks.h"#include "apr_want.h"
#define CORE_PRIVATE#include "ap_config.h"#include "httpd.h"#include "http_config.h"#include "http_core.h"#include "http_protocol.h" /* For index_of_response(). Grump. */#include "http_request.h"#include "http_vhost.h"#include "http_main.h" /* For the default_handler below... */#include "http_log.h"*#include "rfc1413.h"#include "util_md5.h"#include "http_connection.h" //连接模块#include "apr_buckets.h"#include "util_filter.h"#include "util_ebcdic.h"#include "mpm.h"#include "mpm_common.h"#include "scoreboard.h"#include "mod_core.h"#include "mod_proxy.h"#include "ap_listen.h"实现的功能主要有连接、登录、请求、监听、代理服务器、文件管理、协议、加密等基础应用。这些应用发展了BeKLLY*的SOCKET,也构成了Apache的核心,这个核心部分不光有HTTP,还可完成其他协议的衍生。
mpm_commonA collection of directives that are implemented by more than one multi-processing module (MPM)多线程应用*作为服务器一个重要功能单列*实现程序为mpm_common.c,约1130行,主要的头文件有:#include "mpm.h"#include "mpm_common.h"#include "ap_mpm.h"#include "ap_listen.h"#include "mpm_default.h"这可以理解为一个针对不同操作系统线程使用的补充说明。*
perchildMulti-Processing Module allowing for daemon processes serving requests to be assigned a variety of different useridspreforkImplements a non-threaded, pre-forking web server这是一个类似重写简单Apache的程序,如果要避免多线程的“乱花迷眼”,最好的办法就是先看这个与上面的Core。threadpoolYet another experimental variant of the standard
未完待续。2011405
Apache的发展让我想到了Linux,最早的L只有1万行代码,现今代码行数提升成百上千倍*,超出大多数人类可全部掌握的程度。
以下先引用资料先说明Apache架构的主要内容:
1、Apache官网核心应用架构
coreCore Apache HTTP Server features that are always available这里面的核心部分似乎是文件系统管理与SOCKET应用,主要管理htdos下的文件、连接网络以及管理C/S。此部分类似操作系统的功能,不过对设备的操作通过OS API来完成。这里面的主要头文件包括不限于os.h*等,主要实现各种系统API的封装(包括SOCKET)。核心的实现程序为core.c,4620行,对应头文件有:#include "apr.h"#include "apr_strings.h"#include "apr_lib.h"#include "apr_fnmatch.h"#include "apr_hash.h"#include "apr_thread_proc.h" /* for RLIMIT stuff */#include "apr_hooks.h"#include "apr_want.h"
#define CORE_PRIVATE#include "ap_config.h"#include "httpd.h"#include "http_config.h"#include "http_core.h"#include "http_protocol.h" /* For index_of_response(). Grump. */#include "http_request.h"#include "http_vhost.h"#include "http_main.h" /* For the default_handler below... */#include "http_log.h"*#include "rfc1413.h"#include "util_md5.h"#include "http_connection.h" //连接模块#include "apr_buckets.h"#include "util_filter.h"#include "util_ebcdic.h"#include "mpm.h"#include "mpm_common.h"#include "scoreboard.h"#include "mod_core.h"#include "mod_proxy.h"#include "ap_listen.h"实现的功能主要有连接、登录、请求、监听、代理服务器、文件管理、协议、加密等基础应用。这些应用发展了BeKLLY*的SOCKET,也构成了Apache的核心,这个核心部分不光有HTTP,还可完成其他协议的衍生。
mpm_commonA collection of directives that are implemented by more than one multi-processing module (MPM)多线程应用*作为服务器一个重要功能单列*实现程序为mpm_common.c,约1130行,主要的头文件有:#include "mpm.h"#include "mpm_common.h"#include "ap_mpm.h"#include "ap_listen.h"#include "mpm_default.h"这可以理解为一个针对不同操作系统线程使用的补充说明。*
perchildMulti-Processing Module allowing for daemon processes serving requests to be assigned a variety of different useridspreforkImplements a non-threaded, pre-forking web server这是一个类似重写简单Apache的程序,如果要避免多线程的“乱花迷眼”,最好的办法就是先看这个与上面的Core。threadpoolYet another experimental variant of the standard
workerMPMmpm_winntThis Multi-Processing Module is optimized for Windows NT.workerMulti-Processing Module implementing a hybrid multi-threaded multi-process web server
未完待续。2011405
相关文章推荐
- Apache架构与PHP及JavaScript的类结构(2011403)
- 做项目中遇到所有的常用知识点(javascript、php、mysql、apache、nginx)更新
- Apache运维架构之Apache+PHP
- Apache运维架构之Apache+PHP 推荐
- php学习笔记1 apache服务器使用及配置① 启动和停止 端口配置 apache的目录结构
- ubuntu12.10 配置LAMP架构(linux+apache+mysql+php)
- linux——lamp简介,架构搭建,Linux+Apache+Mysql/MariaDB+Php
- 门户网站架构Nginx+Apache+MySQL+PHP+Memcached+Squid
- PHP MVC结构系统架构设计
- 门户网站架构Nginx+Apache+MySQL+PHP+Memcached+Squid
- [转]PHP与Javascript之间复杂结构数据的传递
- 网站安全优化 - 隐藏网站目录结构&隐藏Apache版本信息&隐藏PHP版本信息
- Apache+MariaDB+PHP架构的编译安装
- debian Squeeze配置apache php mysql环境,debian中apache目录结构
- 高可用web架构: LVS+keepalived+nginx+apache+php+eaccelerator(+nfs可选 可不选)
- LAMP架构——Apache虚拟主机开启PHP短标签
- 架构mysql+apache+php,svn,bugfree等
- LAMP(apache/httpd+mysql+php)环境/架构 一键安装脚本
- LAMP架构(四)之Apache支持php和默认虚拟机
- LNAMP(Linux+Nginx+Apache+Mysql+PHP)高性能架构配置实战版