fastsocket优化网络性能原理

论坛 期权论坛     
选择匿名的用户   2021-5-30 02:54   192   0
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px"> fastsocket是一个fastos的一个网络方面的优化,由新浪开源。fastsocket主要优化内核中的accept因为锁而导致的串行,对于短连接会极大的提高其性能,cpu核越多性能提升越明显。基于内核模块和一个动态链接库,对于某些应用程序不需修改就可使用。但是并非所有应用都能通过fastsocket获得性能提升。 fastsocket比较适用于一下场景:</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   系统至少不少于8个cpu</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   系统的很大一部分开销用于处理网络软中断以及socket相关系统调用</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   tcp短连接很多</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   应用使用了epool处理网络io</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   应用使用了多进程接收连接</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px"> 计划增加特性:(改善长连接的性能)</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   direct-tcp:接收数据跳过路由处理</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   每一个核维护一个skb pool</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   投递packet到应用运行的核上,类似于rfs,(声称更加精确)</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">   位rps增加用户定义接口</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px"> 这里特别说明的是,应用必须是多进程accept连接进行处理,并且每个进程采用epoll的方式才能通过fastsocket获得性能提升。</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">  </p>
<div style="margin:0px 0px 15px; padding:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px"> fastsocket主要由一个内核模块和一个用户态动态链接库,通过LD_PRELOAD拦截系统调用,经过libfsocket.so处理后,采用ioctl的形式和fastsocket内核模块进行通信,内核模块进行实际的优化工作。</p>
</div>
<div style="margin:0px 0px 15px; padding:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px"> <a style="text-decoration:underline" target="_blank">2.  </a></p>
</div>
<div style="margin:0px 0px 15px; padding:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px"> fastsocket环境搭建</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px"> 目前fastsocket只在2.6.x版本上实现,高版本需要移植才能使用。</p>
</div>
<div style="margin:0px 0px 15px; padding:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px"> kernel version &#61; 2.6.x</p>
</div>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">  fastsocket安装</p>
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px"> 下载fastsocket项目源代码,包括内核和用户态部分代码。</p>
<div style="margin:0px 0px 15px; padding:0px; color:rgb(51,51,51); font-family:arial,宋体; font-size:14px; line-height:28px">
<p style="margin-top:0px; margin-bottom:15px; padding-top:0px; padding-bottom:0px"> git clon
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP