microsoft / cpprestsdk

The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.95k stars 1.64k forks source link

Move to cross platfrom thread pool #430

Open David-Haim-zz opened 7 years ago

David-Haim-zz commented 7 years ago

Hi there

This is a suggestion. I suggest we write a cross platform standard threadpool with resizing algorithm. from my experience, the win32 threadpool performance is poor, and creating a user-item for each task is catastrophic performance wise.

I volunteer to supply such threadpool , I just need your approval and a small description on how to start.

Thanks!

David-Haim-zz commented 7 years ago

bump

mobileben commented 7 years ago

I'm not sure if you'll get any answer. I'd recommend just diving in and going for it. You can always post approach here and maybe others can chime in on the approach.

David-Haim-zz commented 7 years ago

It would be nice to get an official response before I start. If Microsoft even cares for this project anymore.

ras0219-msft commented 7 years ago

Thanks for the suggestion!

We've found the Win32 threadpool to have extremely good performance on more recent versions of Windows; I'd first recommend testing the performance in those cases.

If in your specific instance you aren't getting the performance you need, you can easily and simply replace the scheduler at runtime using pplx::set_ambient_scheduler()[1][2]. If you'd like a boost-asio-based scheduler, you may be able to use pplx::details::linux_scheduler as an example[3].

[1] http://microsoft.github.io/cpprestsdk/namespacepplx.html#ac98993a43756c17916a9a14d89f1ca05 [2] https://github.com/Microsoft/cpprestsdk/blob/f15e613633ad7455f9dab465c5a3cce39613eb57/Release/src/pplx/pplx.cpp#L139 [2] https://github.com/Microsoft/cpprestsdk/blob/f15e613633ad7455f9dab465c5a3cce39613eb57/Release/src/pplx/pplxlinux.cpp