??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品一区二区黑丝,亚洲一级片在线观看,欧美成人一区二区三区片免费http://m.shnenglu.com/lxyfirst/zh-cnSun, 24 Aug 2025 07:37:31 GMTSun, 24 Aug 2025 07:37:31 GMT60分布式高可用id服务器设计实?/title><link>http://m.shnenglu.com/lxyfirst/archive/2015/09/17/211854.html</link><dc:creator>star</dc:creator><author>star</author><pubDate>Thu, 17 Sep 2015 06:09:00 GMT</pubDate><guid>http://m.shnenglu.com/lxyfirst/archive/2015/09/17/211854.html</guid><wfw:comment>http://m.shnenglu.com/lxyfirst/comments/211854.html</wfw:comment><comments>http://m.shnenglu.com/lxyfirst/archive/2015/09/17/211854.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://m.shnenglu.com/lxyfirst/comments/commentRss/211854.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/lxyfirst/services/trackbacks/211854.html</trackback:ping><description><![CDATA[服务?后台开发中如何生成id是每个开发者都会遇到的问题Q在电商、游戏领域尤其突出?br />如何保证生成id的唯一性、可靠性、高可用性,如何l织id的格式,在不同的应用场景和限制下实现方式也不相同?br /><br />我们的应用场景类似电商,在一个订单的生命周期内,有多个逻辑需要生成各自的idQ还要考虑到可L和灉|性,我们军_实现一个独立的id服务?br />首先Qid服务必须h高可用性,业务逻辑处理中创建idp|是不可接受的Q所以id服务必须分布式部|Ԍ有多个节点同时对外服务,一个节点失败则重试其他节点Q保证成功创建id?br />在分布式pȝ中保证数据的一致性成本是很高的,Z化设计和实现Q每个节炚w设计成对{的、独立的Q不需要保持数据同步?br />其次Qid服务必须可靠Q数据不能丢失,因此数据的存储放在独立的mysql数据库中Q用replace方式更新数据Qid服务本n记录更新日志?br />最后,id服务必须灉|Q可以自定义id格式Q可以高效灵zȝ实现客户端,因此通讯协议使用json over udp方式Q在id服务端用lua实现id格式的灵zd义?br /><div>ID规则</div><div><div>    具体规则有lua脚本定义Q修改脚本后需要reload生效Q需要实?个函?/div><div>    min_counter :   计数器最?/div><div>    max_counter :   计数器最大?/div><div>    reset_seconds : 计数器重|周?/div><div>    create_id : Ҏ计数器、自定义参数和时间参数创建ID?br />    例如Q?br /><div>    function min_counter()</div><div>        return 0</div><div>    end</div><div>    function max_counter()</div><div>        return 9999</div><div>    end</div><div>    function reset_seconds()</div><div>        return 86400</div><div>    end</div><div>    function create_id(counter,now,salt)</div><div>        local seq = counter:generate_counter()</div><div>        local new_id = string.format("%01d%02d%02d%04d",now:year()%10 ,now:month(),now:day(),seq)</div><div>        return new_id</div><div>    end</div><div></div></div></div><div>接口</div><div></div><div></div><div></div><div>    采用udp协议Q数据格式ؓjson Q字D定义:</div><div>    action: hcd getQ?创徏ID Q? monitorQ监?/div><div>    rule_name: 规则名字Q?由服务端定义</div><div>    app_name : 应用名或命名I间 Q?客户端自定义Qrule_name和app_name一起决定生成ID的唯一?/div><div>    salt :  自定义参?Q可选项 Q?/div><div>    seq : 自定义参敎ͼ可选项Q原栯?br />    例如:<br />    创徏IDh:  {"action":"get","rule_name":"o2o","app_name":"test"}</div><div>    响应Q{"code":0,"message":"success","data":"505140001"}</div><div></div><div>    监控hQ{"action":"monitor","rule_name":"o2o","app_name":"test"}</div><div>    响应Q{"code":0,"message":"ok","data":{"counter":3,"node_offset":1}}</div><div></div><div>性能</div>    id服务器用c++实现Q性能试做的比较单,因ؓ性能不是id服务的主要关注点Q?单以php为客Lq行试?br />    4个phpq发q程Q每个进E不停发?0万个hQ测试结果:<div><div>    total:200000 fail:0 min:0.000214 max:0.087330 avg:0.000393</div><div>    total:200000 fail:0 min:0.000215 max:0.087129 avg:0.000391</div><div>    total:200000 fail:0 min:0.000221 max:0.087252 avg:0.000391</div><div>    total:200000 fail:0 min:0.000218 max:0.087484 avg:0.000391<br />    说明  min : 最耗时(U? max : 最大耗时(U? avg : q_耗时(U?<br />    服务器TPS辑ֈq??U时Q^均gq在0.3毫秒?br /><br />l过在生产环境用,q行E_Q现在将整个pȝ开源出来,Ƣ迎试用Q有M意见和徏议欢q反馈到lxyfirstQ?63.com ?br /><div>目源代码位|?: https://github.com/lxyfirst/id_server<br /><br />版本更新9.19<br />1.增加数据落地的预保存和批量保存机Ӟ一斚w减少数据库压力,一斚w增加异步保存的可靠性?br />2.׃ȝE和数据库线E只需要传递sql语句Q将U程间通信由pipe方式改ؓeventfd + lockfree queue方式?/div></div></div><img src ="http://m.shnenglu.com/lxyfirst/aggbug/211854.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/lxyfirst/" target="_blank">star</a> 2015-09-17 14:09 <a href="http://m.shnenglu.com/lxyfirst/archive/2015/09/17/211854.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用svn理svn账号和权?/title><link>http://m.shnenglu.com/lxyfirst/archive/2014/05/23/207063.html</link><dc:creator>star</dc:creator><author>star</author><pubDate>Fri, 23 May 2014 03:03:00 GMT</pubDate><guid>http://m.shnenglu.com/lxyfirst/archive/2014/05/23/207063.html</guid><wfw:comment>http://m.shnenglu.com/lxyfirst/comments/207063.html</wfw:comment><comments>http://m.shnenglu.com/lxyfirst/archive/2014/05/23/207063.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/lxyfirst/comments/commentRss/207063.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/lxyfirst/services/trackbacks/207063.html</trackback:ping><description><![CDATA[svn的̎号和权限理是基于文件的Q修Ҏ需要更新到服务器,多有不便Q可利用svn理账号和权限,利用svn的pos-commit 钩子监测账号和权限文件变化,多个库可׃n同一账号和权限文件?br /><br /><span style="font-size: 13px; background-color: #eeeeee;">/home/svn/conf/目录下存放了多个库共用的passwd和authz文gQ用来控制这些库的̎号和讉K权限Q?/span>独立的svn_admin库中存放对应的passwd和authz文gQ有更新时自动同步到/home/svn/conf/下?br />svn_admin库的post-commit 脚本如下:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->REPOS="$1"<br />REV="$2"<br />FILE_DIR="/home/svn/conf"<br />UPDATE_FILE_LIST="passwd authz"<br /><br /><br /><span style="color: #0000FF; ">for</span> FILENAME <span style="color: #0000FF; ">in</span> $UPDATE_FILE_LIST ; <span style="color: #0000FF; ">do</span><br />    <span style="color: #0000FF; ">if</span> svnlook changed $REPOS -r $REV |grep $FILENAME >/dev/<span style="color: #0000FF; ">null</span> ; then<br />        DST_FILE=$FILE_DIR/$FILENAME<br />        mv $DST_FILE $DST_FILE.old                       <br />        svnlook cat $REPOS $FILENAME > $DST_FILE<br />    fi<br />done</div><img src ="http://m.shnenglu.com/lxyfirst/aggbug/207063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/lxyfirst/" target="_blank">star</a> 2014-05-23 11:03 <a href="http://m.shnenglu.com/lxyfirst/archive/2014/05/23/207063.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>twemproxy(nutcracker)源代码简要分?/title><link>http://m.shnenglu.com/lxyfirst/archive/2014/03/09/206112.html</link><dc:creator>star</dc:creator><author>star</author><pubDate>Sun, 09 Mar 2014 05:42:00 GMT</pubDate><guid>http://m.shnenglu.com/lxyfirst/archive/2014/03/09/206112.html</guid><wfw:comment>http://m.shnenglu.com/lxyfirst/comments/206112.html</wfw:comment><comments>http://m.shnenglu.com/lxyfirst/archive/2014/03/09/206112.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/lxyfirst/comments/commentRss/206112.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/lxyfirst/services/trackbacks/206112.html</trackback:ping><description><![CDATA[<div>twemproxy(nutcracker)是twitter实现的开源memcached和redis代理Q主要功能是Ҏkey分发h到后端的memcached和redis服务器,化memcached和redis集群服务的实现?br />Z对twemproxy实现机制的好奇,要阅M代码Q特别是|络处理部分Q一般这部分是网l服务器的核心,q里记录下其代码实现逻辑和发现的问题?br /><br />twemproxy作ؓ代理服务器,M逻辑都围l着数据{Q采用了单线E非d模型Q在linux下由epoll驱动整个E序的运行,对于事g驱动模块的封装在event目录下,event_base对象是引擎,conn对象是具体的q接Qconn对象中定义一pd事g处理的回调函敎ͼ典型的reactor机制Qlinux下的实现文g是nc_epoll.c ?nbsp;<br />事g引擎模块使用了两层回调机Ӟ event_base上有个基本的回调函数Q这个回调函数进一步调用conn对象的相应回调函? Q注Q一般直接用conn的回调也够了)?br />面向客户端的conn回调Q?br /><div>        conn->recv = msg_recv;</div><div>        conn->recv_next = req_recv_next;</div><div>        conn->recv_done = req_recv_done;</div><div></div><div>        conn->send = msg_send;</div><div>        conn->send_next = rsp_send_next;</div><div>        conn->send_done = rsp_send_done;</div><div></div><div>        conn->close = client_close;</div><div>        conn->active = client_active;<br /><br /><div>        conn->enqueue_outq = req_client_enqueue_omsgq;</div><div>        conn->dequeue_outq = req_client_dequeue_omsgq;</div>面向后端memcached和redis的conn回调Q?/div><div>        conn->recv = msg_recv;</div><div>        conn->recv_next = rsp_recv_next;</div><div>        conn->recv_done = rsp_recv_done;</div><div></div><div>        conn->send = msg_send;</div><div>        conn->send_next = req_send_next;</div><div>        conn->send_done = req_send_done;</div><div></div><div>        conn->close = server_close;</div><div>        conn->active = server_active;</div><div></div><div>        conn->enqueue_inq = req_server_enqueue_imsgq;</div><div>        conn->dequeue_inq = req_server_dequeue_imsgq;</div><div>        conn->enqueue_outq = req_server_enqueue_omsgq;</div><div>        conn->dequeue_outq = req_server_dequeue_omsgq;<br /></div>twemproxy面向客户端时Q由proxy_accept接收q接Q创建客Lconn对象Qƈ其加入C件引擎中?br />twemproxy面向后端Ӟ由server_pool理各个到后端的conn对象Q同样会加入C件引擎中?br /><br />在请求处理模块有2个主要的概念?mbuf对象和msg对象Qmbuf对象是数据缓冲区Q发送和接收的数据都存放在mbuf中, 采用铑ּ理。msg对象是具体的逻辑hQ采用链式管理,形成h/响应队列。请求和响应的处理模块分别在nc_request.c和nc_response.c中实现?br /><br />客户端连接的处理逻辑Q?br /><br /><div>    core_recv </div><div>        conn->recv        即msg_recv Qread事g处理</div><div>            conn->recv_next           即req_recv_next Q获得msg对象Q没有则创徏</div><div>            msg_recv_chain             创徏mbuf对象Q接收ƈ处理数据</div><div>                  [create mbuf]</div><div>                  conn_recv       真正的read数据</div><div>                  msg_parse      解析 Q?mbuf->msg</div><div>                       msg_parsed   解析完成</div><div>                           conn->recv_done   即req_recv_done    </div><div>                               req_filter        qo器,暂无操作</div><div>                               req_forward    分发h</div><div>                                   server_pool_conn Ҏkey获得后端conn对象</div><div>                                   s_conn加入写事件监控,msg加入转发队列Q可写事件被触发后{发队列内h</div><div>                                   s_conn->enqueue_inq req_server_enqueue_imsgq</div><div> </div><div>                  conn->recv_next      即req_recv_nextQl下一?/div><br />注:从代码实现看回调逻辑的层ơ性不强,收发数据攑օmbuf列表Q然后用writev处理Q在遇到发送不完时q要拆分mbufQ重新组liovecQ实C有些复杂?br />另外conn对象的数据采用一ơ读/写完的方式处理,在高压力下可能会产生大量的mbuf对象?br /><br />未完待箋?br /></div><img src ="http://m.shnenglu.com/lxyfirst/aggbug/206112.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/lxyfirst/" target="_blank">star</a> 2014-03-09 13:42 <a href="http://m.shnenglu.com/lxyfirst/archive/2014/03/09/206112.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用libdrizzle实现mysql代理服务器的问题及优?/title><link>http://m.shnenglu.com/lxyfirst/archive/2014/01/07/205212.html</link><dc:creator>star</dc:creator><author>star</author><pubDate>Tue, 07 Jan 2014 02:07:00 GMT</pubDate><guid>http://m.shnenglu.com/lxyfirst/archive/2014/01/07/205212.html</guid><wfw:comment>http://m.shnenglu.com/lxyfirst/comments/205212.html</wfw:comment><comments>http://m.shnenglu.com/lxyfirst/archive/2014/01/07/205212.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/lxyfirst/comments/commentRss/205212.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/lxyfirst/services/trackbacks/205212.html</trackback:ping><description><![CDATA[q期目需要一个mysql代理服务器,实现mysql协议代理和\由功能,形成单的mysql集群服务。现成的开源方案是mysql-proxy Q?分析功能和源代码后发现跟我们的应用场景不太匹配,于是军_重新实现一个符合需求的mysql代理服务器,考虑到需要完支持mysql协议Q优先选择了libdrizzle库, libdrizzle是开源项目drizzle中的协议库,而drizzle可以看作mysql的分支版本,目前E_版本?.1.36 Q?下面主要是记录用libdrizzle中遇到的一些问题?br /> <span style="font-size: 10.5pt; font-family: 宋体;">1. 关于nonblock模式的问题,C应用服务器典型架构一般是使用reactor/proactor模式的事仉动模型,如何把libdrizzle和应用服务器的驱动模型很好的l合h其重要Q?nbsp;</span><span style="font-size: 10.5pt; font-family: 宋体;">libdrizzle支持nonblock模式Q独立实C事g驱动机制Q用poll监控|络事gQ具体在drizzle_con_wait()中实玎ͼ然后通过drizzle_con_ready()遍历产生事g的网l连接,即drizzle_con_st对象Q该接口难以与通常的网l事仉动机刉合用,性能也不太理惻I具体用法可参见其自带的样例程序examples/client.cc , 也就是说libdrizzle的驱动模型需要重新封装成跟应用服务器相匹配,才能真正发挥nonblock模式的性能?br /></span><span style="font-size: 10.5pt; font-family: 宋体;"><br />2. drizzle_result_st<font face="宋体">对象初始时一些内部数据没有初始化Q容易造成E序崩溃Q因此需要修Ҏ造函敎ͼ初始化所有内部数据。涉及文?/font><font face="Times New Roman">libdrizzle-2.0/structs.h </font><font face="宋体">?/font></span><span style="font-size: 10.5pt; font-family: 宋体;">相应字段为field, field_buffer,row ?br /><br /> </span> <p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.5000pt; font-family:'宋体'; ">3. libdrizzle<font face="宋体">中运行时产生的内部对象都以双链表形式挂接在其上对象中,例如</font><font face="Times New Roman">drizzle_st</font><font face="宋体">对象中有个双链表l护其创建的</font><font face="Times New Roman">drizzle_con_st</font><font face="宋体">对象Q类似地Q?/font><font face="Times New Roman">drizzle_con_st</font><font face="宋体">对象中有个双链表l护其创建的</font><font face="Times New Roman">drizzle_result_st</font><font face="宋体">对象Q所有的对象通过q种形式U联理Q?/font></span><span style="font-family: 宋体;">q且q些对象中保存着上下文相关的状态,</span><span style="mso-spacerun:'yes'; font-size:10.5000pt; font-family:'宋体'; "><font face="宋体">q样的实现方便资源管理,防止资源泄露Q但?/font><font face="Times New Roman">代理服务?/font><font face="宋体">中,h和结果在不断转发q程中会形成大量的内存拷贝,Z减少转发q程中的内存拯Q需要把</font><font face="Times New Roman">drizzle_result_st</font><font face="宋体">昑ּ的从</font><font face="Times New Roman">drizzle_con_st</font><font face="宋体">中移除,当数据发往客户端完成后再删除,因此增加?/font><font face="Times New Roman">drizzle_result_detach()</font><font face="宋体">接口Q用于从</font><font face="Times New Roman">drizzle_con_st</font><font face="宋体">对象中移?/font><font face="Times New Roman">drizzle_result_st</font><font face="宋体">对象 Q?nbsp;涉及文g</font><font face="Times New Roman">libdrizzle-2.0/result.h , libdrizzle-2.0/result.cc </font><font face="宋体">?br /> <br /> </font></span></p> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; ">void</span> drizzle_result_detach(drizzle_result_st *result)<br /> {<br /> <br />   <span style="color: #0000FF; ">if</span> (result->con)<br />   {<br />     result->con->result_count--;<br />     <span style="color: #0000FF; ">if</span> (result->con->result_list == result)<br />       result->con->result_list= result->next;<br />   }<br /> <br />   <span style="color: #0000FF; ">if</span> (result->prev)<br />     result->prev->next= result->next;<br /> <br />   <span style="color: #0000FF; ">if</span> (result->next)<br />     result->next->prev= result->prev;<br /> <br />   result->con = NULL ;<br />   result->prev = NULL ;<br />   result->next = NULL ;<br /> }</div><img src ="http://m.shnenglu.com/lxyfirst/aggbug/205212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/lxyfirst/" target="_blank">star</a> 2014-01-07 10:07 <a href="http://m.shnenglu.com/lxyfirst/archive/2014/01/07/205212.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>keepalived配置注意事项http://m.shnenglu.com/lxyfirst/archive/2011/11/16/160237.htmlstarstarWed, 16 Nov 2011 03:11:00 GMThttp://m.shnenglu.com/lxyfirst/archive/2011/11/16/160237.htmlhttp://m.shnenglu.com/lxyfirst/comments/160237.htmlhttp://m.shnenglu.com/lxyfirst/archive/2011/11/16/160237.html#Feedback0http://m.shnenglu.com/lxyfirst/comments/commentRss/160237.htmlhttp://m.shnenglu.com/lxyfirst/services/trackbacks/160237.html典型双机热备配置ҎQ?br />两台机器的keepalived实例都配|成BACKUP状态,priority高的自动作ؓmaster , priority低的自动作ؓslave Q也可以priority讄为相同,先启动的作ؓmaster 。两辚w讄nopreemptQ防止出现故?>恢复q程中的再切换?br />1.在master发生故障->恢复q程中,原backup会替换ؓmaster对外服务Q当原master恢复后,一般希望原master作ؓ新backupQ以避免master的再ơ切换,可以使用nopreempt参数Q防止priority高的发v切换?br />2. 当keepalived讄为随pȝ启动自动启动Ӟ应加上一定的延迟Q防止网l或pȝ未准备好影响keepalived的状态?br />3. 当后端的RS有状?https)Ӟlvs一般需要用sh负蝲法或用持久性连接,以便同一来源的请求分发到同一RSQ当http和https的请求分发需要一致时Q可以用iptableҎ文做fmarkQ用fmark配置lvs ?br />

