Giter VIP home page Giter VIP logo

tinyweb's Introduction

  • 前言

    本项目是基于C++线程池的轻量级Web并发服务器,事件处理模式采用Reactor模式,主线程只负责监听文件描述符是否有事件发生,读写数据、接收新的连接、以及处理客户请求均在工作线程中实现;使用半同步/半异步模式,每个线程(主线程和工作线程)都通过一个epoll维护自己的事件循环,它们各自独立地监听不同事件。使用C++ 11的atomic原子变量来同步线程访问从而避免同步错误;使用STL的优先队列作为定时器容器来回收非活动长连接。本项目的具体设计思路可以参照本人的知乎文章C++网络编程入门:轻量级Web并发服务器开发,纯属抛砖引玉,欢迎大佬们批评指正。

  • 运行环境

    (1).系统:Ubuntu16.04;

    (2).语言:C++ 11及以上版本;

  • 支持功能

    (1).支持Get请求; (2).支持长连接/短连接; (3).支持ipv4/ipv6;(4).支持tcp;(5).支持请求静态内容(6).支持并发请求

  • 开始运行

    (1).下载程序;

    git clone [email protected]:Buerzhu/TinyWeb.git

    (2).打开新终端,指定ip地址和端口运行服务器程序:

    cd ~/TinyWeb/Server/Debug

    ./server 127.0.0.1 12345

    (3).打开新终端,指定ip地址、端口、客户连接数运行压力测试程序:

    cd ~/TinyWeb/Client/Debug

    ./client 127.0.0.1 12345 1000

tinyweb's People

Contributors

buerzhu 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.