|
2 | 2 |
|
3 | 3 | Author: [Yuriy Pasichnyk](https://github.com/Fenix-125)<br> |
4 | 4 |
|
| 5 | +This repository is a part of a bachelor's thesis. |
| 6 | + |
| 7 | +Thesis title: **Performance analysis of synchronous and asynchronous parallel network server implementations using the C++ language** |
| 8 | + |
| 9 | + |
5 | 10 | ## Description |
6 | 11 |
|
7 | | -<mark>TODO</mark> |
| 12 | +The main two paradigms for implementing parallel network servers are synchronous and asynchronous. After an overview of these methodologies and implementation choices, the most representative and valuable versions of a **stateful TCP echo server** were designed and implemented. The versions and their specification are listed below: |
| 13 | + |
| 14 | +- **echo_server_simple_threaded** -- synchronous multithreaded |
| 15 | + * A separate thread per client is used. |
| 16 | + * A blocking I/O is used. |
| 17 | +- **echo_server_simple** -- hybrid-synchronous single-threaded |
| 18 | + * The hybrid keyword is used to denote that an asynchronous syscall("poll syscall") is used. |
| 19 | + * A blocking I/O is used. |
| 20 | +- **echo_server_custom_thread_pool** -- hybrid-synchronous multithreaded |
| 21 | + * The hybrid keyword is used to denote that an asynchronous syscall("poll syscall") is used. |
| 22 | + * Custom thread pool is used to distribute work between worker threads. |
| 23 | + * A blocking I/O is used. |
| 24 | +- **echo_server_boost_asio** -- asynchronous single-threaded |
| 25 | + * For this implementation, the boost asynchronous lib was used. |
| 26 | + * A non-blocking I/O is used. |
| 27 | +- **echo_server_boost_asio_threaded** -- asynchronous multithreaded |
| 28 | + * For this implementation, the boost asynchronous lib was used, too. |
| 29 | + * A non-blocking I/O is used. |
| 30 | + |
| 31 | +All versions support **Google Logging**. The Logging in the not-debug compilation is reduced due to performance concerns. |
| 32 | +The logging output is written to separate files in the newly created **./logs** directory. |
| 33 | + |
| 34 | +### Server Requirements |
| 35 | + |
| 36 | +- Send back received data from the client |
| 37 | +- Hold the client session until the client terminates it |
| 38 | +- Use TCP as the transport level protocol |
| 39 | + |
8 | 40 |
|
9 | 41 | ## Prerequisites |
10 | 42 |
|
11 | | -<mark>TODO</mark> |
12 | | -<!-- |
13 | | -<mark>LIST LIBRARIES/TOOLS/OTHER UTILITIES THAT NEED TO BE INSTALLED (E.G. GCC, OPENMP, CMAKE ETC)</mark> |
14 | | ---> |
| 43 | +The requirements for **apt** and **apk** Linux packet managers are listed in the corresponding files in the **dependencies** directory. |
| 44 | +An example how to install dependencies you can find below: |
| 45 | + |
| 46 | +```{bash} |
| 47 | +$ apt update && apt upgrade |
| 48 | +$ xargs apt install -y << ./dependencies/apt.txt |
| 49 | +``` |
| 50 | + |
| 51 | +## Compilation |
| 52 | + |
| 53 | +The compilation is automated using the **compile.sh**. Please refer to the help of the script via the **-h** option. |
| 54 | +To compile all the versions with optimization and install them to the **./bin** directory (created automatically), use the command below: |
| 55 | + |
| 56 | +```{bash} |
| 57 | +$ bash ./compile.sh |
| 58 | +``` |
| 59 | + |
| 60 | +## Usage |
| 61 | + |
| 62 | +The compiled executables can be run in normal user mode as shown below for differnt versions: |
| 63 | + |
| 64 | +```{bash} |
| 65 | +$ ./echo_server_simple_threaded |
| 66 | +$ ./echo_server_simple |
| 67 | +$ ./echo_server_custom_thread_pool |
| 68 | +$ ./echo_server_boost_asio |
| 69 | +$ ./echo_server_boost_asio_threaded |
| 70 | +``` |
| 71 | + |
| 72 | +## Testing description |
| 73 | + |
| 74 | +The perfomance testing of this versions is done using the [Fortio](https://github.com/fortio/fortio) opern source testing tool with parameters listed below: |
| 75 | + |
| 76 | +- **"-qps 0"** -- try to send maximum number of queries per second |
| 77 | +- **"-t 60 s"** -- test duration 60 seconds |
| 78 | +- **"-c <client-num>"** -- client number parameter |
| 79 | +- **"-payload-size 64"** -- set the client message size |
| 80 | +- **"-uniform"** -- de-synchronize parallel clients’ requests uniformly |
15 | 81 |
|
16 | | -### Compilation |
| 82 | +The server was run on a PC with characteristics listed below: |
| 83 | + |
| 84 | +| Characteristic | Value | |
| 85 | +|----------------|-------| |
| 86 | +|CPU Architecture| x86_64| |
| 87 | +|CPU Model name | 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz| |
| 88 | +|Logical CPUs | 8 | |
| 89 | +|Physical CPUs | 4 | |
| 90 | +|CPU max MHz | 4200 | |
| 91 | +|CPU min MHz | 400 | |
| 92 | +|CPU Byte Oserver| Little Endian | |
| 93 | +|L1d cache | 192 KiB (4 instances)| |
| 94 | +|L1i cache | 128 KiB (4 instances)| |
| 95 | +|L2 cache | 5 MiB (4 instances) | |
| 96 | +|L3 cache | 8 MiB (1 instance) | |
| 97 | +|RAM | 12.0 GB | |
| 98 | +|RAM type | DDR4 SDRAM | |
| 99 | +| OS | Ubuntu 20.04 LTS | |
| 100 | +| OS Kernel | Linux Kernel 5.4 | |
| 101 | +| NIC | Gigabit Ethernet LAN | |
| 102 | + |
| 103 | +The load for the server was generated from 3 PCs, which were interconnected with a Gigabit Ethernet network using a Cisco Switch. |
| 104 | +The metrics that we used to measure the performance are: |
17 | 105 |
|
18 | | -<mark>TODO</mark> |
19 | | -<!-- |
20 | | -<mark>HOW TO COMPILE YOUR PROGRAM? (RECOMMENDED: ./comile.sh)</mark> |
21 | | ---> |
| 106 | +- Connected clients number |
| 107 | +- Throughput |
| 108 | +- Latency |
| 109 | +- CPU consumption |
| 110 | +- Memory consumption |
22 | 111 |
|
23 | | -### Installation |
| 112 | +## Performance Visualizations |
24 | 113 |
|
25 | | -<mark>TODO</mark> |
26 | | -<!-- |
27 | | -<mark>DESCRIBE THE INSTALLATION PROCESS (USE ./dependencies FOLDER)</mark> |
28 | | -<mark>Note: For Python scripts, You must add `requirenments.txt` |
| 114 | +Below you can see visualizations of data collected from the Fortio load tests. |
29 | 115 |
|
30 | | -file and add your env to the `.gitignore` file!</mark> |
31 | | ---> |
| 116 | +### Throughput in respect to clients number |
| 117 | + |
32 | 118 |
|
33 | | -### Usage |
| 119 | +### Average latency in respect to clients number |
| 120 | +  |
34 | 121 |
|
35 | | -<mark>TODO</mark> |
36 | | -<!-- |
37 | | -<mark>PROVIDE AN EXAMPLE OF HOW TO RUN YOUR PROGRAM (IT CAN BE A_flag COMMAND LINE WITH INPUT AND EXPECTED OUTPUT)</mark> |
| 122 | +### 90 percentile latency in respect to clients number |
| 123 | + |
38 | 124 |
|
39 | | -<mark>Note: if your project needs or generates any data, media and so on -- put them |
40 | | -into the data folder</mark> |
41 | | ---> |
| 125 | +### 99 percentile latency in respect to clients number |
| 126 | + |
| 127 | + |
| 128 | +### 99.9 percentile latency in respect to clients number |
| 129 | + |
42 | 130 |
|
43 | | -### Results |
| 131 | +### CPU usage in respect to clients number |
| 132 | + |
44 | 133 |
|
45 | | -<mark>TODO</mark> |
46 | | -<!-- |
47 | | -<mark>DESCRIBE THE RESULTS OF THE WORK YOU DID. WHAT DID YOU LEARN OR FIND INTERESTING?</mark> |
48 | | ---> |
| 134 | +### Memory usage in respect to clients number |
| 135 | + |
0 commit comments