star 2011-11-16 11:11 发表评论
]]>
LVS配置注意事项http://m.shnenglu.com/lxyfirst/archive/2011/10/10/157974.htmlstarstarMon, 10 Oct 2011 07:55:00 GMThttp://m.shnenglu.com/lxyfirst/archive/2011/10/10/157974.htmlhttp://m.shnenglu.com/lxyfirst/comments/157974.htmlhttp://m.shnenglu.com/lxyfirst/archive/2011/10/10/157974.html#Feedback0http://m.shnenglu.com/lxyfirst/comments/commentRss/157974.htmlhttp://m.shnenglu.com/lxyfirst/services/trackbacks/157974.html   在DR或者tunnel模式下,RS需要绑定VIP以便直接报文发回客L。因此需要在RS上屏蔽网l内对VIPq行arp查询的响??br />
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

2. mtu问题
   在tunnel模式?QLD客L报文q行装Q加IPIP_后发送给RS Q?因此RS需要调整MTU大小Q预留IPIP头空_以便客户端正分包?br />
ifconfig "$OUT_DEV" mtu 1480

3.报文转发问题
    在DR或者tunnel模式下,报文直接转发到RS?br />
echo 1 > /proc/sys/net/ipv4/ip_forward

4.LD支持q接数问?br />   内核ip_vs模块的参数conn_tab_bits指定了conn表的大小Q最大ؓ20 Q支?M个连接?br />
5.LD做HA时VIP接管问题
   新LD接管故障LD的VIPӞ需要及时做arpq播Qkeepalived会自动完成,也通过arping命o查看?br />
