Git Product home page Git Product logo

webserveryim's Introduction

基于Linux的轻量级Web服务器

项目描述

在Linux环境下基于C++语言开发轻量级的多线程Web服务器,服务器支持一定数量的客户端连接并及时响应,返回客户端请求的图片和视频等资源。

主要工作

  • 使用Epoll边沿触发的IO多路复用+非阻塞IO

  • 使用同步IO模拟Proactor事件处理模式

  • 使用多线程充分发挥多核CPU的优势,实现了固定线程数的半同步/半反应堆模式的线程池

  • 使用基于升序链表的定时器处理超时连接

  • 使用有限状态机解析HTTP请求报文,支持GET和POST方法

  • 使用MySQL数据库和数据库池,实现客户端注册和登录功能

  • 经过webbench压力测试可以实现上万的并发连接

原代码存在的问题

  1. 传输大文件时,m_iv结构体不会自动偏移

每次调用writev之后进行偏移

  1. listenfd为ET触发模式,但在main里没有循环读取,压测的时候表现很差

listenfd设置为LT触发,addfd增加一个参数Trigger

webserveryim's People

Contributors

zy-yim 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.