cpprestsdk
cpprestsdk copied to clipboard
A quick way to a multithreaded listener
Hi, I am testing this library comparing it to other similar C++ REST libraries available. I noticed that most of them offer a quick way of specifying the number of threads handling the incoming requests, for example, for restbed it is:
settings->set_worker_limit(4);
for others libraries, it is equally easy. I didn't find such easy option for this library, however. Can you indicate how to achieve this with cpprestsdk?
Just use bellow code can call it at the beginning.
#include <pplx/threadpool.h>
crossplat::threadpool::initialize_with_threads(4)
When using the VCPKG x64-windows-static version, VS 2019 cannot find the function:
error LNK2001: unresolved external symbol "public: static void __cdecl crossplat::threadpool::initialize_with_threads(unsigned __int64)" (?initialize_with_threads@threadpool@crossplat@@SAX_K@Z)
"crossplat::threadpool::initialize_with_threads(4)" is used for Linux platform.
on Windows, I think you do not need to setup a threadpool, by my understanding, the thread is created dynamiclly when there have new request, and there have no initial thread pool, the implementation is different with Linux.
thank you for the explanaion!
"crossplat::threadpool::initialize_with_threads(4)" is used for Linux platform.
on Windows, I think you do not need to setup a threadpool, by my understanding, the thread is created dynamiclly when there have new request, and there have no initial thread pool, the implementation is different with Linux.
for windows, how to have a pool biggern than 40?
for windows, it has dynmaic backlog but we still can set MinimumDynamicBacklog / MaximumDynamicBacklog Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters
Value name:EnableDynamicBacklog Value data: 00000001
Value name:MinimumDynamicBacklog Value data: 00000040
Value name:MaximumDynamicBacklog Value data: 00001000
Value name:DynamicBacklogGrowthDelta Value data: 00000010