6.LD的cpu负蝲问题
   LD的网卡Y中断(ksoftirqd)׃个cpu处理Q无法利用多核,调整软中断的smp_affinity可以改变l定的cpuQ但无法做多核负载均衡?br />   内核2.6.32之后已经支持软中断的负蝲均衡?br />   使用支持RSS的网卡,有多个队列,或者用多个网卡做bonding ?br />
  echo "alias bond0 bonding" >> /etc/modprobe.conf
  修改ifcfg-bond0 , ifcfg-ethX配置文g?br />
7. pȝ内核参数调整参?br />
net.ipv4.tcp_tw_recyle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_max_syn_backlog = 40960
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_tw_buckets = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_orphans = 40960
#net.ipv4.tcp_timestamps = 0

net.ipv4.tcp_rmem = 4194304 8388608 16777216
net.ipv4.tcp_wmem = 4194304 8388608 16777216
net.ipv4.udp_mem = 4194304 8388608 16777216
net.ipv4.udp_rmem_min = 1048576
net.ipv4.udp_wmem_min = 1048576

net.core.somaxconn = 40960
net.core.netdev_max_backlog = 40960
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
 参?http://www.austintek.com/LVS/

star 2011-10-10 15:55 发表评论
]]>
|卡负蝲均衡http://m.shnenglu.com/lxyfirst/archive/2011/08/04/152425.htmlstarstarThu, 04 Aug 2011 02:44:00 GMThttp://m.shnenglu.com/lxyfirst/archive/2011/08/04/152425.htmlhttp://m.shnenglu.com/lxyfirst/comments/152425.htmlhttp://m.shnenglu.com/lxyfirst/archive/2011/08/04/152425.html#Feedback0http://m.shnenglu.com/lxyfirst/comments/commentRss/152425.htmlhttp://m.shnenglu.com/lxyfirst/services/trackbacks/152425.html1.服务器网卡Y中断的cpu负蝲均衡?1.|卡支持RSSQReceive Side ScalingQ接收方扩展Q?2.内核支持RSS?/span>
2.|卡bonding 。多块网卡绑定同一IP地址对外提供服务Q通过bondingQ虚拟一块网卡对外提供服务?div>http://t.chinaunix.net/archiver/tid-1927269.html

