Skip to content

Commit

Permalink
update readme and model
Browse files Browse the repository at this point in the history
  • Loading branch information
linyacool committed Feb 13, 2018
1 parent 197c3df commit 92f1728
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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模型
Expand All @@ -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)

Expand Down
Binary file added datum/model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion 并发模型.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## 并发模型
本程序使用的并发模型如下图所示:

![并发模型]()
![并发模型](https://github.com/linyacool/WebServer/blob/master/datum/model.png)

MainReactor只有一个,负责响应client的连接请求,并建立连接,它使用一个NIO Selector。在建立连接后用Round Robin的方式分配给某个SubReactor,因为涉及到跨线程任务分配,需要加锁,这里的锁由某个特定线程中的loop创建,只会被该线程和主线程竞争。

Expand Down

0 comments on commit 92f1728

Please sign in to comment.