boost asio 性能与线程安全性
http://stackoverflow.com/questions/12794107/why-do-i-need-strand-per-connection-when-using-boostasio/12801042
http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/overview/core/strands.html
url1: ?同一個socket上, 不能 read write讀寫不能并發(fā)。。。。 !!!!???? 這個感覺不可能吧。。。那也太弱智了。。
====確實不能對同一個socket同時讀寫,socket能封裝了basic_socket_stream, 該類的對象不能支持同時進(jìn)行讀寫操作。ps, fstream也不能支持同時讀寫吧。。
http://stackoverflow.com/questions/4078484/using-boost-sockets-do-i-need-only-one-io-service
只強(qiáng)調(diào), 不能 對同一個socket同時多讀, 或者同時多寫。
http://stackoverflow.com/questions/6161725/boostasio-threadpool-vs-io-service-per-cpu-design
性能遞升。。。
http://en.highscore.de/cpp/boost/asio.html#asio_networkprogramming
high score boost里面有boost asio的用法
1) single thread && single io_service, 最簡單, 性能最一般
2) multithread && single io_service
3) io_service per thread. ?multi io_service.
這三個性能應(yīng)該也是遞增的。。。
http://stackoverflow.com/questions/11010530/do-we-need-multiple-io-service-per-thread-for-threaded-boostasio-server-with/11011080#11011080
single thread && single io_service性能肯定是不夠的。
boost asio example
HTTP Server 2
An HTTP server using an io_service-per-CPU design.
HTTP Server 3
An HTTP server using a single io_service and a thread pool calling?io_service::run().
http://stackoverflow.com/questions/8557067/thread-safe-coroutines-with-asio
http://www.crystalclearsoftware.com/soc/coroutine/coroutine/coroutine_thread.html
coroutine能使異步切碎的邏輯看起來像同步的方式寫代碼。
但是coroutine不能支持多線程, 只能一個ioservice一個線程的方式。
總結(jié)
以上是生活随笔為你收集整理的boost asio 性能与线程安全性的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: samba 安装配置
- 下一篇: 锁与高6)并发