star 2011-08-04 10:44 发表评论
]]>
linux上mq和socketpair的通信性能比较http://m.shnenglu.com/lxyfirst/archive/2011/08/04/152424.htmlstarstarThu, 04 Aug 2011 02:36:00 GMThttp://m.shnenglu.com/lxyfirst/archive/2011/08/04/152424.htmlhttp://m.shnenglu.com/lxyfirst/comments/152424.htmlhttp://m.shnenglu.com/lxyfirst/archive/2011/08/04/152424.html#Feedback2http://m.shnenglu.com/lxyfirst/comments/commentRss/152424.htmlhttp://m.shnenglu.com/lxyfirst/services/trackbacks/152424.html多线E系l中通知用哪U方式效率更好,在一?核Xeon 3.00GHZ的机器上Ҏ了linux下mq和socketpair通信性能Q一写线E,一ȝE,初步l论是mq胜出Qmq 46w/s Qsocketpair 40w/s ?/span>

star 2011-08-04 10:36 发表评论
]]>
典型|络模型性能比较http://m.shnenglu.com/lxyfirst/archive/2011/07/07/150386.htmlstarstarThu, 07 Jul 2011 05:24:00 GMThttp://m.shnenglu.com/lxyfirst/archive/2011/07/07/150386.htmlhttp://m.shnenglu.com/lxyfirst/comments/150386.htmlhttp://m.shnenglu.com/lxyfirst/archive/2011/07/07/150386.html#Feedback0http://m.shnenglu.com/lxyfirst/comments/commentRss/150386.htmlhttp://m.shnenglu.com/lxyfirst/services/trackbacks/150386.html

