Comments (8)
Please try the following diff and let me know if it fixes the problem, thanks.
diff --git a/asio/include/asio/detail/config.hpp b/asio/include/asio/detail/config.hpp
index 6207552..156f4e5 100644
--- a/asio/include/asio/detail/config.hpp
+++ b/asio/include/asio/detail/config.hpp
@@ -289,6 +289,11 @@
# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
# endif // defined(__GNUC__)
+# if defined(ASIO_MSVC)
+# if (_MSC_VER >= 1900)
+# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
+# endif // (_MSC_VER >= 1900)
+# endif // defined(ASIO_MSVC)
# if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
# define ASIO_ERROR_CATEGORY_NOEXCEPT
# endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
from asio.
Yep, that worked, thank you. Tell me Chris, would you have any interest in a STL concurrent unordered map with concurrent safe erase and node splicing facilities? It could let you remove a lot of locking from io_service on POSIX and therefore substantially increase concurrency, potentially to the extent of the IOCP implementation? The single threaded performance loss is about 10% of a std::unordered_map on GCC and clang, and unfortunately over 50% on MSVC (so don't use it there until Microsoft catch up), but concurrency increases linearly with core count so it runs rings around an unordered_map even on a dual core CPU. Let me know if that sounds of interest.
from asio.
Are you using master? If so, the first step would be to try it in a separate implementation of an execution context, with the same members (run, run_one, stop, etc) as io_service. Are you able to put that together, at least as a partial prototype?
from asio.
It's more that on Linux, at least, your io_service implementation contends heavily on a std::mutex when one is scheduling a large number of small work items where multiple worker threads are available to run(). ASIO makes the choice of lock configurable if I remember rightly, but it would be even better if it didn't lock at all when scheduling i/o, or when worker threads are deciding what callbacks to execute. Obviously that's a substantial refactor of your current POSIX io_service implementation, it wouldn't be something I would prototype but I can certainly supply the proposed boost concurrent_unordered_map to you (note: no Boost is required, it's completely standalone). The fact it can concurrently safe erase is an enormous difference over split ordered list concurrent hash tables.
from asio.
For reference, my statement about ASIO io_service lack of concurrency has benchmarks at https://boostgsoc13.github.io/boost.afio/doc/html/afio/FAQ/closure_performance.html (see right hand column). v1.3 of the AFIO engine will use concurrent_unordered_map, and I should very substantially close the gap between AFIO and ASIO. v1.4 of the AFIO engine will use the new non-allocating constexpr future-promises which are essentially a functional elaboration of ASIO async_result, and with that I expect to eliminate almost all of the gap between AFIO and ASIO.
from asio.
I've also run into this issue (ASIO does not scale beyond 3-4 threads) which limits the concurrency of programs built using my WebSocket library, WebSocket++, when used with the ASIO based networking policy. If this thread turns into a serious effort to address this issue I'd be willing to put in some time, at minimum in testing & benchmarking and possibly writing code as well.
from asio.
The above patch introduces the following warning on VS 2015:
c:\dev_2015\project\asio-1.11.0\include\asio\detail\config.hpp(300): warning C4005: 'ASIO_ERROR_CATEGORY_NOEXCEPT': macro redefinition
1> c:\dev_2015\project\asio-1.11.0\include\asio\detail\config.hpp(286): note: see previous definition of 'ASIO_ERROR_CATEGORY_NOEXCEPT'
Either define would work
define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept
from asio.
I see the macro redefinition warning as well.
from asio.
Related Issues (20)
- A question regarding awaitables and executors
- Does asio support compile on qnx710 HOT 2
- How to build asio on Linux and Windows
- How to build asio on Linux and Windows HOT 1
- Build with `-DASIO_NO_EXCEPTIONS` and `-DASIO_SEPARATE_COMPILATION`
- Clarifying the difference between BOOST_ASIO_CONCURRENCY_HINT_UNSAFE and BOOST_ASIO_CONCURRENCY_HINT_UNSAFE_IO
- llvm17(clang-cl) with awaitable build error HOT 2
- Does asio support compile on VxWorks7? HOT 1
- Add asio::experimental::promise a default constructor and move assignment operator
- asio::error::ssl_errors should be scoped to prevent UB HOT 1
- Leak in move-assignment of ssl::detail::engine
- steady_timer.cancel() unable to release registered functions HOT 1
- Ambiguous call to `async_connect` because of unconstrained `ConnectCondition` HOT 1
- win_iocp_io_context::timer_thread_function::operator()() Exception
- libc++ removes some ifdefs so current code doesn't work as expected
- async_read on asio::serial_port does not return when io_context::stop() called
- Why are the classes scheduler, scheduler_task and scheduler_operations in the detail namespace?
- Handling of `error::eof` in `ssl::stream::shutdown(ec)`
- Segmentation fault when including <boost/asio.hpp> in multiple compilation units on MacOS with GCC
- Why were the sender/receiver marked depricated?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asio.