Skip to content

Commit 9e8d358

Browse files
committed
add table of contents to readme
1 parent 67341a7 commit 9e8d358

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

.config/.markdownlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ MD013:
1717
# Inline HTML
1818
MD033:
1919
allowed_elements:
20+
- a
2021
- br

README.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,27 @@ Collects read-write statistics for the entire storage and for each key.
1313
| **master** | [![CI status](https://github.com/work-examples/key-value-web-server/actions/workflows/build_cmake.yml/badge.svg?branch=master)](https://github.com/work-examples/key-value-web-server/actions/workflows/build_cmake.yml?query=branch%3Amaster) | [![CodeQL Code Analysis Status](https://github.com/work-examples/key-value-web-server/actions/workflows/codeql-analysis.yml/badge.svg?branch=master)](https://github.com/work-examples/key-value-web-server/actions/workflows/codeql-analysis.yml?query=branch%3Amaster) | [![Microsoft C++ Code Analysis Status](https://github.com/work-examples/key-value-web-server/actions/workflows/msvc.yml/badge.svg?branch=master)](https://github.com/work-examples/key-value-web-server/actions/workflows/msvc.yml?query=branch%3Amaster) |
1414
| **develop** | [![CI status](https://github.com/work-examples/key-value-web-server/actions/workflows/build_cmake.yml/badge.svg?branch=develop)](https://github.com/work-examples/key-value-web-server/actions/workflows/build_cmake.yml?query=branch%3Adevelop) | \[not applicable\] | \[not applicable\] |
1515

16-
## C++ Programmer's Test Task Description
16+
## Contents
17+
18+
- [C++ Programmer's Test Task Description](#task_description)
19+
- [Server](#description_server)
20+
- [Client Application](#description_client)
21+
- [Task Implementation Remarks](#implementation_remarks)
22+
- [Choosing Web Server Implementation](#choosing_web_server)
23+
- [Other Implementation Features](#other_implementation_features)
24+
- [Compile and Run](#compile_and_run)
25+
- [Web API](#web_api)
26+
- [Get Value](#api_get_value)
27+
- [Set Value](#api_set_value)
28+
- [Benchmark](#benchmark)
29+
- [Testing Environment](#benchmark_environment)
30+
- [Results](#benchmark_results)
31+
32+
## C++ Programmer's Test Task Description <a name="task_description"></a>
1733

1834
You need to write two applications, a client and a server, that communicate with each other.
1935

20-
### Server
36+
### Server <a name="description_server"></a>
2137

2238
The server has a configuration file on disk (`config.txt`). It stores key/value data.
2339
You can use any format. At startup, the server reads the configuration file.
@@ -52,7 +68,7 @@ writes=1
5268
When developing, you can use third-party libraries for parsing and for the network.
5369
For example `rapidjson`, `boost` etc.
5470

55-
### Client Application
71+
### Client Application <a name="description_client"></a>
5672

5773
Single threaded. Connects to the server, then selects a random key
5874
from the hardcoded list and executes `$get` on the server with a 99% probability,
@@ -63,9 +79,9 @@ Optionally make reconnect to the server in case of a disconnection, or if the se
6379
i.e. the client waits until it appears on the network.
6480
The client can be written in any language, even in Python.
6581

66-
## Task Implementation Remarks
82+
## Task Implementation Remarks <a name="implementation_remarks"></a>
6783

68-
### Choosing Web Server Implementation
84+
### Choosing Web Server Implementation <a name="choosing_web_server"></a>
6985

7086
I decided to use well-known HTTP protocol for client-server communication.
7187
Thus, we can easily debug the solution using any browser, programs like `Postman`.
@@ -91,7 +107,7 @@ I was choosing among many libraries:
91107

92108
Finally, I settled on `CrowCpp`.
93109

94-
### Other Implementation Features
110+
### Other Implementation Features <a name="other_implementation_features"></a>
95111

96112
The heart of the server engine uses `std::shared_mutex
97113
to optimize performance for many readers and single writer.
@@ -115,7 +131,7 @@ compiled with included complex C++ templates.
115131

116132
The solution also makes heavy use of move semantics.
117133

118-
## Compile and Run
134+
## Compile and Run <a name="compile_and_run"></a>
119135

120136
1. Run CMake.
121137
2. Compile project. You will get `WebServer` executable
@@ -133,14 +149,14 @@ CI is also preparing `Client.exe` executable which is a compiled version of `cli
133149
python3 client.py
134150
```
135151

136-
## Web API
152+
## Web API <a name="web_api"></a>
137153

138154
Two API methods are supported.
139155

140156
Here is the prepared API request collection for Postman:
141157
[WebServer.postman_collection.json](WebServer.postman_collection.json)
142158

143-
### Get Value
159+
### Get Value <a name="api_get_value"></a>
144160

145161
`GET` <http://127.0.0.1:8000/api/records/{key-name}>
146162

@@ -155,7 +171,7 @@ Reply body example:
155171
}
156172
```
157173

158-
### Set Value
174+
### Set Value <a name="api_set_value"></a>
159175

160176
`POST` <http://127.0.0.1:8000/api/records/{key-name}>
161177

@@ -175,9 +191,9 @@ Reply body example:
175191
}
176192
```
177193

178-
## Benchmark
194+
## Benchmark <a name="benchmark"></a>
179195

180-
### Testing Environment
196+
### Testing Environment <a name="benchmark_environment"></a>
181197

182198
CPU Intel Core i5 (8th gen), mobile version, 8 logical cores.
183199
Visual Studio 2019 (v16.11.13), Release build
@@ -192,7 +208,7 @@ WebServer.exe --no-logs
192208
Client.exe --no-logs
193209
```
194210

195-
### Results
211+
### Results <a name="benchmark_results"></a>
196212

197213
| Number of <br/>request threads | 10K requests <br/>per thread, req/sec | 100K requests <br/>per thread, req/sec |
198214
|---:|------:|-------:|

0 commit comments

Comments
 (0)