使用几个l典|络模型实现非阻塞简?/span>http服务Q部|在一?/span>4?/span>Xeon 3.00GHZ的机器上q行压力试?/span>

 

短连?/span>

长连?/span>

客户?/span>

1个线E?/span>

97%cpuQ多核分?/span>

60%cpu|卡中断

1.6w/s

q_响应旉10ms

100%cpu

15%cpu|卡软中?/span>

2.8w/s

q_响应旉7ms

100q发/客户?/span>

100wh/客户?/span>

2个客L

 

4个线E?/span>

每个U程70%cpu

99%cpu|卡中断

2.1w/s

q_响应旉9ms

每个U程100%cpu

40%cpu|卡软中?/span>

6.5w/s

q_响应旉3ms

100q发/客户?/span>

100wh/客户?/span>

2个客L

 

1?/span>leaderU程Q接受连?/span>

4?/span>workerU程Q处理请?/span>

leaderU程90%cpu

workerU程40%cpu

75%|卡中断

1.8w/s

q_响应旉10ms

leaderU程1%cpu

workerU程100%cpu

40%|卡中断

6.0w/s

q_响应旉3ms

100q发/客户?/span>

100wh/客户?/span>

2个客L

 

 

l论Q?/span>

1.       短连接中Q徏立连接是很耗费资源的?/span>

