C++ web app with Crow: early scalability results
Daniel Lemire's blogLast year, I looked at writing small “hello world” web applications in various programming languages (Go, JavaScript, Nim…). Go, using nothing but the standard library, did well.
In these benchmarks, I am just programming an HTTP route that returns a small string (e.g., ‘hello world’). The query is from the host itself. The intent behind such a benchmark is to measure how well an web application might scale in the best of cases. I call such a benchmark ‘simplistic’ because nobody only ever returns just a short string and you do not usually query the server from the host.
At the time, I had wanted to compare with a C++ library, and I ended up trying the lithium framework which scaled very well.
Jake Arkinstall pointed out that he uses Crow, to build web applications in C++. So I decided to take Crow on a spin.
My simplistic application has only few lines:
#include "crow.h"
int main() {
crow::SimpleApp app;
app.loglevel(crow::LogLevel::Warning);
CROW_ROUTE(app, "/simple")([](){
return "Hello world";
});
app.port(18080).multithreaded().run();
}
To build it, I use a standard CMakeLists.txt file:
cmake_minimum_required(VERSION 3.15) project(funserver CXX) find_package(Crow REQUIRED) add_executable(server src/server.cpp) target_link_libraries(server Crow::Crow)
And I use a conan file to specify the dependency:
[requires] crowcpp-crow/1.1.0 [generators] CMakeDeps CMakeToolchain
That is all. Then to build, I issue the following commands in shell:
conan profile detect --force conan install . --output-folder=build --build=missing cmake -B build -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release cmake --build build ./build/server
I assumes that you have C++ compiler, Conan and Cmake, but these are standard tools.
After issuing these commands, my server is then running. I use bombardier to hammer the server with requests. On a Linux server with many processors (64) and much memory, I try increasing the number of simultaneous requests and looking for errors. You can run my benchmark from my source code and instructions. Your numbers will differ.

These are numbers comparable to the lithium server. So it seems that Crow offers state-of-the-art performance. Crow offers HTTP/1.1 and Websocket support, but it has currently no support for the more recent standards. It has a nice Web site.
Generated by RSStT. The copyright belongs to the original author.