﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-sherrylso-最新评论</title><link>http://www.cppblog.com/sherrylso/CommentsRSS.aspx</link><description /><language>zh-cn</language><pubDate>Sat, 03 Jan 2009 10:26:18 GMT</pubDate><lastBuildDate>Sat, 03 Jan 2009 10:26:18 GMT</lastBuildDate><generator>cnblogs</generator><item><title>re: 完成端口(IOCP)编程探讨</title><link>http://www.cppblog.com/sherrylso/archive/2008/10/23/30858.html#64842</link><dc:creator>r2100</dc:creator><author>r2100</author><pubDate>Thu, 23 Oct 2008 09:15:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/10/23/30858.html#64842</guid><description><![CDATA[@NULL<br>回答下上面的问题，你的问题就有问题，如果只有一个recv投递，那就不会存在乱序的问题，如果你投递n个，按顺序1.2.3，但是你怎么保证recv不是按照2.3.1返回的呢?<br>分别给1.2.3的overlapped做上记号1.2.3，返回时加个排序就可以了。<br><br><img src ="http://www.cppblog.com/sherrylso/aggbug/64842.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">r2100</a> 2008-10-23 17:15 <a href="http://www.cppblog.com/sherrylso/archive/2008/10/23/30858.html#64842#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: windows同步对象小结</title><link>http://www.cppblog.com/sherrylso/archive/2008/09/19/28585.html#62271</link><dc:creator>wangwj</dc:creator><author>wangwj</author><pubDate>Fri, 19 Sep 2008 05:38:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/09/19/28585.html#62271</guid><description><![CDATA[这篇是我看到同步对象最好的总结文档，谢谢博主的好文章。<img src ="http://www.cppblog.com/sherrylso/aggbug/62271.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">wangwj</a> 2008-09-19 13:38 <a href="http://www.cppblog.com/sherrylso/archive/2008/09/19/28585.html#62271#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: c++晦涩语法背后的故事(一)</title><link>http://www.cppblog.com/sherrylso/archive/2008/07/03/36375.html#55207</link><dc:creator>md6600</dc:creator><author>md6600</author><pubDate>Thu, 03 Jul 2008 06:12:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/07/03/36375.html#55207</guid><description><![CDATA[C++代码本来就很明了精简。 只不过 人比较懒惰，所以越来越简。就会这样咯。 写句注释嘛  有多难呢111<img src ="http://www.cppblog.com/sherrylso/aggbug/55207.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">md6600</a> 2008-07-03 14:12 <a href="http://www.cppblog.com/sherrylso/archive/2008/07/03/36375.html#55207#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 完成端口(IOCP)编程探讨</title><link>http://www.cppblog.com/sherrylso/archive/2008/06/23/30858.html#54418</link><dc:creator>饭中淹</dc:creator><author>饭中淹</author><pubDate>Mon, 23 Jun 2008 15:41:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/06/23/30858.html#54418</guid><description><![CDATA[多个recv可以在overlapped上进行顺序绑定<br>recv请求的顺序，决定了它收到的数据的先后顺序。<br>只要进行简单的排序，就可以保证recv的数据的顺序正确。<br><br>如果用多个recv的话，可以直接去掉recvbuf了。对于一个socket，去掉recvbuf相当于是减少了内存复制，因为Io层会把WSARecv进去的buf拿来直接作为缓冲来保存收到的数据。<br><br>如果不去掉recvbuf，那么多recv就看起来不是那么有意义了。<br><br><br><br>另外，iocp的程序可以写的比较Open一点，不要老想着节省内存。对于buffer和overlapped结构，可以分别用一个池来管理，而不是固定写死。这样不需要等待处理完一次受到的buffer，就能紧接着发出下一次recv，而且在这个过程中overlapped这个结构还能够重用，效率自然就会提升的。<br><br><br><br><br><img src ="http://www.cppblog.com/sherrylso/aggbug/54418.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">饭中淹</a> 2008-06-23 23:41 <a href="http://www.cppblog.com/sherrylso/archive/2008/06/23/30858.html#54418#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 完成端口(IOCP)编程探讨</title><link>http://www.cppblog.com/sherrylso/archive/2008/06/09/30858.html#52672</link><dc:creator>iunknown</dc:creator><author>iunknown</author><pubDate>Mon, 09 Jun 2008 09:19:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/06/09/30858.html#52672</guid><description><![CDATA[这里有一个用 zero byte buffer 策略集成 iocp 到 libevent 的方案。<br>具体的源代码：<a target="_new" href="http://spserver.googlecode.com/files/libevent-1.4.4-iocp-3.zip">http://spserver.googlecode.com/files/libevent-1.4.4-iocp-3.zip</a><br><br>vc6 的 dsw 文件在 libevent-1.4.4-iocp-3/libevent-iocp 目录中。<br>这个方案就是单线程负责 IO ，里面有 echo_iocp.exe 和 testiocpstress.exe ，可以试试看它的性能。<br><br>方案的描述可以看看<br><a target="_new" href="http://monkeymail.org/archives/libevent-users/2008-June/001269.html">http://monkeymail.org/archives/libevent-users/2008-June/001269.html</a><img src ="http://www.cppblog.com/sherrylso/aggbug/52672.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">iunknown</a> 2008-06-09 17:19 <a href="http://www.cppblog.com/sherrylso/archive/2008/06/09/30858.html#52672#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 完成端口(IOCP)编程探讨</title><link>http://www.cppblog.com/sherrylso/archive/2008/06/09/30858.html#52671</link><dc:creator>iunknown</dc:creator><author>iunknown</author><pubDate>Mon, 09 Jun 2008 09:14:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/06/09/30858.html#52671</guid><description><![CDATA[@爱上龙卷风<br>&gt;&gt;&gt;关于你提到的框架，本质上是多线线程的。负责 IO 的线程数目理论上本来就应该是你机器cpu的个数。前提是你保证你的io设计是异步执行的。<br><br>框架中用到了多线程，不过用于处理 IOCP 的线程（或者称为用于处理前端网络 IO 的线程）就只有一个。后端的线程池是用于处理具体的业务的，不会涉及前端的网络 IO 的。前端的网络 IO 可以非常清晰地剥离出来，由一个单独的线程来负责。在 input 的时候，在前端的 IO 线程中读入数据，放入 inputqueue，线程池负责 inputqueue；output 的时候，线程池把结果放入 outputqueue ，前端 IO 线程负责处理 outputqueue 。<img src ="http://www.cppblog.com/sherrylso/aggbug/52671.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">iunknown</a> 2008-06-09 17:14 <a href="http://www.cppblog.com/sherrylso/archive/2008/06/09/30858.html#52671#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 异步IO性能探究</title><link>http://www.cppblog.com/sherrylso/archive/2008/05/29/27330.html#51495</link><dc:creator>爱上龙卷风</dc:creator><author>爱上龙卷风</author><pubDate>Thu, 29 May 2008 09:04:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/05/29/27330.html#51495</guid><description><![CDATA[@拖鞋<br>不好意思，我当时的代码找不到了，不过我可以给你一个参考资料：<br><a target="_new" href="http://support.microsoft.com/kb/156932">http://support.microsoft.com/kb/156932</a><br>看能不能帮到你。<br><img src ="http://www.cppblog.com/sherrylso/aggbug/51495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">爱上龙卷风</a> 2008-05-29 17:04 <a href="http://www.cppblog.com/sherrylso/archive/2008/05/29/27330.html#51495#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 完成端口(IOCP)编程探讨</title><link>http://www.cppblog.com/sherrylso/archive/2008/05/29/30858.html#51492</link><dc:creator>爱上龙卷风</dc:creator><author>爱上龙卷风</author><pubDate>Thu, 29 May 2008 08:56:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/05/29/30858.html#51492</guid><description><![CDATA[@iunknown<br>关于你提到的框架，本质上是多线线程的。负责 IO 的线程数目理论上本来就应该是你机器cpu的个数。前提是你保证你的io设计是异步执行的。<img src ="http://www.cppblog.com/sherrylso/aggbug/51492.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">爱上龙卷风</a> 2008-05-29 16:56 <a href="http://www.cppblog.com/sherrylso/archive/2008/05/29/30858.html#51492#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 完成端口(IOCP)编程探讨</title><link>http://www.cppblog.com/sherrylso/archive/2008/05/24/30858.html#50985</link><dc:creator>iunknown</dc:creator><author>iunknown</author><pubDate>Sat, 24 May 2008 15:49:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/05/24/30858.html#50985</guid><description><![CDATA[@RedFox<br>我也是進來討論你提出的第三個問題的。 <br><br>通常的做法是一個 Socket 用一個 WSARecv 異步操作，有完成事件時，先處理完這個異步操作時，才再次發出下一個 WSARecv 異步操作。這樣就不會有你說的消息亂序問題了。 <br><br>而你說的一次對同一個 socket 提交 n 個 WSARecv 操作。我認為是不可取的。 <br><br><br>也是用这个方法来实现的，这样做会比较简单，可以避免消息的乱序问题。而且在关闭 socket 释放资源的时候，也相对容易控制。<img src ="http://www.cppblog.com/sherrylso/aggbug/50985.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">iunknown</a> 2008-05-24 23:49 <a href="http://www.cppblog.com/sherrylso/archive/2008/05/24/30858.html#50985#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 完成端口(IOCP)编程探讨</title><link>http://www.cppblog.com/sherrylso/archive/2008/05/24/30858.html#50984</link><dc:creator>iunknown</dc:creator><author>iunknown</author><pubDate>Sat, 24 May 2008 15:46:00 GMT</pubDate><guid>http://www.cppblog.com/sherrylso/archive/2008/05/24/30858.html#50984</guid><description><![CDATA[@爱上龙卷风<br>你应该弄错了,的确,如果按照你的说法,就是单线程了,没有多线程。<br>当然没有问题。但是，你的performance是没法保证的，几乎没有什么<br>throughput的。<br><br><br>关于这一点，有实现过一个用单线程负责 IO 操作，线程池负责业务逻辑处理的 server framework 。负责 IO 的单线程，主要是执行 WSARecv， WSASend ，GetQueuedCompletionPort，具体的业务逻辑不在这个线程里面执行。<br>用这个框架实现过一个 echo server ，进行大压力测试，发现 throughput 还是很高的。可以认为在目前的 CPU 速度下，只是执行 WSARecv，WSASend，GetQueuedCompletionPort ，还是足够快的。<br>如果在同一台机运行 client 和 server，测试的结果是可以达到每秒 send 10万， recv 10万。<img src ="http://www.cppblog.com/sherrylso/aggbug/50984.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sherrylso/" target="_blank">iunknown</a> 2008-05-24 23:46 <a href="http://www.cppblog.com/sherrylso/archive/2008/05/24/30858.html#50984#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>