Coder Social home page Coder Social logo

inno-inspire / httpserver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from irving-l/httpserver

0.0 0.0 0.0 10.01 MB

License: MIT License

Shell 0.04% JavaScript 0.80% C++ 39.42% C 11.90% CSS 6.22% Makefile 18.25% HTML 14.13% CMake 8.38% Roff 0.88%

httpserver's Introduction

WebServer项目详解

用C++实现的高性能WEB服务器,暂时还没使用webbench进行压力测试

功能

  • 利用I/O多路复用技术的Epoll线程池实现【单Reactor、多线程】的高并发服务器模型;
  • 利用有限状态机和正则解析HTTP请求报文;
  • 利用STL标准库容器封装char,实现自定义的缓冲区;
  • 基于堆结构实现的定时器,关闭超时的非活跃网络连接;
  • 使用MySQL数据库作为用户登陆信息的落地存储;
  • 支持GET、POST请求

项目详解

WebServer项目——webserver详解
WebServer项目——httpconnect详解
WebServer项目——buffer详解
WebServer项目——epoller详解
WebServer项目——timer详解
WebServer项目——threadpool详解
WebServer项目——MySQL数据库使用详解
WebServer项目——日志库Log详解

环境要求

  • Linux
  • C++11
  • MySQL

项目启动

拷贝整个项目文件,在终端中使用

// 编译程序
sudo ./autobuild.sh
/* ./可执行文件名 端口号 */
./myserver 9999

性能表现

压力测试

./webbench-1.5/webbench -c 10 -t 10 http://ip:port/
./webbench-1.5/webbench -c 100 -t 10 http://ip:port/
./webbench-1.5/webbench -c 1000 -t 10 http://ip:port/
./webbench-1.5/webbench -c 10000 -t 10 http://ip:port/
  • 测试环境:Ubuntu18, CPU i7-9700 3.00GHz, 内存 16GB

QPS对比 用我自己的测试环境跑了一下【markparticle】和【老猫轩仔】的web服务器,并将测试情况记录如下表

10 100 1000 10000
markparticle 4657 4624 4549 4225
老猫轩仔 13530 13690 13688 12345
本项目/带日志输出 3340 4233 4280 2500
本项目/不带日志输出 4413 4484 4264 3667
横坐标为并发客户端数量;表格数据为QPS,单位page/s
  • 和【老猫轩仔】的QPS相比,差的有点离谱。。。

致谢

@老猫轩仔 @markparticle

httpserver's People

Contributors

irving-l avatar

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.