kenba / via-httplib

A library for embedding an HTTP or HTTPS server in C++ applications.
Boost Software License 1.0
46 stars 15 forks source link

Disable multi-threading mutex in single threaded mode #12

Closed kenba closed 7 years ago

kenba commented 7 years ago

A part of the fix for issue #11 was to add mutexes to server and http_server to protect 'connections_' and http_connections_ respectively during concurrent access.

The mutexes provided a quick and simple solution to the issue but std::mutex is notoriously slow.

The connections_mutex_ and http_connections_mutex_ should not be locked when use_strand == false.

kenba commented 7 years ago

Tested in single and multi-threaded modes using Apache benchmark on a separate machine running the following:

ab -n 10000 -c 1000 -k 192.168.1.64:80/hello 

The servers ran correctly without any errors.
The documentation has been updated to add a separate Configuration file.
The new release is tagged 1.3.1.