Giter Club home page Giter Club logo

server's Introduction

Server

高性能c++web服务器,服务器基于Reactor模式,采用one loop per thread结构,解析了get/head等请求,支持http长短链接,基于红黑树实现了定时器的有效管理,并且实现了基于双缓冲区的异步日志,时刻记录服务器的运行状态。 0.1框架 整体框架如图,主reactor负责接收新的连接,建立连接后分配给某个SubReactor。跨线程调用利用回调函数队列实现,需要加锁,锁的竞争只在MainReactor和某一SubReactor之间,不同SubReactor之间没有联系。

Key Points

  • 使用epoll水平触发+非阻塞IO,使用Reactor模式
  • 采用one loop per thread结构,使用多线程充分利用多核CPU,并使用线程池避免创建销毁的开销
  • 使用eventfd实现了线程的异步唤醒
  • 使用基于multimap的定时器,主要用于HTTP超时关闭,使用timerfd唤醒等待线程
  • 使用双缓冲技术,实现了简单的异步日志
  • 使用了RAII技术设计了多个类
  • 解析了HTTP请求(GET HEAD),支持长短连接

Build & Run

./build
./Server

Module

各部分介绍见模块介绍

Test

关于项目的一些问题,改进,以及测试结果见问题和测试

server's People

Contributors

jingyu-tong avatar orientlu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.