diff --git a/README.md b/README.md index 4fe2a6d..eb505d5 100755 --- a/README.md +++ b/README.md @@ -4,9 +4,12 @@ * 本项目为C++11编写的Web服务器,解析了get、head请求,可处理静态资源,支持HTTP长连接,并实现了异步日志,记录服务器运行状态。 -| Part Ⅰ | Part Ⅱ | Part Ⅲ | Part Ⅳ | Part Ⅴ | Part Ⅵ | -| :--------: | :---------: | :---------: | :---------: | :---------: | :---------: | -| [项目目的](https://github.com/linyacool/WebServer/blob/master/%E9%A1%B9%E7%9B%AE%E7%9B%AE%E7%9A%84.md)|[连接的维护](https://github.com/linyacool/WebServer/blob/master/连接的维护.md)|[版本历史](https://github.com/linyacool/WebServer/blob/master/%E7%89%88%E6%9C%AC%E5%8E%86%E5%8F%B2.md)| [遇到的困难]() | [测试及改进](https://github.com/linyacool/WebServer/blob/master/测试及改进.md) | [背景知识]()| +| Part Ⅰ | Part Ⅱ | Part Ⅲ | Part Ⅳ | Part Ⅴ | +| :--------: | :---------: | :---------: | :---------: | :---------: | + +| [并发模型](https://github.com/linyacool/WebServer/blob/master/并发模型.md) +|[连接的维护](https://github.com/linyacool/WebServer/blob/master/连接的维护.md)|[版本历史](https://github.com/linyacool/WebServer/blob/master/%E7%89%88%E6%9C%AC%E5%8E%86%E5%8F%B2.md)| [测试及改进](https://github.com/linyacool/WebServer/blob/master/测试及改进.md) +| [项目目的](https://github.com/linyacool/WebServer/blob/master/%E9%A1%B9%E7%9B%AE%E7%9B%AE%E7%9A%84.md) ## Envoirment * OS: Ubuntu 14.04 @@ -18,7 +21,7 @@ ## Usage - ./WebServer [-t thread numbers] [-p port] [-l log file path(begin with '/')] + ./WebServer [-t thread_numbers] [-p port] [-l log_file_path(should begin with '/')] ## Technical points * 使用Epoll边沿触发的IO多路复用技术,非阻塞IO,使用Reactor模型 @@ -30,6 +33,11 @@ * 为减少内存泄漏的可能,使用智能指针等RAII机制 * 使用状态机解析了HTTP请求 +## Model + +并发模型为Reactor+非阻塞IO+线程池,新连接Round Robin分配,详细介绍请参考[并发模型](https://github.com/linyacool/WebServer/blob/master/并发模型.md) +![并发模型](https://github.com/linyacool/WebServer/blob/master/datum/model.png) + ## Others 除了项目基本的代码,进服务器进行压测时,对开源测试工具Webbench增加了Keep-Alive选项和测试功能: 改写后的[Webbench](https://github.com/linyacool/WebBench) diff --git a/datum/model.png b/datum/model.png new file mode 100755 index 0000000..da5667d Binary files /dev/null and b/datum/model.png differ diff --git "a/\345\271\266\345\217\221\346\250\241\345\236\213.md" "b/\345\271\266\345\217\221\346\250\241\345\236\213.md" index 10b5584..d64d3db 100755 --- "a/\345\271\266\345\217\221\346\250\241\345\236\213.md" +++ "b/\345\271\266\345\217\221\346\250\241\345\236\213.md" @@ -14,7 +14,7 @@ ## 并发模型 本程序使用的并发模型如下图所示: -![并发模型]() +![并发模型](https://github.com/linyacool/WebServer/blob/master/datum/model.png) MainReactor只有一个,负责响应client的连接请求,并建立连接,它使用一个NIO Selector。在建立连接后用Round Robin的方式分配给某个SubReactor,因为涉及到跨线程任务分配,需要加锁,这里的锁由某个特定线程中的loop创建,只会被该线程和主线程竞争。