Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.29 KB

README.md

File metadata and controls

51 lines (35 loc) · 1.29 KB

Multithreaded web server prototype

This repo contains a simple web server prototype that can only serve text files on 'GET' requests. Requests are received via epoll and socket and then distributed among a thread pool's threads. A couple of classes are also covered with Boost unit tests.

Dependencies

  • Linux (tested on kernel 5.4.95, Manjaro 20.2.1)
  • Boost library v. 1.75 installed in system
  • Ext Boost DI (from GitHub, see Preparations)
  • Cmake (tested with version 3.19.4)

Preparations

  1. While in the root dir, clone Boost Ext DI project to libs dir:

    git clone https://github.com/boost-ext/di.git libs/di
  2. Fill defintions.h with suitable parameters:

    1. THREADS_COUNT - integer. It might be suboptimal to use more threads, that there are CPU cores
    2. WEB_ROOT - absolute path ending with '/'
    3. PORT_TO_LISTEN
  3. Compile on all cores:

    $ cmake --build cmake-build-debug --target preview -- -j $(nproc)
  4. Run with the following command:

    $ ./cmake-build-debug/preview 

Tests

  1. Compilation:

    $ cmake --build cmake-build-debug --target preview_boost_tests -- -j $(nproc)
  2. Running:

    $ ./cmake-build-debug/boost_tests/preview_boost_tests