{"id":15047426,"url":"https://github.com/imarvinle/webserver","last_synced_at":"2025-04-04T19:09:33.349Z","repository":{"id":41385335,"uuid":"168637499","full_name":"imarvinle/WebServer","owner":"imarvinle","description":"A C++ Lightweight Web Server based on Linux epoll","archived":false,"fork":false,"pushed_at":"2023-05-14T10:39:22.000Z","size":371,"stargazers_count":617,"open_issues_count":1,"forks_count":113,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T19:09:29.002Z","etag":null,"topics":["cpp11","epoll","network-programming","webserver"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imarvinle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-01T03:36:04.000Z","updated_at":"2025-04-03T10:30:42.000Z","dependencies_parsed_at":"2024-10-30T08:22:54.540Z","dependency_job_id":null,"html_url":"https://github.com/imarvinle/WebServer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarvinle%2FWebServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarvinle%2FWebServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarvinle%2FWebServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imarvinle%2FWebServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imarvinle","download_url":"https://codeload.github.com/imarvinle/WebServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp11","epoll","network-programming","webserver"],"created_at":"2024-09-24T20:58:07.712Z","updated_at":"2025-04-04T19:09:33.329Z","avatar_url":"https://github.com/imarvinle.png","language":"HTML","readme":"# A C++ Lightweight Web Server\n\n\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://travis-ci.org/MarvinLe/WebServer.svg?branch=master)](https://travis-ci.org/MarvinLe/WebServer)\n\n\n## 简介\n\n这是一个轻量级的Web服务器，目前支持GET、HEAD方法处理静态资源。并发模型选择: 单进程＋Reactor+非阻塞方式运行。\n\n测试页面: [http://how2cs.cn:8080/](http://how2cs.cn:8080/)\n\n\n---\n\n| Part Ⅰ | Part Ⅱ |\n| :---------: | :---------: |\n|  [整体设计](https://github.com/MarvinLe/WebServer/blob/master/%E6%95%B4%E4%BD%93%E8%AE%BE%E8%AE%A1.md)| [性能测试分析](https://github.com/MarvinLe/WebServer/blob/master/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95%E5%88%86%E6%9E%90.md) |\n\n---\n\n## 开发部署环境\n\n+ 操作系统: Ubuntu 16.04\n\n+ 编译器: g++ 5.4\n\n+ 版本控制: git\n\n+ 自动化构建: cmake\n\n+ 集成开发工具: CLion\n\n+ 编辑器: Vim\n\n+ 压测工具：[WebBench](https://github.com/EZLippi/WebBench)\n\n\n\n## Usage\n\n```\ncmake . \u0026\u0026 make \n\n./webserver [-f config_file] \n```\n配置文件可以使用默认的 config.ini\n\n## 核心功能及技术\n\n+ 状态机解析HTTP请求，目前支持 HTTP GET、HEAD方法\n\n+ 添加定时器支持HTTP长连接，定时回调handler处理超时连接\n\n+ 使用 priority queue 实现的最小堆结构管理定时器，使用标记删除，以支持惰性删除，提高性能\n\n+ 使用epoll + 非阻塞IO + 边缘触发(ET) 实现高并发处理请求，使用Reactor编程模型\n\n+ epoll使用EPOLLONESHOT保证一个socket连接在任意时刻都只被一个线程处理\n\n+ 使用线程池提高并发度，并降低频繁创建线程的开销\n+ 同步互斥的介绍\n\n+ 使用RAII手法封装互斥器(pthrea_mutex_t)、 条件变量(pthread_cond_t)等线程同步互斥机制，使用RAII管理文件描述符等资源\n\n+ 使用shared_ptr、weak_ptr管理指针，防止内存泄漏\n\n  \n\n## 开发计划\n+ 添加异步日志系统，记录服务器运行状态\n+ 增加json配置文件，支持类似nginx的多网站配置\n+ 提供CGI支持\n+ 类似nginx的反向代理和负载均衡\n+ 必要时增加可复用内存池\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimarvinle%2Fwebserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimarvinle%2Fwebserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimarvinle%2Fwebserver/lists"}