Our team is implementing a secure multi-layered peer-to-peer protocol which establishes connections between nodes over multiple intermediate 'hops' using Boost/C++.
We are currently locked in a debate on how to implement the protocol design, namely, as a asynchronous single-threaded or synchronous multi-threaded architecture.
I do not want to bias the question by enumerating pros and cons but I am keenly interested in the experience of the StackOverFlow community in such matters and which approach they would favour?
I realise that this is an open question so ideally the answer would not be based on anecdotal evidence but derived from some empirical or analytical basis.
I would recommend asynchronous for two reasons:
Synchronous could be more straightforward if the connections are independent, so that no threads have to share mutable state. If you can't make that guarantee, and be sure that it will not change in the future, then I would choose asynchronous.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.