<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>花开的地方</title>
	<atom:link href="http://www.bsdmap.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bsdmap.com</link>
	<description>花开，没有声音……</description>
	<lastBuildDate>Tue, 15 May 2012 13:37:27 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta3-20663</generator>
		<item>
		<title>通过信号“暂停”和“继续”进程执行</title>
		<link>http://www.bsdmap.com/2012/05/15/sigstop-sigcont/</link>
		<comments>http://www.bsdmap.com/2012/05/15/sigstop-sigcont/#comments</comments>
		<pubDate>Tue, 15 May 2012 13:34:56 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3992</guid>
		<description><![CDATA[信号SIGSTOP(19)，可以让进程“暂停”执行，而信号SIGCONT(18)可以使暂停进程“继续”执行…… 其实Ctrl-Z产生的，就是SIGSTOP信号。而fg命令，可能就是产生的SIGCONT信号。 man 7 signal 有详细描述。]]></description>
			<content:encoded><![CDATA[<p>信号SIGSTOP(19)，可以让进程“暂停”执行，而信号SIGCONT(18)可以使暂停进程“继续”执行……</p>
<p>其实Ctrl-Z产生的，就是SIGSTOP信号。而fg命令，可能就是产生的SIGCONT信号。</p>
<p>man 7 signal 有详细描述。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/05/15/sigstop-sigcont/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>快速切换内核</title>
		<link>http://www.bsdmap.com/2012/05/15/kexec/</link>
		<comments>http://www.bsdmap.com/2012/05/15/kexec/#comments</comments>
		<pubDate>Tue, 15 May 2012 13:31:48 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[kexec]]></category>
		<category><![CDATA[kexec_load]]></category>
		<category><![CDATA[快速切换内核]]></category>
		<category><![CDATA[快速重启]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3990</guid>
		<description><![CDATA[内核在2.6.13版，提供了kexec_load系统调用，RHEL的kexec-tools包提供了kexec工具，这个工具可以快速切换内核。 使用kexec切换内核的好处是，系统不必“重启”，硬件不需要POST，这样一来，速度会快不少。 另外，遇到POST过程不能自动通过的情况（需要手动按F1之类……），使用这个工具来重启系统也不错。 目前还没有发现“负作用”。]]></description>
			<content:encoded><![CDATA[<p>内核在2.6.13版，提供了<a title="kexec_load" href="http://www.kernel.org/doc/man-pages/online/pages/man2/kexec_load.2.html" target="_blank">kexec_load</a>系统调用，RHEL的kexec-tools包提供了kexec工具，这个工具可以快速切换内核。</p>
<p>使用kexec切换内核的好处是，系统不必“重启”，硬件不需要POST，这样一来，速度会快不少。</p>
<p>另外，遇到POST过程不能自动通过的情况（需要手动按F1之类……），使用这个工具来重启系统也不错。</p>
<p>目前还没有发现“负作用”。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/05/15/kexec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>了解CPU</title>
		<link>http://www.bsdmap.com/2012/05/14/about-cpu-2/</link>
		<comments>http://www.bsdmap.com/2012/05/14/about-cpu-2/#comments</comments>
		<pubDate>Mon, 14 May 2012 12:50:48 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3955</guid>
		<description><![CDATA[了解Cpu View more presentations from Feng Yu 上周听了褚霸的《了解CPU》，受益匪浅。对褚霸此人的佩服，又加深一层…… 他的“成功”事迹，正验证了那句技术圈子里耳熟能详的话“对做的事儿了解的越深入，才能做的越好”。 这个PPT讲得近几年、当前淘宝正在使用的主流CPU的相关技术……从CPU的结构、原理的角度来讲程序的执行效率。 很多地方没有听懂，把还能记得的大概意思记录如下（总比没有强）： 第4页：多核处理器 http://baike.baidu.com/view/2219502.htm 重点：多核处理器，一般共享L3（LLC——最后一级缓存）。 第6页：一级缓存分数据缓存L1(D)和指令缓存L1(I)，并且在处理器缓存中有Cache Lines概念，当下的主流CPU的Cache Lines是64字节。注意这个Cache Lines的大小，能极大地优化程序效率，比如Nginx的代码就很注重对Cache Lines的“对齐”。 第X页：在Core之是迁移进程开稍不可忽略。在Core之间迁移进程（线程），会使Core的缓存失效……。 &#160; 更多处理器的知识见“技术手册”中的“了解CPU”一段。]]></description>
			<content:encoded><![CDATA[<div id="__ss_12876167" style="width: 510px;">
<p><strong style="display: block; margin: 12px 0 4px;"><a title="了解Cpu" href="http://www.slideshare.net/mryufeng/cpu-12876167" target="_blank">了解Cpu</a></strong> <object id="__sse12876167" width="510" height="426" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cpu-120510033355-phpapp02&amp;stripped_title=cpu-12876167&amp;userName=mryufeng" /><param name="allowscriptaccess" value="always" /><param name="allowfullscreen" value="true" /><embed id="__sse12876167" width="510" height="426" type="application/x-shockwave-flash" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=cpu-120510033355-phpapp02&amp;stripped_title=cpu-12876167&amp;userName=mryufeng" allowFullScreen="true" allowScriptAccess="always" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" /> </object></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/mryufeng" target="_blank">Feng Yu</a></div>
</div>
<p>上周听了<a title="Erlang非业余研究" href="http://blog.yufeng.info/" target="_blank">褚霸</a>的《了解CPU》，受益匪浅。对褚霸此人的佩服，又加深一层……</p>
<p>他的“成功”事迹，正验证了那句技术圈子里耳熟能详的话“对做的事儿了解的越深入，才能做的越好”。</p>
<p>这个PPT讲得近几年、当前淘宝正在使用的主流CPU的相关技术……从CPU的结构、原理的角度来讲程序的执行效率。</p>
<p>很多地方没有听懂，把还能记得的大概意思记录如下（总比没有强）：</p>
<p>第4页：多核处理器<br />
<a href="http://baike.baidu.com/view/2219502.htm">http://baike.baidu.com/view/2219502.htm</a></p>
<p>重点：多核处理器，一般共享L3（LLC——最后一级缓存）。</p>
<p>第6页：一级缓存分数据缓存L1(D)和指令缓存L1(I)，并且在处理器缓存中有Cache Lines概念，当下的主流CPU的Cache Lines是64字节。注意这个Cache Lines的大小，能极大地优化程序效率，比如Nginx的代码就很注重对Cache Lines的“对齐”。</p>
<p>第X页：在Core之是迁移进程开稍不可忽略。在Core之间迁移进程（线程），会使Core的缓存失效……。</p>
<p>&nbsp;</p>
<p>更多处理器的知识见“<a href="http://www.bsdmap.com/tech-manual/" target="_blank">技术手册</a>”中的“了解CPU”一段。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/05/14/about-cpu-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>在线修改limits</title>
		<link>http://www.bsdmap.com/2012/05/11/kernel-2-6-32/</link>
		<comments>http://www.bsdmap.com/2012/05/11/kernel-2-6-32/#comments</comments>
		<pubDate>Fri, 11 May 2012 05:50:56 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[limits]]></category>
		<category><![CDATA[ulimit]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3949</guid>
		<description><![CDATA[2.6.32内核，允许在不重启进程的情况下，修改进程的limits限制。 假定进程的PID是n，假定我们要修改&#8221;Max open files&#8221;,那么可以这样操作： echo -n &#8220;Max open files=2048:2048&#8243;  &#62; /proc/n/limits 注意： 1. echo 必须使用-n参数 2. 后面的重定向使用&#8217;&#62;&#8217;还是&#8217;&#62;&#62;&#8217;都行。 &#160;]]></description>
			<content:encoded><![CDATA[<p>2.6.32内核，允许在不重启进程的情况下，修改进程的limits限制。</p>
<p>假定进程的PID是n，假定我们要修改&#8221;Max open files&#8221;,那么可以这样操作：</p>
<p>echo -n &#8220;Max open files=2048:2048&#8243;  &gt; /proc/n/limits</p>
<p>注意：</p>
<p>1. echo 必须使用-n参数</p>
<p>2. 后面的重定向使用&#8217;&gt;&#8217;还是&#8217;&gt;&gt;&#8217;都行。</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/05/11/kernel-2-6-32/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>网卡的工作机制</title>
		<link>http://www.bsdmap.com/2012/05/09/nic/</link>
		<comments>http://www.bsdmap.com/2012/05/09/nic/#comments</comments>
		<pubDate>Wed, 09 May 2012 13:38:05 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3945</guid>
		<description><![CDATA[每一个网卡上都有一块FIFO存储器，对于NIC（Network Interface Controller），FIFO存储器是用来通过系统总线传送数据到系统存储器之前，缓存从LAN上接收到的数据。对与快速以太网还有一个直接内存存取（DMA：Directly Memory Access）控制器，用于提供对系统存储器的可靠访问。 驱动为网卡分配一个环形缓冲区，在一段连续的物理内存中实现。 1、 数据接收 （1） 接收来自MAC的数据包，先暂存于片内FIFO接收队列； （2） 当接收器达到早期接收上线时就移至环形缓冲区； （3） 待整个数据包全部从FIFO移至缓存后，将接收状态寄存器和包长度写入接收的数据包头部，并更新CBA（Current Buffer Address）寄存器的值； （4） CMD（Command）寄存器中的BufferEmpty位和ISR（中断状态寄存器）寄存器的ROK位置1，并发出ROK的中断； （5） ISR中断调用完成后，清除ISR（ROK）并更新CAPR（Current Address of Packet Read，指向接收缓存的已读取包的地址），完成本次接收。 2、 数据发送 （1） 将待传送的数据写入主存中一段连续的缓存空间，由OS配合驱动程序完成； （2） 找到一个可用的描述器，并写入内容，包括该数据包的开始物理地址和传输状态字（包的大小、可传送下限、OWN位）； （3） OWN位有效，将数据从缓存移至片内FIFO队列； （4） 当FIFO队列中的数据达到早期传送下限，NIC的传送单元就会启动，将数据顺序输出至线路； （5） 当整个数据包都已经传至FIFO，OWN位置1； （6） 当整个数据包都已经传至线路上， TOK寄存器置1； （7） 当TOK（IMR）和TOK（ISR）多置1，就发出TOK中断； （8） TOK中断调用完成以后，清除TSD状态字，完成本次传送。 可以看出，网卡需要发送/接收数据，都必须以中断的方式告诉系统，系统处理中断后做出相应操作。 网卡存在一定大小的FIFO存储器，同时还有缓冲区，缓冲区是由系统以及驱动共同分配一段连续的物理内存，所有的发送/接收的数据，都必须通过FIFO已经缓冲区，只有一包数据都发送成功后，才能继续发送下一包数据。系统维护缓冲区，只有当缓冲区有空间时才会接受上层来的数据，而网卡处理数据的速率远高于接收数据的最大速率，因此在网卡上不会存在堵塞情况。 &#160; 参考： http://blog.chinaunix.net/uid-25839577-id-3035405.html]]></description>
			<content:encoded><![CDATA[<p>每一个网卡上都有一块FIFO存储器，对于NIC（Network Interface Controller），FIFO存储器是用来通过系统总线传送数据到系统存储器之前，缓存从LAN上接收到的数据。对与快速以太网还有一个直接内存存取（DMA：Directly Memory Access）控制器，用于提供对系统存储器的可靠访问。</p>
<p>驱动为网卡分配一个环形缓冲区，在一段连续的物理内存中实现。</p>
<p>1、 数据接收<br />
（1） 接收来自MAC的数据包，先暂存于片内FIFO接收队列；<br />
（2） 当接收器达到早期接收上线时就移至环形缓冲区；<br />
（3） 待整个数据包全部从FIFO移至缓存后，将接收状态寄存器和包长度写入接收的数据包头部，并更新CBA（Current Buffer Address）寄存器的值；<br />
（4） CMD（Command）寄存器中的BufferEmpty位和ISR（中断状态寄存器）寄存器的ROK位置1，并发出ROK的中断；<br />
（5） ISR中断调用完成后，清除ISR（ROK）并更新CAPR（Current Address of Packet Read，指向接收缓存的已读取包的地址），完成本次接收。</p>
<p>2、 数据发送</p>
<p>（1） 将待传送的数据写入主存中一段连续的缓存空间，由OS配合驱动程序完成；<br />
（2） 找到一个可用的描述器，并写入内容，包括该数据包的开始物理地址和传输状态字（包的大小、可传送下限、OWN位）；<br />
（3） OWN位有效，将数据从缓存移至片内FIFO队列；<br />
（4） 当FIFO队列中的数据达到早期传送下限，NIC的传送单元就会启动，将数据顺序输出至线路；<br />
（5） 当整个数据包都已经传至FIFO，OWN位置1；<br />
（6） 当整个数据包都已经传至线路上， TOK寄存器置1；<br />
（7） 当TOK（IMR）和TOK（ISR）多置1，就发出TOK中断；<br />
（8） TOK中断调用完成以后，清除TSD状态字，完成本次传送。</p>
<p>可以看出，网卡需要发送/接收数据，都必须以中断的方式告诉系统，系统处理中断后做出相应操作。</p>
<p>网卡存在一定大小的FIFO存储器，同时还有缓冲区，缓冲区是由系统以及驱动共同分配一段连续的物理内存，所有的发送/接收的数据，都必须通过FIFO已经缓冲区，只有一包数据都发送成功后，才能继续发送下一包数据。系统维护缓冲区，只有当缓冲区有空间时才会接受上层来的数据，而网卡处理数据的速率远高于接收数据的最大速率，因此在网卡上不会存在堵塞情况。</p>
<p>&nbsp;</p>
<p>参考：<br />
<a href="http://blog.chinaunix.net/uid-25839577-id-3035405.html">http://blog.chinaunix.net/uid-25839577-id-3035405.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/05/09/nic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用sed时要注意的陷阱</title>
		<link>http://www.bsdmap.com/2012/05/09/sed-mv/</link>
		<comments>http://www.bsdmap.com/2012/05/09/sed-mv/#comments</comments>
		<pubDate>Wed, 09 May 2012 06:32:32 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3939</guid>
		<description><![CDATA[注意：在RHEL6上（RHEL5没有这个问题）。 使用sed时，不要用sed去编辑软link文件，因为sed编辑文件(-i)是会生临时文件的，于是软件link文件被编辑后，就变成了文件。 假如你用sed去操作/etc/rc.local时，一个陷阱出现了……(/etc/rc.local必须是指向/etc/rc.d/rc.local才有意义）。 PS: 最终确定，是RHEL的sed版本中，新增了&#8211;follow-symlinks选项，而这个选项又不是默认值，所以容易误操作。 而在RHEL5上的sed版本，会自已回避这个问题，避免错误产生。 &#160; http://www.bsdmap.com/2008/04/02/%e5%85%b3%e4%ba%8esed%e7%9a%84%e5%b0%8f%e5%8f%91%e7%8e%b0/]]></description>
			<content:encoded><![CDATA[<p>注意：在RHEL6上（RHEL5没有这个问题）。</p>
<p>使用sed时，不要用sed去编辑软link文件，因为sed编辑文件(-i)是会生临时文件的，于是软件link文件被编辑后，就变成了文件。</p>
<p>假如你用sed去操作/etc/rc.local时，一个陷阱出现了……(/etc/rc.local必须是指向/etc/rc.d/rc.local才有意义）。</p>
<p>PS:<br />
最终确定，是RHEL的sed版本中，新增了&#8211;follow-symlinks选项，而这个选项又不是默认值，所以容易误操作。<br />
而在RHEL5上的sed版本，会自已回避这个问题，避免错误产生。</p>
<p>&nbsp;</p>
<p><a href="http://www.bsdmap.com/2008/04/02/%e5%85%b3%e4%ba%8esed%e7%9a%84%e5%b0%8f%e5%8f%91%e7%8e%b0/">http://www.bsdmap.com/2008/04/02/%e5%85%b3%e4%ba%8esed%e7%9a%84%e5%b0%8f%e5%8f%91%e7%8e%b0/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/05/09/sed-mv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux时钟问题</title>
		<link>http://www.bsdmap.com/2012/05/07/linux-hwclock/</link>
		<comments>http://www.bsdmap.com/2012/05/07/linux-hwclock/#comments</comments>
		<pubDate>Mon, 07 May 2012 12:47:12 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[hwclock]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[ntpd]]></category>
		<category><![CDATA[ntpdate]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3933</guid>
		<description><![CDATA[/etc/localtime应该是一个文件，在RHEL6上，更是必须如此。 RHEL6对时钟的处理与RHEL5不同。 RHEL5的系统时钟，是在系统启动时——内核初始化完，由init初始化OS环境时，由/etc/rc.d/rc.sysinit从BIOS中读取到系统的，在关机时，由/etc/rc.d/halt将系统时钟写回BIOS时钟。 而RHEL6的时钟，则是由内核初始化时，从BIOS中读取的： /var/log/messages-20120506:May  5 07:35:16 hostname kernel: [    2.306873] rtc_cmos 00:03: setting system clock to 2012-05-04 23:34:14 UTC (1336174454) 在关机时，由/etc/rc.d/halt脚本将系统时钟写回BIOS。 由内核来读取时钟，就以为着，在设置系统时钟时，/etc/localtime文件指向的/usr/share/zoneinfo/Asia/Shanghai 还不可用，因为我们的/usr通常都是单独分区的，这个时候还没有挂载。所以导致系统时钟设置出错。 重现这个问题的时候，会发现一个怪圈，即每重启一次，时钟就会多差8个小时——因为设置时钟时/etc/localtime不可写，回写时钟是，/etc/localtime是能用的。一来一回，就差上了16个小时。 在RHEL5上，有一个硬件时钟是UTC时钟还是localtime时钟的问题。（这个问题是怎么来的？）Windows系统没有这个问题，Windows将“本地时钟”写入BIOS。因为BIOS时钟没有时区概念，所以当我们装的Windows系统时，进BIOS看到的时钟，总是准确的。 当我们安装的RHEL5时，假如我们在/etc/sysconfig/clock中，写入了UTC=true，那么，BIOS中的时钟是UTC时钟，与北京时钟差8个小时。当UTC= false时，BIOS中的时钟为本地时钟。 默认地，/etc/sysconfig/clock中，统一设置了UTC=false，即BIOS中的时钟是本地时钟。（这样做，也是因为担心一些附属硬件从BIOS中读取时钟，比如远程管理卡、RAID卡里，因了读取分析日志方便）。 而当使用RHEL6时，/etc/sysconfig/clock中，默认已经没有了UTC=、与ARC=的设置，而且/etc/rc.d/rc.sysinit中也没有了从BIOS读取时钟的命令，/etc/rc.d/halt中，将系统时钟写回BIOS的方式也不再去读取分析/etc/sysconfig/clock文件，即像Windows一样，统一使用系统本地时钟，将本地时钟写入BIOS。 Linux多选的时钟机制本来有些容易让人迷茫，而RHEL6统一了这一问题，统一地使用本地时钟。 另外，对/etc/localtime不建议使用link的原因，还有一个，就是这个文件在一些系统上是link，在一些系统是文件（在RHEL是文件），不同的管理员，有不同的习惯，很有可能在调整的时候，会破坏系统的zoneinfo文件。 时钟是个参照系 此处省略一万字……]]></description>
			<content:encoded><![CDATA[<p><strong>/etc/localtime应该是一个文件，在RHEL6上，更是必须如此。</strong></p>
<p>RHEL6对时钟的处理与RHEL5不同。</p>
<p>RHEL5的系统时钟，是在系统启动时——内核初始化完，由init初始化OS环境时，由/etc/rc.d/rc.sysinit从BIOS中读取到系统的，在关机时，由/etc/rc.d/halt将系统时钟写回BIOS时钟。</p>
<p>而RHEL6的时钟，则是由内核初始化时，从BIOS中读取的：<br />
/var/log/messages-20120506:May  5 07:35:16 hostname kernel: [    2.306873] rtc_cmos 00:03: setting system clock to 2012-05-04 23:34:14 UTC (1336174454)</p>
<p>在关机时，由/etc/rc.d/halt脚本将系统时钟写回BIOS。<br />
由内核来读取时钟，就以为着，在设置系统时钟时，/etc/localtime文件指向的/usr/share/zoneinfo/Asia/Shanghai 还不可用，因为我们的/usr通常都是单独分区的，这个时候还没有挂载。所以导致系统时钟设置出错。</p>
<p>重现这个问题的时候，会发现一个怪圈，即每重启一次，时钟就会多差8个小时——因为设置时钟时/etc/localtime不可写，回写时钟是，/etc/localtime是能用的。一来一回，就差上了16个小时。</p>
<p>在RHEL5上，有一个硬件时钟是UTC时钟还是localtime时钟的问题。（这个问题是怎么来的？）Windows系统没有这个问题，Windows将“本地时钟”写入BIOS。因为BIOS时钟没有时区概念，所以当我们装的Windows系统时，进BIOS看到的时钟，总是准确的。</p>
<p>当我们安装的RHEL5时，假如我们在/etc/sysconfig/clock中，写入了UTC=true，那么，BIOS中的时钟是UTC时钟，与北京时钟差8个小时。当UTC= false时，BIOS中的时钟为本地时钟。</p>
<p>默认地，/etc/sysconfig/clock中，统一设置了UTC=false，即BIOS中的时钟是本地时钟。（这样做，也是因为担心一些附属硬件从BIOS中读取时钟，比如远程管理卡、RAID卡里，因了读取分析日志方便）。</p>
<p>而当使用RHEL6时，/etc/sysconfig/clock中，默认已经没有了UTC=、与ARC=的设置，而且/etc/rc.d/rc.sysinit中也没有了从BIOS读取时钟的命令，/etc/rc.d/halt中，将系统时钟写回BIOS的方式也不再去读取分析/etc/sysconfig/clock文件，即像Windows一样，统一使用系统本地时钟，将本地时钟写入BIOS。</p>
<p>Linux多选的时钟机制本来有些容易让人迷茫，而RHEL6统一了这一问题，统一地使用本地时钟。</p>
<p>另外，对/etc/localtime不建议使用link的原因，还有一个，就是这个文件在一些系统上是link，在一些系统是文件（在RHEL是文件），不同的管理员，有不同的习惯，很有可能在调整的时候，会破坏系统的zoneinfo文件。</p>
<p><strong>时钟是个参照系</strong></p>
<p>此处省略一万字……</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/05/07/linux-hwclock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于RAID和LVM的几点新认识</title>
		<link>http://www.bsdmap.com/2012/04/13/raid-lvm-notes/</link>
		<comments>http://www.bsdmap.com/2012/04/13/raid-lvm-notes/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 10:21:59 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[mdstat]]></category>
		<category><![CDATA[RAID]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3915</guid>
		<description><![CDATA[1. RAID rebuild时，存储的I/O被消耗了不少，I/O性能变得很低。 2. 为了减少rebuild对生产的影响，可以选用空间比较小的盘。 3. DB应该选用RAID0+1。 4. LVM默认情况下，并不能提高I/O能力（不能将I/O并行化），但是LVM其实具备这样的能力： 建立LV（strip) 建立一个有2块物理盘的条带深度为64KB的LV lvcreate -L 50G -i2 -I64 -n gfslv vg0 lvcreate -l 100 -i2 -nstripelv testvg /dev/sda1:0-50 /dev/sdb1:50-100 建立LV（mirror)(默认大小512KB同步） 建立1份copy lvcreate -L 50G -m1 -n mirrorlv vg0 将Mirror的LOG放在内存里（代价是每次机器重启的时候都会执行一次同步） lvcreate -L 12MB -m1 &#8211;corelog -n ondiskmirvol bigvg 建立LV，一份数据在sda1,一份数据在sdb1 日志在sdc1 lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1 [...]]]></description>
			<content:encoded><![CDATA[<p>1. RAID rebuild时，存储的I/O被消耗了不少，I/O性能变得很低。<br />
2. 为了减少rebuild对生产的影响，可以选用空间比较小的盘。<br />
3. DB应该选用RAID0+1。<br />
4. LVM默认情况下，并不能提高I/O能力（不能将I/O并行化），但是LVM其实具备这样的能力：<br />
建立LV（strip)<br />
建立一个有2块物理盘的条带深度为64KB的LV<br />
lvcreate -L 50G -i2 -I64 -n gfslv vg0<br />
lvcreate -l 100 -i2 -nstripelv testvg /dev/sda1:0-50 /dev/sdb1:50-100</p>
<p>建立LV（mirror)(默认大小512KB同步）<br />
建立1份copy<br />
lvcreate -L 50G -m1 -n mirrorlv vg0<br />
将Mirror的LOG放在内存里（代价是每次机器重启的时候都会执行一次同步）<br />
lvcreate -L 12MB -m1 &#8211;corelog -n ondiskmirvol bigvg<br />
建立LV，一份数据在sda1,一份数据在sdb1 日志在sdc1<br />
lvcreate -L 500M -m1 -n mirrorlv vg0 /dev/sda1 /dev/sdb1 /dev/sdc1</p>
<p>5. RAID降级时，假如有盘故障，就会丢失数据。这个在使用软RAID时，要格外注意。使用mdadm建立RAID5后，总是处于“降级”状态，有一块盘在进行rebuild，要等rebuild完成，“降级”状态消失之后，RAID才能投入使用，否则存在数据丢失的危险，即使有“备盘”，也无法保证。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/04/13/raid-lvm-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 11.10使用软RAID时需要注意的一个问题</title>
		<link>http://www.bsdmap.com/2012/04/09/ubuntu-11-10-mdadm-bug/</link>
		<comments>http://www.bsdmap.com/2012/04/09/ubuntu-11-10-mdadm-bug/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 11:57:58 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[软RAID]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3913</guid>
		<description><![CDATA[在Ubuntu 11.10上使用了软RAID，重启系统的时候，总是需要手动干预才能进入系统。 有两个原因，一是因为软件RAID降低后，初启过程中断，需要确认。 这个需要重新配置mdadm，重新生成initrd文件： 执行 dpkg-reconfig mdadm 其中有一步是选择“当RAID降级时，仍然启动系统”，选择yes。 另一个原因是，启动时，总是进入busybox，这个是Ubuntu 11.10的一个bug，如下文件所述： http://ubuntuforums.org/showpost.php?p=11388915&#038;postcount=18 需要修改：/usr/share/initramfs-tools/scripts/mdadm-functions 将： degraded_arrays() { mdadm --misc --scan --detail --test &#62;/dev/null 2&#62;&#38;1 return $((! $?)) } 添加一行，改为： degraded_arrays() { udevadm settle mdadm --misc --scan --detail --test >/dev/null 2>&#038;1 return $((! $?)) } 然后，重新生成initrd： update-initramfs -u]]></description>
			<content:encoded><![CDATA[<p>在Ubuntu 11.10上使用了软RAID，重启系统的时候，总是需要手动干预才能进入系统。</p>
<p>有两个原因，一是因为软件RAID降低后，初启过程中断，需要确认。</p>
<p>这个需要重新配置mdadm，重新生成initrd文件：</p>
<p>执行 dpkg-reconfig mdadm</p>
<p>其中有一步是选择“当RAID降级时，仍然启动系统”，选择yes。</p>
<p>另一个原因是，启动时，总是进入busybox，这个是Ubuntu 11.10的一个bug，如下文件所述：</p>
<p>http://ubuntuforums.org/showpost.php?p=11388915&#038;postcount=18</p>
<p>需要修改：/usr/share/initramfs-tools/scripts/mdadm-functions</p>
<p>将：</p>
<p><code><br />
degraded_arrays()<br />
{<br />
mdadm --misc --scan --detail --test &gt;/dev/null 2&gt;&amp;1<br />
return $((! $?))<br />
}<br />
</code></p>
<p>添加一行，改为：<br />
<code><br />
degraded_arrays()<br />
{<br />
        udevadm settle<br />
        mdadm --misc --scan --detail --test >/dev/null 2>&#038;1<br />
        return $((! $?))<br />
}<br />
</code><br />
然后，重新生成initrd：<br />
update-initramfs -u</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/04/09/ubuntu-11-10-mdadm-bug/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在Linux上使用无线短信猫</title>
		<link>http://www.bsdmap.com/2012/03/18/gsm-modem/</link>
		<comments>http://www.bsdmap.com/2012/03/18/gsm-modem/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 15:58:50 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[GSM]]></category>
		<category><![CDATA[GSM MODEM]]></category>
		<category><![CDATA[短信猫]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3895</guid>
		<description><![CDATA[【问题1】使用USB的还是串口设备？ 根据有使用经验的人建议，USB接口的设备在Linux上工作不稳定，可能是驱动的问题。所以建议使用串口猫，前提是，你的用于连接猫的计算机上要有串口。 【问题2】短信猫在Windows上有“开发库”、甚至是“管理软件”、“管理平台”， 却不提供Linux下的开发库，怎么使用？ 短信猫，本质上，是一个串口设备，支持AT指令集。 Linux上有一个软件叫gnokii，网址：http://www.gnokii.org/，下载安装，进行简单的配置即可使用。假如使用的是CentOS或者RHEL系统，在EPEL官方扩展仓库里有，可以使用yum安装。 【问题3】注意/dev/ttyS0的权限，gnokii-smsd服务可能会没有权限读取/dev/ttyS0设备。默认的/dev/ttyS0的权限为660，而gnokii-smsd程序以是gnokii用户运行，没有读写权限。 【问题4】需要安装的软件有：gnokii，gnokii-smsd，gnokii-smsd-mysql，三个包。其中，gnokii是必须的。gnokii-smsd则是一个守护程序，用于构建一个SMS收发平台。通过操作MySQL数据库来发送短信以及将收到的短信写入MySQL。 【问题5】给出我的配置文件的样例： [global] port = /dev/ttyS0 model = AT initlength = default connection = serial use_locking = no serial_baudrate = 9600 serial_write_usleep = 10000 handshake = software sm_retry = 1 smsc_timeout = 10 [gnokiid] bindir = /usr/sbin/ [logging] debug = off rlpdebug = off xdebug = off 【问题6】如何发送SMS? [...]]]></description>
			<content:encoded><![CDATA[<p>【问题1】使用USB的还是串口设备？<br />
根据有使用经验的人建议，USB接口的设备在Linux上工作不稳定，可能是驱动的问题。所以建议使用串口猫，前提是，你的用于连接猫的计算机上要有串口。</p>
<p>【问题2】短信猫在Windows上有“开发库”、甚至是“管理软件”、“管理平台”， 却不提供Linux下的开发库，怎么使用？<br />
短信猫，本质上，是一个串口设备，支持AT指令集。<br />
Linux上有一个软件叫gnokii，网址：<a href="http://www.gnokii.org/">http://www.gnokii.org/</a>，下载安装，进行简单的配置即可使用。假如使用的是CentOS或者RHEL系统，在EPEL官方扩展仓库里有，可以使用yum安装。</p>
<p>【问题3】注意/dev/ttyS0的权限，gnokii-smsd服务可能会没有权限读取/dev/ttyS0设备。默认的/dev/ttyS0的权限为660，而gnokii-smsd程序以是gnokii用户运行，没有读写权限。</p>
<p>【问题4】需要安装的软件有：gnokii，gnokii-smsd，gnokii-smsd-mysql，三个包。其中，gnokii是必须的。gnokii-smsd则是一个守护程序，用于构建一个SMS收发平台。通过操作MySQL数据库来发送短信以及将收到的短信写入MySQL。</p>
<p>【问题5】给出我的配置文件的样例：<br />
[global]<br />
port = /dev/ttyS0<br />
model = AT<br />
initlength = default<br />
connection = serial<br />
use_locking = no<br />
serial_baudrate = 9600<br />
serial_write_usleep = 10000<br />
handshake = software<br />
sm_retry = 1<br />
smsc_timeout = 10</p>
<p>[gnokiid]<br />
bindir = /usr/sbin/</p>
<p>[logging]<br />
debug = off<br />
rlpdebug = off<br />
xdebug = off</p>
<p>【问题6】如何发送SMS?<br />
使用gnokii命令，如下：<br />
echo &#8220;This is only a test.&#8221; | gnokii &#8211;sendsms  188xxxxxxxx</p>
<p>&nbsp;</p>
<p>比较靠谱的设备供应商：<br />
<a href="http://www.lianyisms.com/">http://www.lianyisms.com/</a></p>
<p>靠谱的软件(For Linux)：<br />
<a href="http://www.gnokii.org/">http://www.gnokii.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/03/18/gsm-modem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>redis</title>
		<link>http://www.bsdmap.com/2012/03/02/redis/</link>
		<comments>http://www.bsdmap.com/2012/03/02/redis/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 11:55:13 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[redis]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3883</guid>
		<description><![CDATA[新浪微博开放平台Redis实战 View more presentations from mysqlops]]></description>
			<content:encoded><![CDATA[<div style="width:595px" id="__ss_9806617"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/mysqlops/redis-9806617" title="新浪微博开放平台Redis实战" target="_blank">新浪微博开放平台Redis实战</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/9806617" width="595" height="497" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/mysqlops" target="_blank">mysqlops </a> </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/03/02/redis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>从apachectl脚本中学到的一个技巧</title>
		<link>http://www.bsdmap.com/2012/02/27/apachectl-bash-tips/</link>
		<comments>http://www.bsdmap.com/2012/02/27/apachectl-bash-tips/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 07:58:23 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3875</guid>
		<description><![CDATA[bash中，使用[ -z "$val" ]和[ -n "$val" ]来判断变理val（字符串）为空、不为空。 但是，有时候，我们希望排除空格以及换行符，认为val为空格或者换行符时，作为空来处理。 在/usr/sbin/apachectl中，有一段有意思的写法： # Set the maximum number of file descriptors allowed per child process. if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then $ULIMIT_MAX_FILES fi 本来，我以为这里是为了“去除空格及换行符以及不可见字符对判断的影响，但是经过几次测试，用引号引用之后，这样写与使用-z与-n来判断ULIMIT_MAX_FILES为空或不为空效果一样，空格、或者换行符，依然能影响判断结果。 看来作者这里的意思本来就是判断不为空吧。 正确的排除空格、换行符及其他不可打印字符影响的判断应该这样写： if [ x$ULIMIT_MAX_FILES != "x" ] ; then $ULIMIT_MAX_FILES fi 这样，当ULIMIT_MAX_FILES=&#8221; &#8220;或者ULIMIT_MAX_FILES=&#8217; &#8216;都不会影响得到正确的逻辑结果了（作者的逻辑并没有错，是我理解错了）。 PS：另外，这样写的一个好处是，对bash的要求低，比如可以允许/bin/sh不支持[] 的test语法。]]></description>
			<content:encoded><![CDATA[<p>bash中，使用[ -z "$val" ]和[ -n "$val" ]来判断变理val（字符串）为空、不为空。</p>
<p>但是，有时候，我们希望排除空格以及换行符，认为val为空格或者换行符时，作为空来处理。</p>
<p>在/usr/sbin/apachectl中，有一段有意思的写法：<br />
# Set the maximum number of file descriptors allowed per child process.<br />
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then<br />
    $ULIMIT_MAX_FILES<br />
fi</p>
<p>本来，我以为这里是为了“去除空格及换行符以及不可见字符对判断的影响，但是经过几次测试，用引号引用之后，这样写与使用-z与-n来判断ULIMIT_MAX_FILES为空或不为空效果一样，空格、或者换行符，依然能影响判断结果。</p>
<p>看来作者这里的意思本来就是判断不为空吧。<br />
正确的排除空格、换行符及其他不可打印字符影响的判断应该这样写：<br />
if [ x$ULIMIT_MAX_FILES != "x" ] ; then<br />
    $ULIMIT_MAX_FILES<br />
fi<br />
这样，当ULIMIT_MAX_FILES=&#8221; &#8220;或者ULIMIT_MAX_FILES=&#8217;<br />
&#8216;都不会影响得到正确的逻辑结果了（作者的逻辑并没有错，是我理解错了）。</p>
<p>PS：另外，这样写的一个好处是，对bash的要求低，比如可以允许/bin/sh不支持[] 的test语法。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/27/apachectl-bash-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I/O之WriteBack与WriteThrough</title>
		<link>http://www.bsdmap.com/2012/02/24/io-writeback-writethrough/</link>
		<comments>http://www.bsdmap.com/2012/02/24/io-writeback-writethrough/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 09:37:37 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[io]]></category>
		<category><![CDATA[WriteBack]]></category>
		<category><![CDATA[WriteThrough]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3869</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bsdmap.com/2012/02/24/io-writeback-writethrough/468px-write_back_with_write_allocation/" rel="attachment wp-att-3871"><img src="http://www.bsdmap.com/wp-content/uploads/2012/02/468px-Write_back_with_write_allocation.png" alt="" title="Write_back_with_write_allocation" width="468" height="600" class="alignnone size-full wp-image-3871" /></a></p>
<p><a href="http://www.bsdmap.com/2012/02/24/io-writeback-writethrough/445px-write_through_with_no-write_allocation/" rel="attachment wp-att-3870"><img src="http://www.bsdmap.com/wp-content/uploads/2012/02/445px-Write_through_with_no-write_allocation.png" alt="" title="Write_through_with_no-write_allocation" width="445" height="600" class="alignnone size-full wp-image-3870" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/24/io-writeback-writethrough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS Tips</title>
		<link>http://www.bsdmap.com/2012/02/23/dns-tips/</link>
		<comments>http://www.bsdmap.com/2012/02/23/dns-tips/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 02:40:30 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3848</guid>
		<description><![CDATA[1. http://www.root-servers.org/ 当前ROOT-SERVER的分布情况。 2. UDP封包，查询速度基本上都在100ms内。 3. DNS预设查询超时为5s；/etc/resolv.conf中设定的nameserver数量最多为3个； 4. 假如DNS故障，那么本地DNS解析抛异常出来的时间计算公式： tm为超时时间，默认为5s try重试次数 有一个nameserver时 : tm*(try-1) 有两个nameserver时 : tm+(ns_num*tm)*(try-1) 有三个nameserver时 : (tm+tm*2/ns_num)*try+(tm*4/ns_num)*(try-1) 注：相除时，如果 值不足 1 时取 1 ，如有小数部份取整数 调整timeout与retry于/etc/resolv.conf设定 options timeout:3 attempts:2 上述作用: 只试4次，每个３秒，以上述例子看一台，二台，三台分别最大time out为3,2,4秒 5. 查看DNS版本信息：dig @f.root-servers.net chaos txt version.bind 6. 查看BIND主机名：dig @f.root-servers.net chaos txt hostname.bind 7. bind view + ACL实现智能DNS解析 acl CN {58.14.0.0/15;}; view &#8220;CHINA&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>1. http://www.root-servers.org/ 当前ROOT-SERVER的分布情况。<br />
2. UDP封包，查询速度基本上都在100ms内。<br />
3. DNS预设查询超时为5s；/etc/resolv.conf中设定的nameserver数量最多为3个；<br />
4. 假如DNS故障，那么本地DNS解析抛异常出来的时间计算公式：</p>
<p>tm为超时时间，默认为5s<br />
try重试次数<br />
有一个nameserver时 : tm*(try-1)<br />
有两个nameserver时 : tm+(ns_num*tm)*(try-1)<br />
有三个nameserver时 : (tm+tm*2/ns_num)*try+(tm*4/ns_num)*(try-1)<br />
注：相除时，如果 值不足 1 时取 1 ，如有小数部份取整数<br />
调整timeout与retry于/etc/resolv.conf设定<br />
options timeout:3 attempts:2<br />
上述作用: 只试4次，每个３秒，以上述例子看一台，二台，三台分别最大time out为3,2,4秒</p>
<p>5. 查看DNS版本信息：dig @f.root-servers.net chaos txt version.bind<br />
6. 查看BIND主机名：dig @f.root-servers.net chaos txt hostname.bind<br />
7. bind view + ACL实现智能DNS解析<br />
acl CN {58.14.0.0/15;};<br />
view &#8220;CHINA&#8221; {<br />
    match-clients {CN;};<br />
include &#8220;/etc/namedb/view/view_china&#8221;;<br />
};<br />
view “other&#8221; {<br />
    match-clients {any;};<br />
include &#8220;/etc/namedb/view/view_other&#8221;;<br />
};</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/23/dns-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]TSO、UFO、GSO、LRO、GRO和RSS介绍</title>
		<link>http://www.bsdmap.com/2012/02/22/%e8%bd%actso%e3%80%81ufo%e3%80%81gso%e3%80%81lro%e3%80%81gro%e5%92%8crss%e4%bb%8b%e7%bb%8d/</link>
		<comments>http://www.bsdmap.com/2012/02/22/%e8%bd%actso%e3%80%81ufo%e3%80%81gso%e3%80%81lro%e3%80%81gro%e5%92%8crss%e4%bb%8b%e7%bb%8d/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 11:52:50 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[GRO]]></category>
		<category><![CDATA[GSO]]></category>
		<category><![CDATA[LRO]]></category>
		<category><![CDATA[TSO]]></category>
		<category><![CDATA[UFO]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3845</guid>
		<description><![CDATA[ethtool -k < 网络接口>，可以看到很多网络接口的offload特性，例如： $ sudo ethtool -k eth0 Offload parameters for eth0: rx-checksumming: on tx-checksumming: on scatter-gather: on tcp-segmentation-offload: on udp-fragmentation-offload: off generic-segmentation-offload: on generic-receive-offload: on large-receive-offload: off 这些offload特性都是为了提升网络收/发性能。TSO、UFO和GSO是对应网络发送，在接收方向上对应的是LRO、GRO。 TSO TSO(TCP Segmentation Offload)，是一种利用网卡对TCP数据包分片，减轻CPU负荷的一种技术，有时也被叫做 LSO (Large segment offload) ，TSO是针对TCP的，UFO是针对UDP的。如果硬件支持 TSO功能，同时也需要硬件支持的TCP校验计算和分散/聚集 (Scatter Gather) 功能。 GSO GSO(Generic Segmentation Offload)，它比TSO更通用，基本思想就是尽可能的推迟数据分片直至发送到网卡驱动之前，此时会检查网卡是否支持分片功能（如TSO、UFO）,如果支持直接发送到网卡，如果不支持就进行分片后再发往网卡。这样大数据包只需走一次协议栈，而不是被分割成几个数据包分别走，这就提高了效率。 LRO LRO(Large Receive Offload)，通过将接收到的多个TCP数据聚合成一个大的数据包，然后传递给网络协议栈处理，以减少上层协议栈处理 开销，提高系统接收TCP数据包的能力。 GRO GRO(Generic Receive [...]]]></description>
			<content:encoded><![CDATA[<p>ethtool -k < 网络接口>，可以看到很多网络接口的offload特性，例如： </p>
<p>$ sudo ethtool -k eth0<br />
Offload parameters for eth0:<br />
rx-checksumming: on<br />
tx-checksumming: on<br />
scatter-gather: on<br />
tcp-segmentation-offload: on<br />
udp-fragmentation-offload: off<br />
generic-segmentation-offload: on<br />
generic-receive-offload: on<br />
large-receive-offload: off</p>
<p>这些offload特性都是为了提升网络收/发性能。TSO、UFO和GSO是对应网络发送，在接收方向上对应的是LRO、GRO。</p>
<p>TSO</p>
<p>TSO(TCP Segmentation Offload)，是一种利用网卡对TCP数据包分片，减轻CPU负荷的一种技术，有时也被叫做 LSO (Large segment offload) ，TSO是针对TCP的，UFO是针对UDP的。如果硬件支持 TSO功能，同时也需要硬件支持的TCP校验计算和分散/聚集 (Scatter Gather) 功能。</p>
<p>GSO </p>
<p>GSO(Generic Segmentation Offload)，它比TSO更通用，基本思想就是尽可能的推迟数据分片直至发送到网卡驱动之前，此时会检查网卡是否支持分片功能（如TSO、UFO）,如果支持直接发送到网卡，如果不支持就进行分片后再发往网卡。这样大数据包只需走一次协议栈，而不是被分割成几个数据包分别走，这就提高了效率。</p>
<p>LRO </p>
<p>LRO(Large Receive Offload)，通过将接收到的多个TCP数据聚合成一个大的数据包，然后传递给网络协议栈处理，以减少上层协议栈处理 开销，提高系统接收TCP数据包的能力。</p>
<p>GRO </p>
<p>GRO(Generic Receive Offload)，基本思想跟LRO类似，克服了LRO的一些缺点，更通用。后续的驱动都使用GRO的接口，而不是LRO。</p>
<p>RSS </p>
<p>RSS(Receive Side Scaling)，是一项网卡的新特性，俗称多队列。具备多个RSS队列的网卡，可以将不同的网络流分成不同的队列，再分别将这些队列分配到多个CPU核心上进行处理，从而将负荷分散，充分利用多核处理器的能力。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/22/%e8%bd%actso%e3%80%81ufo%e3%80%81gso%e3%80%81lro%e3%80%81gro%e5%92%8crss%e4%bb%8b%e7%bb%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>traffic server</title>
		<link>http://www.bsdmap.com/2012/02/21/traffic-server/</link>
		<comments>http://www.bsdmap.com/2012/02/21/traffic-server/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 12:50:18 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[traffic server]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3840</guid>
		<description><![CDATA[Rit 2011 ats View more PowerPoint from Leif Hedstrom Oscon 2010 &#8211; ATS View more PowerPoint from Leif Hedstrom Traffic server 管理员指南v1.0 View more documents from qianshi]]></description>
			<content:encoded><![CDATA[<div style="width:595px" id="__ss_7747715"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/zwoop/rit-2011-ats" title="Rit 2011 ats" target="_blank">Rit 2011 ats</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/7747715" width="595" height="497" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank">PowerPoint</a> from <a href="http://www.slideshare.net/zwoop" target="_blank">Leif Hedstrom</a> </div>
</p></div>
<div style="width:595px" id="__ss_5106972"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/zwoop/oscon-2010-5106972" title="Oscon 2010 - ATS" target="_blank">Oscon 2010 &#8211; ATS</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/5106972" width="595" height="497" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank">PowerPoint</a> from <a href="http://www.slideshare.net/zwoop" target="_blank">Leif Hedstrom</a> </div>
</p></div>
<div style="width:572px" id="__ss_5654475"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/hitkidnil/traffic-serverv10-5654475" title="Traffic server 管理员指南v1.0" target="_blank">Traffic server 管理员指南v1.0</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/5654475" width="572" height="612" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">documents</a> from <a href="http://www.slideshare.net/hitkidnil" target="_blank">qianshi </a> </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/21/traffic-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MyFox</title>
		<link>http://www.bsdmap.com/2012/02/21/myfox/</link>
		<comments>http://www.bsdmap.com/2012/02/21/myfox/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 06:11:50 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MyFOX]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3838</guid>
		<description><![CDATA[淘宝海量数据产品技术架构 View more PowerPoint from aleafs]]></description>
			<content:encoded><![CDATA[<div style="width:595px" id="__ss_8555080"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/aleafs/ss-8555080" title="淘宝海量数据产品技术架构" target="_blank">淘宝海量数据产品技术架构</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/8555080" width="595" height="497" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank">PowerPoint</a> from <a href="http://www.slideshare.net/aleafs" target="_blank">aleafs</a> </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/21/myfox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ssd</title>
		<link>http://www.bsdmap.com/2012/02/21/ssd/</link>
		<comments>http://www.bsdmap.com/2012/02/21/ssd/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 06:11:29 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ssd]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3836</guid>
		<description><![CDATA[SSD在淘宝的应用实践 View more PowerPoint from Feng Yu]]></description>
			<content:encoded><![CDATA[<div id="__ss_10666599" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="SSD在淘宝的应用实践" href="http://www.slideshare.net/mryufeng/ssd-10666599" target="_blank">SSD在淘宝的应用实践</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/10666599" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank">PowerPoint</a> from <a href="http://www.slideshare.net/mryufeng" target="_blank">Feng Yu</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/21/ssd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>缓存</title>
		<link>http://www.bsdmap.com/2012/02/20/cache/</link>
		<comments>http://www.bsdmap.com/2012/02/20/cache/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 08:26:15 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[缓存]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3823</guid>
		<description><![CDATA[缓存技术浅谈 View more PowerPoint from Robbin Fan HTTP&#8217;s Best-Kept Secret: Caching View more presentations from rtomayko Scaling Your Cache And Caching At Scale View more presentations from Alex Miller Web开发中的缓存 View more presentations from jeffz Scaling with memcached View more presentations from acme 微博cache设计谈 View more presentations from Tim Y Stupid Web Caching Tricks View [...]]]></description>
			<content:encoded><![CDATA[<div id="__ss_5275090" style="width: 595px;">
<p><strong style="display: block; margin: 12px 0 4px;"><a title="缓存技术浅谈" href="http://www.slideshare.net/robbinfan/ss-5275090" target="_blank">缓存技术浅谈</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/5275090" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank">PowerPoint</a> from <a href="http://www.slideshare.net/robbinfan" target="_blank">Robbin Fan</a></div>
</div>
<div id="__ss_1413033" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="HTTP's Best-Kept Secret: Caching" href="http://www.slideshare.net/rtomayko/https-bestkept-secret-caching" target="_blank">HTTP&#8217;s Best-Kept Secret: Caching</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/1413033" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/rtomayko" target="_blank">rtomayko</a></div>
</div>
<div id="__ss_2531683" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="Scaling Your Cache And Caching At Scale" href="http://www.slideshare.net/alexmiller/scaling-your-cache-and-caching-at-scale" target="_blank">Scaling Your Cache And Caching At Scale</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/2531683" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/alexmiller" target="_blank">Alex Miller</a></div>
</div>
<div id="__ss_2026379" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="Web开发中的缓存" href="http://www.slideshare.net/jeffz/web-2026379" target="_blank">Web开发中的缓存</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/2026379" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/jeffz" target="_blank">jeffz</a></div>
</div>
<div id="__ss_101217" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="Scaling with memcached" href="http://www.slideshare.net/acme/scaling-with-memcached" target="_blank">Scaling with memcached</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/101217" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/acme" target="_blank">acme</a></div>
</div>
<div id="__ss_4842490" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="微博cache设计谈" href="http://www.slideshare.net/iso1600/cache-4842490" target="_blank">微博cache设计谈</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/4842490" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/iso1600" target="_blank">Tim Y</a></div>
</div>
<div id="__ss_4591881" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="Stupid Web Caching Tricks" href="http://www.slideshare.net/mnot/stupid-web-caching-tricks" target="_blank">Stupid Web Caching Tricks</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/4591881" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/mnot" target="_blank">Mark Nottingham</a></div>
</div>
<div id="__ss_1218991" style="width: 595px;"><strong style="display: block; margin: 12px 0 4px;"><a title="手机之家新系统介绍及架构分享" href="http://www.slideshare.net/Fenng/ss-1218991" target="_blank">手机之家新系统介绍及架构分享</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/1218991" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="595" height="497"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank">PowerPoint</a> from <a href="http://www.slideshare.net/Fenng" target="_blank">Dahui Feng</a></div>
</div>
<p><a href="http://www.slideshare.net/search/slideshow?searchfrom=header&#038;q=cache">http://www.slideshare.net/search/slideshow?searchfrom=header&#038;q=cache</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/20/cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flushcache</title>
		<link>http://www.bsdmap.com/2012/02/20/flushcache/</link>
		<comments>http://www.bsdmap.com/2012/02/20/flushcache/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 07:32:26 +0000</pubDate>
		<dc:creator>洪川</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[flushcache]]></category>

		<guid isPermaLink="false">http://www.bsdmap.com/?p=3820</guid>
		<description><![CDATA[开源混合存储方案(Flashcache) View more PowerPoint from Feng Yu http://rdc.taobao.com/blog/cs/?p=1249]]></description>
			<content:encoded><![CDATA[<div id="__ss_7321715" style="width: 510px;">
<p><strong style="display: block; margin: 12px 0 4px;"><a title="开源混合存储方案(Flashcache)" href="http://www.slideshare.net/mryufeng/flashcache" target="_blank">开源混合存储方案(Flashcache)</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/7321715" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="510" height="426"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/thecroaker/death-by-powerpoint" target="_blank">PowerPoint</a> from <a href="http://www.slideshare.net/mryufeng" target="_blank">Feng Yu</a></div>
</div>
<p><a title="混合存储中Flashcache使用的误区以及解决方案" href="http://rdc.taobao.com/blog/cs/?p=1249" target="_blank">http://rdc.taobao.com/blog/cs/?p=1249</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bsdmap.com/2012/02/20/flushcache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

