Git Product home page Git Product logo

simple-http-server's Introduction

Simple HTTP Server

Implementation of a simple HTTP server with C++

Features

  • Run on Linux only
  • It can handle a huge concurrent connections (> 10k).
  • Only support HTTP/1.0 and HTTP/1.1, with basic request methods: GET, POST, PUT, DELETE.
  • Only support basic HTTP/1.1, persistent connections, focus on serving as much RPS as possible.
  • Support basic request and response, request size < 4KB.
  • The art of speed is about epoll, refer 63.4.5 of The Linux Programming Interface book

image

Design

TBU

Clone and build the source code

To install this server, follow these steps:

  1. Clone this repository: git clone [email protected]:nguyenhien1994/simple-http-server.git
  2. Navigate to the repository directory: cd simple-http-server
  3. Build the source code:
mkdir build
cd build
cmake .. && make

Usage

To start the server, run ./HttpServer from the build directory.

The server will start on port 38080 by default.

Access the demo API via: localhost:38080/helloworld

Note: you may need to increase the resource limit with ulimit before running the server.

Benchmark

Benchmarking with wrk

  • On the Laptop with 8 cores and 16GB RAM: It can serve > 200k rps and 10k concurrent connections

image

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you would like to contribute.

TODO

  • Add basic design
  • Add unittests
  • Support more features HTTP/1.1
  • Support send a receive message with large payload ...

simple-http-server's People

Contributors

nguyenhien1994 avatar

Stargazers

 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.