Coder Social home page Coder Social logo

httpd3's Introduction

这是一个HTTP服务器

Version-1.5.0

  • C语言开发
  • epoll + 类线程池技术
  • Linux 环境, 非跨平台
  • 使用CMake。 可以直接修改版本号搭配自己平台的使用

测试使用

  • /etc/wushxin/wsx.conf中写好配置后,进入源文件路径
  • $ cmake .
  • $ make
  • $ ./httpd3
  • 配置参见下方说明

模块

  • 最外部为入口程序,以及读取配置的函数。
  • handle 模块则是对于 读/写/错误 事件的一个控制
  • memop模块是用来扩展内存分配的,例如jcmalloc,目前只是使用自带的库函数,并加一层包装。
  • config 暂时存放配置文件
  • timer 模块(待开发,未添加),用于无效socket的关闭回收
  • util 模块为待开发模块,当前拥有 string_t 类型

配置文件

  • 可以在 config 文件夹下的 wsx.conf 参考详细配置格式,当前支持的配置选项只有四个

    • 详见配置文件
    • # 开头的为注释,单行有效
  • 配置文件放在 "./wsx.conf", "/etc/wushxin/wsx.conf"这两个地方,配置文件名字不能改变。

编译参数

  • gcc -std=gnu99 -pthread -O3
  • -DWSX_BASE_DEBUG 是两个基础输出,在handle.c
  • -DWSX_DEBUG 是剩下的所有输出

测试

  • 单核双线程,8G内存的虚拟机配置中(笔记本)
    • 在开启缓存时,对文件的请求,是10000~15000 Request/Sec(测试脚本干扰下)
    • 不开启缓存时,对文件的请求,是7000+Request/Sec(测试脚本干扰下)

缓存的意思是,将文件映射到内存中,且只映射一次,不重复打开映射,关闭映射

不开启缓存的意思是,每次请求资源都 open, mmap, close, unmmap

进度

  • 使用新数据结构 string_t 无法正确处理二进制文件的问题。
  • 修改某处导致请求非正常终端后,新连接错误的Bug

TODO

  • timer模块
  • util模块
    • 实现一个底层 SkipList 去存储和维护客户连接,减少内存占用
    • 实现一个 HashMap 去存储热点文件名,并将热点文件持续地在内存中打开,即缓存
  • 能处理更多的属性
  • 添加缓存支持
  • http 请求头 : POST

httpd3's People

Contributors

wrestle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

httpd3's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.