2.       长连接中Q多U程在提高处理能力方面是很有价值的Q尤其是q算量多的请求?/span>

3.       多个U程同时接受q接会造成cpu软中断的overhead?/span>



star 2011-07-07 13:24 发表评论
]]>
消息队列beanstalkd?/title><link>http://m.shnenglu.com/lxyfirst/archive/2011/06/29/149729.html</link><dc:creator>star</dc:creator><author>star</author><pubDate>Wed, 29 Jun 2011 06:43:00 GMT</pubDate><guid>http://m.shnenglu.com/lxyfirst/archive/2011/06/29/149729.html</guid><wfw:comment>http://m.shnenglu.com/lxyfirst/comments/149729.html</wfw:comment><comments>http://m.shnenglu.com/lxyfirst/archive/2011/06/29/149729.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/lxyfirst/comments/commentRss/149729.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/lxyfirst/services/trackbacks/149729.html</trackback:ping><description><![CDATA[beanstalkd源于fackbookQ是一个快速、简单的内存消息队列Q也可以开启binlogQ消息将被写入日志文Ӟ用于重启时恢复数据?br />1.消息被称作jobQ在服务器端储存在内存队列中Q具有DELAYED,READY,RESERVED,BURIED状态,状态{换图如下<br /><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000;">Here </span><span style="color: #0000ff;">is</span><span style="color: #000000;"> a picture of the typical job lifecycle:<br /><br /><br />   put            reserve               delete<br />  </span><span style="color: #000000;">-----></span><span style="color: #000000;"> [READY] </span><span style="color: #000000;">---------></span><span style="color: #000000;"> [RESERVED] </span><span style="color: #000000;">--------></span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">poof</span><span style="color: #000000;">*</span><span style="color: #000000;"><br /><br /><br /><br />Here </span><span style="color: #0000ff;">is</span><span style="color: #000000;"> a picture with more possibilities:<br /><br /><br /><br />   put with delay               release with delay<br />  </span><span style="color: #000000;">----------------></span><span style="color: #000000;"> [DELAYED] </span><span style="color: #000000;"><------------</span><span style="color: #000000;">.<br />                        </span><span style="color: #000000;">|</span><span style="color: #000000;">                   </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                        </span><span style="color: #000000;">|</span><span style="color: #000000;"> (time passes)     </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                        </span><span style="color: #000000;">|</span><span style="color: #000000;">                   </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />   put                  v     reserve       </span><span style="color: #000000;">|</span><span style="color: #000000;">       delete<br />  </span><span style="color: #000000;">-----------------></span><span style="color: #000000;"> [READY] </span><span style="color: #000000;">---------></span><span style="color: #000000;"> [RESERVED] </span><span style="color: #000000;">--------></span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">poof</span><span style="color: #000000;">*</span><span style="color: #000000;"><br />                       </span><span style="color: #000000;">^</span><span style="color: #000000;">  </span><span style="color: #000000;">^</span><span style="color: #000000;">                </span><span style="color: #000000;">|</span><span style="color: #000000;">  </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                       </span><span style="color: #000000;">|</span><span style="color: #000000;">   \  release      </span><span style="color: #000000;">|</span><span style="color: #000000;">  </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                       </span><span style="color: #000000;">|</span><span style="color: #000000;">    `</span><span style="color: #000000;">-------------</span><span style="color: #000000;">'</span><span style="color: #000000;">   |</span><span style="color: #000000;"><br /></span><span style="color: #000000;">                       </span><span style="color: #000000;">|</span><span style="color: #000000;">                      </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                       </span><span style="color: #000000;">|</span><span style="color: #000000;"> kick                 </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                       </span><span style="color: #000000;">|</span><span style="color: #000000;">                      </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                       </span><span style="color: #000000;">|</span><span style="color: #000000;">       bury           </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                    [BURIED] </span><span style="color: #000000;"><---------------</span><span style="color: #000000;">'<br /></span><span style="color: #000000;">                       </span><span style="color: #000000;">|</span><span style="color: #000000;"><br />                       </span><span style="color: #000000;">|</span><span style="color: #000000;">  delete<br />                        `</span><span style="color: #000000;">--------></span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">poof</span><span style="color: #000000;">*</span><span style="color: #000000;"><br /></span></div><br />消息支持优先U,生存旉的设|。不同状态的消息分别处于相应状态的队列中?br />2. 消息属于某个tubeQtubecM于namespace或者消息主题的概念Q消费者可以订阅一个或多个tube Q从而接收这些tube的消??br />3. beanstalkd的代码实现和协议定义很类似memcached的风根{?br /><img src ="http://m.shnenglu.com/lxyfirst/aggbug/149729.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/lxyfirst/" target="_blank">star</a> 2011-06-29 14:43 <a href="http://m.shnenglu.com/lxyfirst/archive/2011/06/29/149729.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://m.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.90key.cn" target="_blank">þþƷavӰԺ</a>| <a href="http://www.panda-pc.cn" target="_blank">þúݺɫۺ</a>| <a href="http://www.acolor.com.cn" target="_blank">þþþþþòҰ¸߳ </a>| <a href="http://www.qfzld.cn" target="_blank">ɫAVԾþþþþ</a>| <a href="http://www.lftdly.cn" target="_blank">þþþ޾Ʒ</a>| <a href="http://www.lebow01.cn" target="_blank">þùƷһ</a>| <a href="http://www.jmjrt.cn" target="_blank">þþƷۺ</a>| <a href="http://www.07sn.cn" target="_blank">XxŷʸƷþþþþ</a>| <a href="http://www.izakka.net.cn" target="_blank">ŷһþþþþþô</a>| <a href="http://www.vfqt.cn" target="_blank">þù˾Ʒ鶹</a>| <a href="http://www.travelgreece.cn" target="_blank">þóСƵ</a>| <a href="http://www.radio-qtc.com.cn" target="_blank">ҹӰþ</a>| <a href="http://www.dpbz.net.cn" target="_blank">91Ƶ91þþ</a>| <a href="http://www.by6463.cn" target="_blank">þþƷav鶹ѿ</a>| <a href="http://www.r10211.cn" target="_blank">պŷþ</a>| <a href="http://www.f7799.cn" target="_blank"> ŷ þ</a>| <a href="http://www.hongyuan88.cn" target="_blank">ɫAVԾþþþþ</a>| <a href="http://www.luckpai.cn" target="_blank">޹պŷþ</a>| <a href="http://www.shaoxingncp.cn" target="_blank">99þþþ</a>| <a href="http://www.szmry.cn" target="_blank">þerƵᆱƷ</a>| <a href="http://www.vphz.cn" target="_blank">ɫɫۺϾþҹҹ</a>| <a href="http://www.xsoczv19.cn" target="_blank">þþ</a>| <a href="http://www.lianliankan123.cn" target="_blank">ŷ޹׾þþþþþ</a>| <a href="http://www.2vc80.cn" target="_blank">Ƶþ</a>| <a href="http://www.sfttc.cn" target="_blank">þ㽶Ƶ</a>| <a href="http://www.a2302.cn" target="_blank">þһѲ</a>| <a href="http://www.tsz114.cn" target="_blank">91ƷۺϾþ㽶</a>| <a href="http://www.gm53.cn" target="_blank">˾Ʒþ</a>| <a href="http://www.eehqv.cn" target="_blank">ƷŮͬһþ</a>| <a href="http://www.xcfsfl.cn" target="_blank">99þѹƷ</a>| <a href="http://www.gpshd.cn" target="_blank">þþƷ7777</a>| <a href="http://www.3-gold.cn" target="_blank">þþƷ18</a>| <a href="http://www.bhxs.net.cn" target="_blank">޾Ʒþþþþ</a>| <a href="http://www.jvqn.cn" target="_blank">þ޾Ʒϵַ</a>| <a href="http://www.cctv-87.cn" target="_blank">ձþþҹƷ</a>| <a href="http://www.shzmxsls.cn" target="_blank">һþ㽶</a>| <a href="http://www.yunfu2.cn" target="_blank">ŷպƷþþѹۿ</a>| <a href="http://www.rainbow-city.cn" target="_blank">ɫۺϾþ</a>| <a href="http://www.jinziwan.com.cn" target="_blank">㽶þ99</a>| <a href="http://www.chipsummit.cn" target="_blank">7777þþùƷ</a>| <a href="http://www.feschain.cn" target="_blank">ҹþƷþþþ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>