Multi-threading support

Jun 30, 2015 at 9:28 AM
Edited Jun 30, 2015 at 9:29 AM
Hi, I'm new to Casablanca and would like to get some clarity on http_listener.
I would like to know whether the SDK creates separate thread instances to handle each client request received. In other words, does the method registered with http_listener::support() constitute the thread stack for handling client request.
Coordinator
Jun 30, 2015 at 10:36 PM
Hi fayazvf,

It depends on the platform you are targeting, but a new thread is not created for each incoming HTTP client request. Instead you should think of it as a thread pool. If you let me know the platform you are running on I can go into more detail. In general for all of the asynchronous operations in the C++ REST SDK the workload is scheduled on a thread pool or some OS facility.

Steve
Jul 3, 2015 at 7:10 AM
Hi Steve,

Thanks for the response. I am using this primarily for iOS platform. I was able to verify that the request handlers are allocated from a thread pool with a pool size of around 40 on MAC OSX. Would like to know if the pool size is configurable?

-Fayaz
Coordinator
Jul 6, 2015 at 5:49 PM
Hi Fayaz,

Yes you are correct. Currently we don't expose any public API to dynamically change or adjust the pool size. On OS X/iOS this pool is used to service network calls from Boost.Asio. If you wanted to take a look at adjusting or configuring take a look in Release\include\pplx\threadpool.h and Release\src\pplx\threadpool.cpp and PPLX Tasks are scheduled and run on the global default priority concurrent dispatch queue from GCD.

Steve