免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: 兰花仙子

从一个Perl程序看网络服务器设计 [复制链接]

论坛徽章:
0
发表于 2010-12-09 16:03 |显示全部楼层
我说了我的观点是 觉得你说的不够准确
IO非阻塞就是IO非阻塞  IO复用就是IO复用 不能放到一起说
IO复用是由2部分组成的 在socket连接部分是非阻塞的 在selcect部分是阻塞的,所以造成整个用户进程是阻塞的。

【你见过有不阻塞的进程吗?】
我说的是用户进程 没说进程。

论坛徽章:
0
发表于 2010-12-09 16:04 |显示全部楼层
非常漂亮的设计 赞

论坛徽章:
0
发表于 2010-12-09 16:47 |显示全部楼层
在selcect部分是阻塞的


select本来就是个阻塞函数,它在执行时,会一直阻塞,除非监控到有可用句柄。

所以造成整个用户进程是阻塞的


这个我没明白。。前后有啥因果关系。

论坛徽章:
0
发表于 2010-12-10 08:32 |显示全部楼层
楼主根本没摸到异步的门。

让flw教教你。他懂Haskell,知道laziness。知道怎么让异步程序不阻塞。

论坛徽章:
0
发表于 2010-12-10 09:40 |显示全部楼层
学习了,谢谢仙子姐姐!

论坛徽章:
0
发表于 2010-12-10 10:32 |显示全部楼层
不错的文章

论坛徽章:
0
发表于 2010-12-11 16:27 |显示全部楼层
学习了

论坛徽章:
0
发表于 2010-12-12 17:10 |显示全部楼层
本帖最后由 huxk 于 2010-12-12 17:17 编辑

摘录原文两段话

1 Obviously this provides us with the advantage of always picking up a filehandle that will not block thus avoiding the possibility of delaying the entire program for one lazy filehandle just because it happened to be the first we picked at random. Still, it does not guarantee that the selected filehandle is the best choice, because we still don't know how much data can be read, or how qucikly it can take in data that we wrte to it. But it is definetly a big step forward from our initial program.

2 As we already mentioned earlier, this method does not guarantee progress as it only tests whether a handle is ready to respond to I/O. The question still remains, whether the handle we pick from the ready ones is the one that will respond faster to I/O, and how much data there is available for reading or how much data it is ready to receive. So it is still possible to block a bit after the point where we picked the handle. Also, we did not take into account the impact on performance that the actual processing of requests will have. We might just be printing incoming data to a file, but then again, each request might need heavy processing that would slow down the entire handle processing loop. But these are issues that must be considered in the context of the individual application.

这两段话已经解释得很明白 这就是为什么 select poll epoll被称为 伪异步 的原因吧 充分将CPU时间利用起来 当一组handle都是活跃分子的的时候 select 比 epoll效率高 但有handle数目限制 apache对此有解决办法 通过多进程

不知道perl是否支持windows的完成端口 那个可以直接取得IO结果

论坛徽章:
0
发表于 2010-12-12 22:04 |显示全部楼层
这两段话已经解释得很明白 这就是为什么 select poll epoll被称为 伪异步 的原因吧


其实原文,包括我自己,没有哪里说这就是异步IO。
某个SB非得往这上面扯。。

论坛徽章:
0
发表于 2010-12-13 09:29 |显示全部楼层
这个人我block了。。不过他PM的消息我还是贴一下。

shhgs 2010-12-12 22:26  NEW
PERLER SB根本不懂select/poll的异步本质。

看看twisted,领略一下什么是真正的异步通讯。

从10%降到2%,不是没道理的。人家Py 04年就已经完全产品化的东西,Perl到10年才能拿出一个demo。更可笑的是,一群SB在那里一遍high Perl很强大,一遍起哄,性能不行,所以Perl不需要。

人要脑残成什么程度才能像Perler这样SB+2B。

shhgs 2010-12-12 22:27  NEW
TO Perler SB 版主:

本来要跟贴的,既然不能发言,麻烦把我的短信贴到帖子里。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP