<?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>季节不曾为我赶路SorryDreams的Blog &#187; 技术</title>
	<atom:link href="http://blog.frompku.com/category/%e6%8a%80%e6%9c%af/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.frompku.com</link>
	<description>关注互联网和电影的独立博客</description>
	<lastBuildDate>Wed, 09 Nov 2011 06:58:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
  <link>http://blog.frompku.com</link>
  <url>http://blog.frompku.com/</url>
  <title>季节不曾为我赶路SorryDreams的Blog</title>
</image>
		<item>
		<title>HK主机上线后该做的事情</title>
		<link>http://blog.frompku.com/2011/05/hk%e4%b8%bb%e6%9c%ba%e4%b8%8a%e7%ba%bf%e5%90%8e%e8%af%a5%e5%81%9a%e7%9a%84%e4%ba%8b%e6%83%85.html</link>
		<comments>http://blog.frompku.com/2011/05/hk%e4%b8%bb%e6%9c%ba%e4%b8%8a%e7%ba%bf%e5%90%8e%e8%af%a5%e5%81%9a%e7%9a%84%e4%ba%8b%e6%83%85.html#comments</comments>
		<pubDate>Wed, 25 May 2011 03:23:44 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[yculer]]></category>
		<category><![CDATA[歪酷人]]></category>
		<category><![CDATA[香港主机]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=741</guid>
		<description><![CDATA[香港主机上线，请关注 Yculer 的官方博客：http://blog.yculer.com
更多细节不在这里赘述。我这里只是简单说明一下香港服务器上线过程中的“亮点”。
1 首次采用Cloudlinux，一个商业版的linux发行版... ]]></description>
			<content:encoded><![CDATA[<p>香港主机上线，请关注 Yculer 的官方博客：<a href="http://blog.yculer.com" target="_blnak">http://blog.yculer.com</a></p>
<p>更多细节不在这里赘述。我这里只是简单说明一下香港服务器上线过程中的“亮点”。<br />
1 首次采用Cloudlinux，一个商业版的linux发行版，这样我们实现了比以往更好的资源控制。以实际例子来说，某个用户的网站程序有问题，导致cpu资源的消耗很快上升到上限，如果放在以前，我们很快就会发现服务器负载上升到影响正常网站载入，不得不挂起该名用户的帐号，然而实际结果是负载保持在1，丝毫不影响其他用户的网站的访问。这种隔离技术令人耳目一新。<br />
2 继续采用LiteSpeed，一个商业版的webserver，在性能端和可用性上依然给了我很深的印象。<br />
3 采用了一台香港的vps，储存香港主机的数据备份。我们有其他的备份空间，但在美国。众所周知香港的国际带宽价格昂贵，为此选择了香港本地的空间，这样异地备份需要消耗的本地带宽不会影响用户使用国际带宽。<br />
<span id="more-741"></span><br />
HK主机上线后该做的事情，或者说我认为和决定去做的有：<br />
1 wiki计划。事实上文档建设理应是 Yculer 的强项，而 wiki 网站事实上在4月份就已经“秘密”上线。依然有很多包括图片在内的内容需要充实。<br />
2 xhtml 标准化和前台 UI 整合计划。在经过慎重的考虑后，我决定整合几个重要的前台：官方网站、会员中心、博客、wiki和status服务器状态。首先要做的是对 xhtml+css 规范化，使它符合 <span class='wp_keywordlink'><a href="http://w3.org/" rel="external nofollow">w3c</a></span> 的标准——我正在考虑是否在将来开源我们博客和status或者更多的 theme ,而如果开源的话，自然语言要写的优美些。。。即使最终不开源，这也是一定会做的事情，因为在这方面我个人有洁癖。<br />
3 老生常谈的 logo 设计。看过几个设计，然而包括我在内的成员都不是很满意，无法达成共识。我很希望有愿意试试的朋友，当然这个是有偿的。<br />
4 我正在考虑释出适合大流量网站的解决方案：varnish+nginx+apache,因为无论是lnmp也好，lnamp也好，都不能令人满意。唯一令人满意的Litespeed不是开源的。这会是一项长期工作。</p>
<p>此外，在香港服务器 Vega 上线以后的相当长一段时间内，Yculer 不会再上线新的主机。在这里可以透露的是，我们一直把 Yculer 看做一项半盈利的事业，对 WPG 和 cnFrag 等博客群体的赞助是长期性质的。事实上我们一直处于保本和微利的状态，把服务器的负载维持在业内很低的水平，我们希望吸引的是使用2年及以上，和我们共同成长的用户，在香港主机上线后，未来将有一段时间需要我们去消化成本。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2011/04/%e9%a6%99%e6%b8%af%e4%b8%bb%e6%9c%ba%e5%92%8c%e7%be%8e%e5%9b%bd%e4%b8%bb%e6%9c%ba%e4%b9%8b%e9%97%b4%e7%9a%84%e9%80%89%e6%8b%a9.html" title="香港主机和美国主机之间的选择">香港主机和美国主机之间的选择</a></li><li><a href="http://blog.frompku.com/2009/12/yculer%e4%b9%89%e5%8d%96%e4%b8%bb%e6%9c%ba%ef%bc%8c%e6%94%af%e6%8c%81wpg.html" title="Yculer义卖主机，支持WPG">Yculer义卖主机，支持WPG</a></li><li><a href="http://blog.frompku.com/2009/10/yculer%e6%ad%aa%e9%85%b7%e4%ba%ba%e6%98%af%e8%b0%81%ef%bc%9f.html" title="Yculer歪酷人是谁？">Yculer歪酷人是谁？</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2011/05/hk%e4%b8%bb%e6%9c%ba%e4%b8%8a%e7%ba%bf%e5%90%8e%e8%af%a5%e5%81%9a%e7%9a%84%e4%ba%8b%e6%83%85.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>香港主机和美国主机之间的选择</title>
		<link>http://blog.frompku.com/2011/04/%e9%a6%99%e6%b8%af%e4%b8%bb%e6%9c%ba%e5%92%8c%e7%be%8e%e5%9b%bd%e4%b8%bb%e6%9c%ba%e4%b9%8b%e9%97%b4%e7%9a%84%e9%80%89%e6%8b%a9.html</link>
		<comments>http://blog.frompku.com/2011/04/%e9%a6%99%e6%b8%af%e4%b8%bb%e6%9c%ba%e5%92%8c%e7%be%8e%e5%9b%bd%e4%b8%bb%e6%9c%ba%e4%b9%8b%e9%97%b4%e7%9a%84%e9%80%89%e6%8b%a9.html#comments</comments>
		<pubDate>Mon, 18 Apr 2011 07:51:09 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[yculer]]></category>
		<category><![CDATA[歪酷人]]></category>
		<category><![CDATA[美国主机]]></category>
		<category><![CDATA[香港主机]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=739</guid>
		<description><![CDATA[自上次写关于主机的文章已经有一段时间了，是我稍感意外的是最近仍然遇到一些因为我写过的文章而选择 Yculer 歪酷人的朋友。再次感谢你们的信任与厚爱。
现在看之前的文章，我认为之前... ]]></description>
			<content:encoded><![CDATA[<p>自上次写关于主机的文章已经有一段时间了，是我稍感意外的是最近仍然遇到一些因为我写过的文章而选择 Yculer 歪酷人的朋友。再次感谢你们的信任与厚爱。</p>
<p>现在看之前的文章，我认为之前自己对主机——主要是美国主机的种种认识基本上还是准确的。我对自己设定的高压线中的一条，是绝不能对同行有负面的评价——有时候即使面对一些人对 Yculer 的恶意评价和抄袭，我也能保持一贯的心平气和。如果不是因为空闲时间太少，我很愿意和朋友们有更多的合作。<br />
<span id="more-739"></span><br />
现在Yculer正在为WPG、Wpoak、cnFrag提供长期的主机托管服务。虽然已经不再是单纯的博客主机，但其实我们仍然在不断努力，寻求为更多喜欢写博客的朋友们提供一个稳定的写作环境。</p>
<p>说这么多可能略有跑题。过去我们一直是立足于美国主机，原因有很多，相比较国内的内容审查制度更宽松的言论，更低的带宽成本使我们有能力为大家提供性价比的主机托管方案，依靠成熟的商业软件保持服务器的稳定在线率等等。</p>
<p>然而现在有一些事情在迫使我考虑把下一步的重点从美国转到香港。主要是出于两点考虑:<br />
一是美国主机正在被恶意价格竞争所摧毁。<br />
二是中国到美国带宽本身正变得越来越拥挤，“抽风”的频率越来越频繁。</p>
<p>当然香港主机也并非完美，缺点正对应美国主机的优点：<br />
一是软硬件整体成本较高<br />
二是带宽成本昂贵，1Mbps的价格差不多需要800元人民币（每月），同样的价格在美国可以买到10倍以上的资源。</p>
<p>根据一个简单的成本测算，需要付出至少5倍以上的投入，才可能获得和美国主机相当的资源保障（主要是流量），而我们的已有客户，应该不会接受5倍的价格。所以一个合理的定价是美国主机的3倍——真的不需要太严谨的计算，就能够知道做香港主机的利润率其实比美国主机低。</p>
<p>Yculer 歪酷人已经迈入第三个年头，关于未来的走向其实我有很多考虑，但有一条原则是只做我们会做和喜欢做的事情。有数百位用户信赖我本人和Yculer，我知道其中有许多朋友需要香港主机:)</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2011/05/hk%e4%b8%bb%e6%9c%ba%e4%b8%8a%e7%ba%bf%e5%90%8e%e8%af%a5%e5%81%9a%e7%9a%84%e4%ba%8b%e6%83%85.html" title="HK主机上线后该做的事情">HK主机上线后该做的事情</a></li><li><a href="http://blog.frompku.com/2009/12/yculer%e4%b9%89%e5%8d%96%e4%b8%bb%e6%9c%ba%ef%bc%8c%e6%94%af%e6%8c%81wpg.html" title="Yculer义卖主机，支持WPG">Yculer义卖主机，支持WPG</a></li><li><a href="http://blog.frompku.com/2009/10/yculer%e6%ad%aa%e9%85%b7%e4%ba%ba%e6%98%af%e8%b0%81%ef%bc%9f.html" title="Yculer歪酷人是谁？">Yculer歪酷人是谁？</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2011/04/%e9%a6%99%e6%b8%af%e4%b8%bb%e6%9c%ba%e5%92%8c%e7%be%8e%e5%9b%bd%e4%b8%bb%e6%9c%ba%e4%b9%8b%e9%97%b4%e7%9a%84%e9%80%89%e6%8b%a9.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Apache+MPM worker+fastcgi+mysql服务器的配置实例</title>
		<link>http://blog.frompku.com/2010/06/apachempm-workerfastcgimysql%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84%e9%85%8d%e7%bd%ae%e5%ae%9e%e4%be%8b.html</link>
		<comments>http://blog.frompku.com/2010/06/apachempm-workerfastcgimysql%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84%e9%85%8d%e7%bd%ae%e5%ae%9e%e4%be%8b.html#comments</comments>
		<pubDate>Fri, 25 Jun 2010 06:16:54 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[mpm worker]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=719</guid>
		<description><![CDATA[这个配置实例是我自己摸索出来的。
服务器的生产环境是 apache+mpm worker+fastcgi。利用cpanel主机的/scripts/easyapache脚本可以很方便地安装必要的组件。但是默认安装好的配置并不能很好的运用于生... ]]></description>
			<content:encoded><![CDATA[<p>这个配置实例是我自己摸索出来的。</p>
<p>服务器的生产环境是 apache+mpm worker+fastcgi。利用cpanel主机的/scripts/easyapache脚本可以很方便地安装必要的组件。但是默认安装好的配置并不能很好的运用于生产环境，根据网站的负载不同，你可能需要手动修改一些关键的配置文件，这也正是我做的。<br />
<span id="more-719"></span><br />
MPM模块的引进是apache2.0版本开始最重大的改进之一，MPM常见的模式是prefork和worker，很奇怪，在cpanel服务器的web控制端，默认配置prefork模式，因此，如果你要使用MPM worker，需要手动修改http.conf,一个典型的prefork配置是这样的：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Consolas&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;IfModule</span> <span style="color: rgb(0, 0, 255);">prefork.c</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span></p>
<p> <span style="color: rgb(0, 0, 0);">StartServers</span> <span style="color: rgb(0, 0, 255);">5</span></p>
<p> <span style="color: rgb(0, 0, 0);">MinSpareServers</span> <span style="color: rgb(0, 0, 255);">5</span></p>
<p> <span style="color: rgb(0, 0, 0);">MaxSpareServers</span> <span style="color: rgb(0, 0, 255);">10</span></p>
<p> <span style="color: rgb(0, 0, 0);">MaxClients</span> <span style="color: rgb(0, 0, 255);">150</span></p>
<p> <span style="color: rgb(0, 0, 0);">MaxRequestsPerChild</span> <span style="color: rgb(0, 0, 255);">0</span></p>
<p> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/IfModule&gt;</span></div>
<p>prefork模式可以提高apache的并发能力，对于大内存的服务器来说是apache和cpanel官方推荐的方法，实际我用了worker模式，它对内存的使用更加经济，删掉类似上面的prefork模式，以worker模式取而代之：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Consolas&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;IfModule</span> <span style="color: rgb(0, 0, 255);">mpm_worker_module</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span><br /> <span style="color: rgb(0, 0, 0);">ServerLimit</span> <span style="color: rgb(0, 0, 255);">16</span><br /> <span style="color: rgb(0, 0, 0);">ThreadLimit</span> <span style="color: rgb(0, 0, 255);">64</span><br /> <span style="color: rgb(0, 0, 0);">StartServers</span> <span style="color: rgb(0, 0, 255);">2</span><br /> <span style="color: rgb(0, 0, 0);">MaxClients</span> <span style="color: rgb(0, 0, 255);">1024</span><br /> <span style="color: rgb(0, 0, 0);">MinSpareThreads</span> <span style="color: rgb(0, 0, 255);">64</span><br /> <span style="color: rgb(0, 0, 0);">MaxSpareThreads</span> <span style="color: rgb(0, 0, 255);">128</span><br /> <span style="color: rgb(0, 0, 0);">ThreadsPerChild</span> <span style="color: rgb(0, 0, 255);">64</span><br /> <span style="color: rgb(0, 0, 0);">MaxRequestsPerChild</span> <span style="color: rgb(0, 0, 255);">1300</span><br /> <span style="color: rgb(0, 0, 0);">ThreadStackSize</span> <span style="color: rgb(0, 0, 255);">327680</span><br /> <span style="color: rgb(0, 0, 0);">TimeOut</span> <span style="color: rgb(0, 0, 255);">60</span><br /> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/IfModule&gt;</span></div>
<p>下一步是对fastcgi的配置。fastcgi是php的一种运行模式，它最大的优点就是大大提高了php脚本的执行效率，但它的配置也是最复杂的，事实上，你应该根据网站的实际流量和服务器的现有资源，控制fastcgi的进程数，尤其要注意及时杀死空闲僵死的fastcgi进程，以收回内存。cpanel服务器的配置文件是/etc/httpd/conf/php.conf,我的配置如下：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Consolas&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 136, 0); font-style: italic;"># Fastcgi configuration for PHP5</span><br /> <span style="color: rgb(0, 0, 0);">LoadModule</span><span style="color: rgb(0, 0, 0);"> fcgid_module modules/mod_fcgid.so</span><br /> <span style="color: rgb(0, 0, 0);">MaxRequestsPerProcess</span> <span style="color: rgb(0, 0, 255);">30</span><br /> <span style="color: rgb(0, 0, 0);">ProcessLifeTime</span> <span style="color: rgb(0, 0, 255);">1200</span><br /> <span style="color: rgb(0, 0, 0);">IdleTimeout</span> <span style="color: rgb(0, 0, 255);">300</span><br /> <span style="color: rgb(0, 0, 0);">DefaultMinClassProcessCount</span> <span style="color: rgb(0, 0, 255);">2</span><br /> <span style="color: rgb(0, 0, 0);">DefaultMaxClassProcessCount</span> <span style="color: rgb(0, 0, 255);">6</span><br /> <span style="color: rgb(0, 0, 0);">IPCConnectTimeout</span> <span style="color: rgb(0, 0, 255);">30</span><br /> <span style="color: rgb(0, 0, 0);">IPCCommTimeout</span> <span style="color: rgb(0, 0, 255);">300</span></div>
<p>因为服务器的生产环境是用于虚拟主机托管，因此会产出许多（超过100不稀奇）个php（运行于fastcgi模式）的进程，以上的配置的优点是能够较好的回收内存，对有较多数量网站，而大部分的流量并不高的生产环境是一种效率和稳定性之间的折中。即使做了上述的配置，实际内存的使用也往往接近3GB。</p>
<p>因此，你可以另外通过cronjob的方法，定时杀死php进程，回收内存，比如每小时杀死一次：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Consolas&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(166, 23, 23); background-color: rgb(227, 210, 210);">0</span> <span style="color: rgb(166, 23, 23); background-color: rgb(227, 210, 210);">*</span> <span style="color: rgb(166, 23, 23); background-color: rgb(227, 210, 210);">*</span> <span style="color: rgb(166, 23, 23); background-color: rgb(227, 210, 210);">*</span> <span style="color: rgb(166, 23, 23); background-color: rgb(227, 210, 210);">*</span> ps<span style="color: rgb(0, 0, 0);"> aux | grep php | egrep -v grep | awk &#39;{print $2}&#39; | xargs kill -9</span></div>
<p>最后，是mysql的配置，数据库的配置可以是一件非常复杂的事情，不了解的人请不要照抄我的配置：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Consolas&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">mysqld</span><span style="color: rgb(0, 0, 0);">]</span><br /> <span style="color: rgb(0, 0, 0);">skip-networking</span><br /> <span style="color: rgb(0, 0, 0);">log-slow-queries</span><br /> <span style="color: rgb(0, 0, 0);">safe-show-database</span><br /> <span style="color: rgb(0, 0, 0);">local</span><span style="color: rgb(0, 0, 0);">-infile </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> 0</span><br /> <span style="color: rgb(0, 0, 0);">skip-locking</span><br /> <span style="color: rgb(0, 0, 0);">skip-name-resolve</span></p>
<p> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">key_buffer_size</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">256M</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">thread_concurrency</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">16</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">max_connections</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">200</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">table_cache</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">256</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">max_delayed_threads</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">20</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">max_tmp_tables</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">128</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">query_cache_type</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">1</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">query_cache_size</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">16M</span><br /> <span style="color: rgb(0, 0, 0);">set</span><span style="color: rgb(0, 0, 0);">-variable </span><span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">thread_cache_size</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">16</span></div>
<p>本文欢迎转载。分享知识光荣，浪费智力可耻。</p>
<h3  class="related_post_title">随机日志</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2008/03/4000%e5%85%83%e4%ba%ba%e6%b0%91%e5%b8%81%e6%9c%88%e8%96%aa%e7%9a%84%e4%ba%ba%e8%bf%87%e7%9a%84%e6%97%a5%e5%ad%90zz.html" title="4000元人民币月薪的人过的日子zz">4000元人民币月薪的人过的日子zz</a></li><li><a href="http://blog.frompku.com/2006/11/%e9%99%88%e5%8d%8e%e5%92%8c%e4%bb%96%e7%9a%84%e9%85%b7%e8%ae%af.html" title="陈华和他的酷讯">陈华和他的酷讯</a></li><li><a href="http://blog.frompku.com/2006/06/%e6%88%91%e6%98%af%e4%b8%80%e4%b8%aa%e9%9a%8f%e6%80%a7%e7%9a%84%e4%ba%ba.html" title="我是一个随性的人">我是一个随性的人</a></li><li><a href="http://blog.frompku.com/2009/03/movie-the-week-%e7%a9%ba%e4%b8%ad%e6%9d%80%e6%89%8bthe-sky-crawlers.html" title="Movie The Week 空中杀手The Sky Crawlers">Movie The Week 空中杀手The Sky Crawlers</a></li><li><a href="http://blog.frompku.com/2008/04/%e4%ba%ab%e5%8f%97%e7%94%9f%e6%b4%bb%e7%9a%84%e8%b5%90%e4%ba%88.html" title="享受生活的赐予">享受生活的赐予</a></li><li><a href="http://blog.frompku.com/2006/01/%e6%88%91%e5%96%9c%e6%ac%a2.html" title="我喜欢">我喜欢</a></li><li><a href="http://blog.frompku.com/2007/05/%e8%81%9a%e5%90%88rss%e7%9a%84wordpress%e6%8f%92%e4%bb%b6.html" title="聚合rss的wordpress插件">聚合rss的wordpress插件</a></li><li><a href="http://blog.frompku.com/2009/01/%e5%bc%ba%e5%a4%a7%e7%9a%84p2p%e9%ab%98%e5%93%81%e8%b4%a8%e9%9f%b3%e4%b9%90%e6%92%ad%e6%94%be%e5%99%a8spotify%ef%bc%9a%e6%af%94ituneslastfm%e6%9b%b4%e5%bc%ba%e5%a4%a7.html" title="强大的p2p高品质音乐播放器Spotify：比itunes+last.fm更强大">强大的p2p高品质音乐播放器Spotify：比itunes+last.fm更强大</a></li><li><a href="http://blog.frompku.com/2009/05/293.html" title="Movie The Week 彩虹女神">Movie The Week 彩虹女神</a></li><li><a href="http://blog.frompku.com/2009/07/%e7%9c%8b%e7%9c%8b%e4%ba%ba%e5%ae%b6%e5%8f%b0%e6%b9%be%e5%90%8c%e8%83%9e%e7%9a%84%e7%bd%91%e7%bb%9c.html" title="看看人家台湾同胞的网络">看看人家台湾同胞的网络</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2010/06/apachempm-workerfastcgimysql%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84%e9%85%8d%e7%bd%ae%e5%ae%9e%e4%be%8b.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>如何挑选好的主机（五）远离抽风</title>
		<link>http://blog.frompku.com/2010/06/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%94%ef%bc%89%e8%bf%9c%e7%a6%bb%e6%8a%bd%e9%a3%8e.html</link>
		<comments>http://blog.frompku.com/2010/06/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%94%ef%bc%89%e8%bf%9c%e7%a6%bb%e6%8a%bd%e9%a3%8e.html#comments</comments>
		<pubDate>Fri, 11 Jun 2010 07:21:11 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[主机]]></category>
		<category><![CDATA[抽风]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=711</guid>
		<description><![CDATA[离我上一篇“任何挑选好的主机”系列文章已经2个月。这个专栏还没有画上句号。今天要讨论的话题是资深的主机用户，主要是美国主机都很感兴趣的“网络抽风”。
前面的文章比较偏重理论... ]]></description>
			<content:encoded><![CDATA[<p>离我上一篇“任何挑选好的主机”系列文章已经2个月。这个专栏还没有画上句号。今天要讨论的话题是资深的主机用户，主要是美国主机都很感兴趣的“网络抽风”。</p>
<p>前面的文章比较偏重理论性，今天讲的话题没有什么艰涩难懂的，完全是实践经验。</p>
<p>在上一篇有关技术支持和响应时间的文章中，我曾经赞扬过“一家非常低调的主机商，在主机领域有超过10年的经验，几乎没有任何负面的评价，技术支持无可挑剔，甚至超过了我本人的期望”。<br />
<span id="more-711"></span><br />
然而我没有继续使用他们的主机——虽然我仍然很关心，并且天天都在考虑重新与他们合作——的最主要的原因，就是网络抽风。</p>
<p>没有人会愿意自己的主机时快时慢，更加没有人愿意看到刚才还能打开的自己的网站，突然间却像宕机了一样频频掉包。不过很可惜，由于网络条件的限制和其他人为因素，几乎所有使用美国主机的人都遇到过上述“网络抽风”。</p>
<p>远离抽风，你需要看清楚主机商的上游商家。</p>
<p>举例目前国内用的比较多的代理，有innohosting,hawkhost,site5(BH,DH,LP,HM这些主机就不谈了）。这三家主机商为什么有代表性，它们背后的三家机房，webnx,softlayer,the planet有代表性。</p>
<p>机房只是一个名字，代表了它能为主机商提供的价格水平、服务水平、网络条件……其中和抽风相关的，是带宽。</p>
<p>通常成熟的机房并不会采用单一的带宽。就像国内所说的多线机房，国外的机房也是“多线”。常见的线路包括level3,savvis,above.net,gloabal crossing,ntt,xo,pccw,nlayer,he,peer1,cogentco等等。</p>
<p>总之有很多。全世界的电信商都要到美国交换数据，包括中国电信，中国联通。</p>
<p>下面就以大家一般认为“非常快”的he在加州的Fremont机房为例，看看he的fremont线路到底如何：<br />
<img src="http://yculer.com/img/hefremont.jpg" alt="he@fremont" width="600" height="400"/></p>
<p>通过定时ping，获得了he在30天内的网络表现，可以看到在一个月中有超过7天，he的fremont线路会出现超过350ms的ping值。这和220ms左右的平均ping值相比，显然是非常不正常的。</p>
<p>在有限的将来，我预计HE的线路会变得更加不稳定。Yculer 歪酷人曾经短暂地租用HE的主机，向用户提供SSH代理服务，但不久就改换门庭，目的是为了获得远比HE稳定的网络支持。</p>
<p>究竟有没有不抽风的网络呢？答案是肯定的。我认为首先必须给何谓“不抽风”下一个定义。<strong>我把300ms作为是否抽风的标准，只有能保证99%的时间低于300ms，95%的时间低于250ms才能够真正称得上“不抽风”。</strong></p>
<p>在过去超过100天的时间里，<a href="http://yculer.com" target="_blank">Yculer 歪酷人</a>不抽风。你可以在这里看到<a href="http://wpg.im/bbs/thread-2597-1-1.html" target="_blank">wpg对我们的评价</a>。</p>
<p>目前我们采用的这条线路在过去的4个月中始终有稳定优异的表现。因为国内IDC行业风气不正，我不决定在这里公布ping的统计图。如果您有兴趣，可以自己使用<a href="http://jiankongbao.com/" target="_blank">监控宝</a>对ycule.com进行检测，以确定Yculer 歪酷人的稳定性是否够得上“不抽风”。</p>
<p>根据一年来的测试结果和我的经验，目前为止，真正能称得上稳定的线路凤毛麟角，美国西海岸采用 global crossing 和 PCCW 的带宽的数据中心可以一试。请注意本文的写作时间，因为随着时间的推移，上述结论可能需要修正，Yculer 歪酷人也正在不断寻找更稳定的线路。</p>
<p>另，很多数据中心不仅仅拥有gblx或pccw的带宽接入，而往往会使用其他更多带宽提供商，如果从国内访问他们的服务器，并不是通过gblx和pccw，而是通过level3或者其他经常抽的线路，那么即使它拥有gblx和pccw的带宽，对大陆用户来说也是没有意义的。你可以通过<a href="http://webkaka.com/" target="_blank">webkaka</a>的tracert工具，确认其带宽走向。</p>
<p>“授人与鱼不如授人与渔”。如果你需要远离抽风，那么必须学会这个系列文章中提到的各种检测工具，只有数据不会说假话，并给你最正确的引导。</p>
<p>To be continued</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2010/06/%e6%9c%80%e5%a4%a7%e5%92%8c%e6%9c%80%e5%a5%bd.html" title="最大和最好">最大和最好</a></li><li><a href="http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%89%ef%bc%89uptime-%e5%92%8c-tracert.html" title="如何挑选好的主机（三）Uptime 和 Tracert">如何挑选好的主机（三）Uptime 和 Tracert</a></li><li><a href="http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%8c%ef%bc%89ping-bandwidth.html" title=" 如何挑选好的主机（二）ping &#038; bandwidth"> 如何挑选好的主机（二）ping &#038; bandwidth</a></li><li><a href="http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%80%ef%bc%89%e5%bc%95.html" title="如何挑选好的主机（一）引">如何挑选好的主机（一）引</a></li><li><a href="http://blog.frompku.com/2009/08/%e6%81%af%e5%a3%a4%e5%86%8d%e6%ac%a1%e5%ae%95%e6%9c%ba.html" title="息壤再次宕机">息壤再次宕机</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2010/06/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%94%ef%bc%89%e8%bf%9c%e7%a6%bb%e6%8a%bd%e9%a3%8e.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何挑选好的主机（四）技术支持和响应时间</title>
		<link>http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e5%9b%9b%ef%bc%89%e6%8a%80%e6%9c%af%e6%94%af%e6%8c%81%e5%92%8c%e5%93%8d%e5%ba%94%e6%97%b6%e9%97%b4.html</link>
		<comments>http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e5%9b%9b%ef%bc%89%e6%8a%80%e6%9c%af%e6%94%af%e6%8c%81%e5%92%8c%e5%93%8d%e5%ba%94%e6%97%b6%e9%97%b4.html#comments</comments>
		<pubDate>Thu, 08 Apr 2010 08:33:00 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[资源]]></category>
		<category><![CDATA[售后]]></category>
		<category><![CDATA[技术支持]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=697</guid>
		<description><![CDATA[前面提到的挑选好的主机的标准，有关于快速与否的 ping 和 bandwidth，有关于稳定性的 uptime 和 tracert 路由，这些都是大家容易理解的技术指标，同样的，今天所谈的技术支持和响应时间也很容... ]]></description>
			<content:encoded><![CDATA[<p>前面提到的挑选好的主机的标准，有关于快速与否的 ping 和 bandwidth，有关于稳定性的 uptime 和 tracert 路由，这些都是大家容易理解的技术指标，同样的，今天所谈的技术支持和响应时间也很容易理解，但它的重要性却常为一般人所忽视。</p>
<p>从顾客的心理角度，当然希望主机商的技术能力越强越好，响应时间越快越好。从一个主机商的角度看，人力成本在总成本中的比重有迅速增加的趋势。就中国主机而言，硬件和带宽的成本可能要超过人力成本，而欧美主机是相反的——至少人力成本要高得多。所以这造成了中国和国外主机在售后服务上的差异。<br />
<span id="more-697"></span><br />
国内主机的售后往往提供qq等即时通讯的技术支持，国外主机则一般通过集成的客服系统，以提交工单（ticket）的方式和主机商取得联系。就沟通手段来说，当然是前一种更便捷一点。Yculer 歪酷人同时提供这两种技术支持手段，保守估计其中90%以上的技术请求是通过第一种途径。</p>
<p>当然国内外主机都有电话支持，只是大家用的比较少而已。复杂的问题也难以通过打电话解决。</p>
<p>能解决实际问题是重要的，能及时解决更加重要。我对主机商的技术支持的要求很简单，第一，技术能力比我强；第二，必须在30分钟内响应。我想这两条应该能代表大部分客户对主机商的要求。在一个信息化的时代，要选出符合上述要求的主机商，比起根据国内复杂的网络环境找出又快又稳的美国主机容易许多。建议大家到 webhostingtalk.com 搜索你有意向的主机商的 review ，美国人的评价大部分尚算中肯。有一些几乎没有负面评价的主机商，他们的技术支持值得信赖。不要看国内的主机测评，越是看着专业的测评网站越有可能是 landing site，目的只是从你手中攫取推介主机的收益。</p>
<p>有 2 个误区有必要提醒新手:</p>
<p>1 “大”即是“好”。<br />
国人最早使用的主机，如dh，hm，bh，hg等，都是美国大型的主机商，拥有自己的硬件甚至大型机房，但大公司并不意味着好服务。倒不是店大欺客，而是这些主机商的客户数量过于庞大，几乎不可能提供非常优质的服务。就算是mt也只是言过其实罢了。千万别以为他们就是最“好”的主机。我曾经遇到过一家非常低调的主机商，在主机领域有超过10年的经验，几乎没有任何负面的评价，技术支持无可挑剔，甚至超过了我本人的期望。只要细心查找，你就会发现一些口耳相传的好商家。一支好的主机团队，是硬件以外看不到的财富。也不要去找太小的主机商，因为它们存在被收购的可能，这样也就有丧失优秀售后服务的可能。</p>
<p>2 销售回应时间能看出技术服务水平<br />
美国稍有规模的主机商，提供24/7的技术支持，但他们的销售和财务却并不是24小时在线。我合作过的最满意的两家主机商，其中一家的销售过了几个小时才回复我的邮件咨询，另一家过了24小时才开通我的主机，但在一天的任何时候联系技术支持，都能在半小时内得到回应。我提交过的工单涉及的内容有：</p>
<p>防 ddos 攻击<br />
导入大容量 mysql 数据库<br />
数据转移（超过 25 个账户）<br />
防火墙设置<br />
编译服务器<br />
ssh相关问题<br />
安装特殊组件<br />
……</p>
<p>所有问题都在我能接受的时间范围内得到了解决。我认为优秀的主机商，应该以解决客户的实际问题为第一要务，即使是一些不合理的或者超出范围的问题，也应该有问必答，如果自己不能解决，也应该提示客户可能的方案。</p>
<h3  class="related_post_title">随机日志</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%80%ef%bc%89%e5%bc%95.html" title="如何挑选好的主机（一）引">如何挑选好的主机（一）引</a></li><li><a href="http://blog.frompku.com/2006/05/%e6%b2%a1%e6%9c%89%e4%bb%80%e4%b9%88%e7%89%b9%e5%88%ab%e7%9a%84.html" title="没有什么特别的">没有什么特别的</a></li><li><a href="http://blog.frompku.com/2009/09/%e5%8d%9a%e5%ae%a2%e6%8d%a2%e6%96%b0%e8%a3%85.html" title="博客换新装">博客换新装</a></li><li><a href="http://blog.frompku.com/2007/06/%e5%8d%97%e6%96%b9%e6%8a%a5%e4%b8%9a%e9%9d%a2%e8%af%95.html" title="南方报业面试">南方报业面试</a></li><li><a href="http://blog.frompku.com/2008/12/%e8%80%81%e9%b8%9f%e6%85%8e%e5%85%a5%ef%bc%8c%e8%8f%9c%e9%b8%9f%e8%af%b7%e8%bf%9b%ef%bc%9a%e5%9b%be%e8%a7%a3archlinux%e5%85%a8%e8%bf%87%e7%a8%8b%ef%bc%88%e4%b8%80%ef%bc%89.html" title="老鸟慎入，菜鸟请进：图解Archlinux全过程">老鸟慎入，菜鸟请进：图解Archlinux全过程</a></li><li><a href="http://blog.frompku.com/2007/04/%e5%9b%9e%e5%88%b0%e5%ae%b6%e4%b8%ad.html" title="回到家中">回到家中</a></li><li><a href="http://blog.frompku.com/2008/11/%e5%8e%bb%e6%b5%b7%e8%be%b903.html" title="去海边03">去海边03</a></li><li><a href="http://blog.frompku.com/2009/07/%e7%9c%8b%e7%9c%8b%e4%ba%ba%e5%ae%b6%e5%8f%b0%e6%b9%be%e5%90%8c%e8%83%9e%e7%9a%84%e7%bd%91%e7%bb%9c.html" title="看看人家台湾同胞的网络">看看人家台湾同胞的网络</a></li><li><a href="http://blog.frompku.com/2008/05/%e5%9c%a8%e4%bd%a0%e7%9a%84%e5%8d%9a%e5%ae%a2%e4%b8%8a%e5%b1%95%e7%a4%ba%e5%9b%be%e7%89%87%ef%bc%9alightbox%e7%9a%84%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95.html" title="在你的博客上展示图片：lightbox的使用方法">在你的博客上展示图片：lightbox的使用方法</a></li><li><a href="http://blog.frompku.com/2006/04/%e8%bf%87%e5%b1%b1%e8%bd%a6-%e6%91%a9%e5%a4%a9%e8%bd%ae.html" title="过山车 摩天轮">过山车 摩天轮</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e5%9b%9b%ef%bc%89%e6%8a%80%e6%9c%af%e6%94%af%e6%8c%81%e5%92%8c%e5%93%8d%e5%ba%94%e6%97%b6%e9%97%b4.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>如何挑选好的主机（三）Uptime 和 Tracert</title>
		<link>http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%89%ef%bc%89uptime-%e5%92%8c-tracert.html</link>
		<comments>http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%89%ef%bc%89uptime-%e5%92%8c-tracert.html#comments</comments>
		<pubDate>Fri, 02 Apr 2010 07:10:55 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[资源]]></category>
		<category><![CDATA[tracert]]></category>
		<category><![CDATA[uptime]]></category>
		<category><![CDATA[主机]]></category>
		<category><![CDATA[路由]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=694</guid>
		<description><![CDATA[在继续今天的话题之前，我觉得有必要展示一张图片，有助于更准确地理解前文所说的 ping 和 bandwidth的关系。

上图是在非周末的上午对某个美国主机的ping，结果显示133ms，这已经达到前文讨... ]]></description>
			<content:encoded><![CDATA[<p>在继续今天的话题之前，我觉得有必要展示一张图片，有助于更准确地理解前文所说的 ping 和 bandwidth的关系。</p>
<p><img src="https://dl.dropbox.com/u/1613233/earthping.jpg"/></p>
<p>上图是在非周末的上午对某个美国主机的ping，结果显示133ms，这已经达到前文讨论的美国主机理论上的最低ping值。当然在高峰时段带宽并不那么充裕的时候，ping值就难以维持低值。这就像周末晚上当你一边使用p2p下载，一边还指望和朋友顺畅地玩rts类游戏是一件不那么现实的事情，指望美国主机在一天的任何时段，一周的任何一天都能保持133ms的ping是一件更加不现实的事情。<br />
<span id="more-694"></span><br />
世界上最远的距离并不是电信和网通，其实它们彼此离的不远，只是路窄人多。我们挑美国主机，不仅要看路程的长短，还要看路有多宽，走这条路的人有多少。</p>
<p>如果说 ping 和 bandwidth 决定了一个主机有多快，那么 Uptime 在线率就是衡量主机稳定性的一个重要指标。我们总是倾向于接受短时间能见效的数据，但从一个主机商的角度看来，稳定性在挑选主机时是一个胜过速度的考虑因素。不夸张地说，稳定性压倒一切。稳定体现了一个主机的综合实力。</p>
<p>第三方的服务器监测服务有很多。国内推荐jiankongbao.com，国外推荐pingdom.com，好用而且还是免费的。pingdom对每一个用户免费提供20条的短信提醒——当然，用完20条后，我们有其它办法第一时间收到主机宕机的短信，有兴趣的朋友可以关注后续文章。</p>
<p>虽然pingdom很好用，但因为众所周知的原因，仍然建议大家至少选用一家国内的监测服务。</p>
<p>tracert是除了ping以外另一个常用的网络工具，借助它，我们可以找到主机的路由，通过tracert的结果，往往也能够了解服务器机房的带宽提供者，比如 grobal crossing，level3,savvis,he,peer1,cogentco等等。</p>
<p>在这里提到tracert的原因是，因为国内复杂的网络环境，路由和线路对主机稳定性的作用越来越大。前文提到的这些带宽提供商，都是美国排名前十的行业佼佼者，然而很遗憾，使用它们服务的美国机房，走它们路由的美国主机或多或少都受到影响。表现就是你的主机好的时候190ms，差的时候可以400ms，甚至大量丢包。</p>
<p><img src="https://dl.dropbox.com/u/1613233/earthtracert.jpg"/></p>
<p>也许说levle3对终端用户比较陌生，那么softlayer和theplanet呢？可能还是陌生了点，那么说些更多人熟悉的名字吧：hostgator,lunarpage,bluehost,hawkhost……没错，这些在国内比较知名的美国主机无一幸免。</p>
<p>究竟什么样的tracert比较让人放心，不至于像level3的线路那样隔三差五地抽风，让你的客户抓狂呢？这个问题没法回答，也许几个月，一两年后，level3的线路已经得到优化，也许中美海底光纤扩容，抽风已经成为归去时囧。</p>
<p>我个人观点，希望tracert显示经过的路由越少越好，ping值越低越好。其他的，全靠经验。</p>
<p>To be continued</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2010/06/%e6%9c%80%e5%a4%a7%e5%92%8c%e6%9c%80%e5%a5%bd.html" title="最大和最好">最大和最好</a></li><li><a href="http://blog.frompku.com/2010/06/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%94%ef%bc%89%e8%bf%9c%e7%a6%bb%e6%8a%bd%e9%a3%8e.html" title="如何挑选好的主机（五）远离抽风">如何挑选好的主机（五）远离抽风</a></li><li><a href="http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%8c%ef%bc%89ping-bandwidth.html" title=" 如何挑选好的主机（二）ping &#038; bandwidth"> 如何挑选好的主机（二）ping &#038; bandwidth</a></li><li><a href="http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%80%ef%bc%89%e5%bc%95.html" title="如何挑选好的主机（一）引">如何挑选好的主机（一）引</a></li><li><a href="http://blog.frompku.com/2009/08/%e6%81%af%e5%a3%a4%e5%86%8d%e6%ac%a1%e5%ae%95%e6%9c%ba.html" title="息壤再次宕机">息壤再次宕机</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%89%ef%bc%89uptime-%e5%92%8c-tracert.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何挑选好的主机（二）ping &amp; bandwidth</title>
		<link>http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%8c%ef%bc%89ping-bandwidth.html</link>
		<comments>http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%8c%ef%bc%89ping-bandwidth.html#comments</comments>
		<pubDate>Fri, 19 Mar 2010 05:21:58 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[资源]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[主机]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=688</guid>
		<description><![CDATA[挑选好的主机所要考虑的因素，其中首先的是速度。不同的网站对网络的要求是不同的。本文所要讨论的范围仅限于一般的博客、企业和外贸类网站，这些网站的流量主要来自于页面浏览，私... ]]></description>
			<content:encoded><![CDATA[<p>挑选好的主机所要考虑的因素，其中首先的是速度。不同的网站对网络的要求是不同的。本文所要讨论的范围仅限于一般的博客、企业和外贸类网站，这些网站的流量主要来自于页面浏览，私服和流媒体不在本文讨论的范围之内。</p>
<p>几乎任何一个顾客都知道使用ping来测试主机的连接速度，所谓ping，是从你的电脑向主机的服务器发送数据请求过去，再回来，所需要的时间。光纤的网络传输速度是一定的，受制于物理距离，从中国ping美国主机，在理论上必然大于133ms（实际上更高）。133ms是什么概念，国内的多线机房和BGP机房都比这个数值优，在这个指标上，国内的主机比美国主机理想，物理距离摆在那里，是理所当然的。<br />
<span id="more-688"></span><br />
当然光从你的电脑ping是不全面的。因为你的网络环境不能代表你的网站的用户的网络环境，你ping值低不代表访问你的网站的人ping值低，反正亦然，因此产生了一些第三方的ping服务。比如国内的：jiankongbao.com；国外的：just-ping.com。根据你的访客来源选择。jiankongbao.com可以记录电信和联通（网通）的ping，对于国内用户ping美国主机是一个不错的选择；如果你的网站是外贸站，则应该选择just-ping.com或其他类似的服务。</p>
<p>除了ping（延时）以外，新手容易忽视的另一个指标是 bandwidth (带宽），这个bandwidth不是指你所购买的主机的流量上限（从几GB到几百GB，甚至是所谓的“无限流量”），而是指服务器所在机房的进出带宽。换言之，有点类似国内所说的2M独享带宽，10MB独享带宽等等。在bandwidth这个指标上，美国主机要优于国内主机，通常大一点的数据中心（机房）都有好几家bandwidth provider（带宽提供商），比如level3，grobal crossing，he，nlayer，savvis等等，带宽的规模有的是10g数量级的。</p>
<p>带宽对速度的影响，是一个瓶颈作用。举一个大家都能体会到的例子，假设你家里是 2 M adsl，你在下bt，上行的512k带宽很快被占了，这样你浏览网页就变得十分困难（关于这一点，突然想到cfos优化，有兴趣的朋友自行google）；同样的，当服务器的带宽不足时，即使ping值很低，打开服务器上面的网站也会变得十分困难。</p>
<p>由于bandwidth不如ping直观，所以容易被大家所忽视，甚至被部分主机商所利用，比如某vps宣称不限流量，但实际上却只有1mbps的带宽。通常美国主机商都会再网站上的data center页说明它们的带宽提供商的带宽大小，如果没有说明，也建议你询问销售。</p>
<p>另一个方法是使用tracert命令，通过跟踪路由能够大致了解对方的带宽质量。对中国用户来说，有一个问题是，某些美国主机的带宽提供商确实很优秀，但是连接中国国内却并不是十分理想，对你的网站的稳定性影响很大，比如说 level3。解决这个问题要靠观察和经验，在后面的文章中我会进一步讨论tracert和主机的稳定性标准。</p>
<p>至于速度，ping和bandwidth都很重要，刻意排斥其中任何一个都不可取。<br />
To be continued。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2010/06/%e6%9c%80%e5%a4%a7%e5%92%8c%e6%9c%80%e5%a5%bd.html" title="最大和最好">最大和最好</a></li><li><a href="http://blog.frompku.com/2010/06/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%94%ef%bc%89%e8%bf%9c%e7%a6%bb%e6%8a%bd%e9%a3%8e.html" title="如何挑选好的主机（五）远离抽风">如何挑选好的主机（五）远离抽风</a></li><li><a href="http://blog.frompku.com/2010/04/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%89%ef%bc%89uptime-%e5%92%8c-tracert.html" title="如何挑选好的主机（三）Uptime 和 Tracert">如何挑选好的主机（三）Uptime 和 Tracert</a></li><li><a href="http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%b8%80%ef%bc%89%e5%bc%95.html" title="如何挑选好的主机（一）引">如何挑选好的主机（一）引</a></li><li><a href="http://blog.frompku.com/2009/08/%e6%81%af%e5%a3%a4%e5%86%8d%e6%ac%a1%e5%ae%95%e6%9c%ba.html" title="息壤再次宕机">息壤再次宕机</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2010/03/%e5%a6%82%e4%bd%95%e6%8c%91%e9%80%89%e5%a5%bd%e7%9a%84%e4%b8%bb%e6%9c%ba%ef%bc%88%e4%ba%8c%ef%bc%89ping-bandwidth.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>在网页中插入 FLASH 的标准方法（二）</title>
		<link>http://blog.frompku.com/2009/10/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5-flash-%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%ba%8c%ef%bc%89.html</link>
		<comments>http://blog.frompku.com/2009/10/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5-flash-%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%ba%8c%ef%bc%89.html#comments</comments>
		<pubDate>Wed, 07 Oct 2009 13:39:21 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=629</guid>
		<description><![CDATA[在前文中,我介绍了插入 Flash 文件而又能符合 w3c 标准的方法。此方法适合一些 FLASH 视频的转帖，但不能解决所有问题。
前一段时间我曾经应万戈同学的要求帮助修改他的博客，以通过 xhtml 的... ]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://blog.frompku.com/2009/09/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5flash%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%b8%80.html">前文</a>中,我介绍了插入 Flash 文件而又能符合 <span class='wp_keywordlink'><a href="http://w3.org/" rel="external nofollow">w3c</a></span> 标准的方法。此方法适合一些 FLASH 视频的转帖，但不能解决所有问题。</p>
<p>前一段时间我曾经应万戈同学的要求帮助修改他的<a href="http://www.life-studio.cn/" rel="external nofollow">博客</a>，以通过 xhtml 的验证，万戈在博客上使用了一个<a href="http://mixpod.com/" rel="external nofollow"> MixPod</a>的外挂 MP3 播放器，<span id="more-629"></span>需要用到类似下文的代码：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;,&quot;monospace&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;center&gt;&lt;p</span> <span style="color: rgb(255, 0, 0);">style=</span><span style="color: rgb(0, 0, 255);">&quot;visibility:visible;&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;object</span> <span style="color: rgb(255, 0, 0);">type=</span><span style="color: rgb(0, 0, 255);">&quot;application/x-shockwave-flash&quot;</span> <span style="color: rgb(255, 0, 0);">data=</span><span style="color: rgb(0, 0, 255);">&quot;http://assets.myflashfetish.com/swf/mp3/mff-mixtape.swf&quot;</span> <span style="color: rgb(255, 0, 0);">height=</span><span style="color: rgb(0, 0, 255);">&quot;185&quot;</span> <span style="color: rgb(255, 0, 0);">width=</span><span style="color: rgb(0, 0, 255);">&quot;300&quot;</span> <span style="color: rgb(255, 0, 0);">style=</span><span style="color: rgb(0, 0, 255);">&quot;width:300px;height:185px&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;movie&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;http://assets.myflashfetish.com/swf/mp3/mff-mixtape.swf&quot;</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;quality&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;high&quot;</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;scale&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;noscale&quot;</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;salign&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;TL&quot;</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;wmode&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;transparent&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;flashvars&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;myid=31490376&amp;path=2009/10/07&amp;mycolor=645269&amp;mycolor2=B3B3B3&amp;mycolor3=CCCCCC&amp;autoplay=false&amp;rand=0&amp;f=4&amp;vol=100&amp;pat=0&amp;grad=false&amp;ow=300&amp;oh=185&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;&lt;/object&gt;&lt;br&gt;&lt;a</span> <span style="color: rgb(255, 0, 0);">href=</span><span style="color: rgb(0, 0, 255);">&quot;http://www.mixpod.com/playlist/31490376&quot;</span> <span style="color: rgb(255, 0, 0);">target=</span><span style="color: rgb(0, 0, 255);">&quot;_blank&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;img</span> <span style="color: rgb(255, 0, 0);">src=</span><span style="color: rgb(0, 0, 255);">&quot;http://images.myflashfetish.com/btns/itape/tracks.gif&quot;</span> <span style="color: rgb(255, 0, 0);">title=</span><span style="color: rgb(0, 0, 255);">&quot;Get Music Tracks!&quot;</span> <span style="color: rgb(255, 0, 0);">style=</span><span style="color: rgb(0, 0, 255);">&quot;border-style:none;&quot;</span> <span style="color: rgb(255, 0, 0);">alt=</span><span style="color: rgb(0, 0, 255);">&quot;Music&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/a&gt;&lt;a</span> <span style="color: rgb(255, 0, 0);">href=</span><span style="color: rgb(0, 0, 255);">&quot;http://www.mixpod.com&quot;</span> <span style="color: rgb(255, 0, 0);">target=</span><span style="color: rgb(0, 0, 255);">&quot;_blank&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;img</span> <span style="color: rgb(255, 0, 0);">src=</span><span style="color: rgb(0, 0, 255);">&quot;http://images.myflashfetish.com/btns/itape/create.gif&quot;</span> <span style="color: rgb(255, 0, 0);">title=</span><span style="color: rgb(0, 0, 255);">&quot;Create Your Free Playlist!&quot;</span> <span style="color: rgb(255, 0, 0);">style=</span><span style="color: rgb(0, 0, 255);">&quot;border-style:none;&quot;</span> <span style="color: rgb(255, 0, 0);">alt=</span><span style="color: rgb(0, 0, 255);">&quot;Playlist&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/a&gt;&lt;a</span> <span style="color: rgb(255, 0, 0);">href=</span><span style="color: rgb(0, 0, 255);">&quot;http://www.mixpod.com/ringtones/31490376&quot;</span> <span style="color: rgb(255, 0, 0);">target=</span><span style="color: rgb(0, 0, 255);">&quot;_blank&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;img</span> <span style="color: rgb(255, 0, 0);">src=</span><span style="color: rgb(0, 0, 255);">&quot;http://images.myflashfetish.com/btns/itape/ringtones.gif&quot;</span> <span style="color: rgb(255, 0, 0);">title=</span><span style="color: rgb(0, 0, 255);">&quot;Get Ringtones From This Playlist!&quot;</span> <span style="color: rgb(255, 0, 0);">style=</span><span style="color: rgb(0, 0, 255);">&quot;border-style:none;&quot;</span> <span style="color: rgb(255, 0, 0);">alt=</span><span style="color: rgb(0, 0, 255);">&quot;Ringtones&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/a&gt;&lt;br</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;&lt;a</span> <span style="color: rgb(255, 0, 0);">href=</span><span style="color: rgb(0, 0, 255);">&quot;http://mixpod.com&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span><span style="color: rgb(0, 0, 0);">Music Playlist</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/a&gt;</span><span style="color: rgb(0, 0, 0);"> at </span><span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;a</span> <span style="color: rgb(255, 0, 0);">href=</span><span style="color: rgb(0, 0, 255);">&quot;http://mixpod.com&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span><span style="color: rgb(0, 0, 0);">MixPod.com</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/a&gt;&lt;/p&gt;&lt;/center&gt;</span></div>
<p>仔细看这段代码，我们可以发现这么一行：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;,&quot;monospace&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;flashvars&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;myid=31490376&amp;path=2009/10/07&amp;mycolor=645269&amp;mycolor2=B3B3B3&amp;mycolor3=CCCCCC&amp;autoplay=false&amp;rand=0&amp;f=4&amp;vol=100&amp;pat=0&amp;grad=false&amp;ow=300&amp;oh=185&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">/&gt;</span></div>
<p>MixPod 会载入一个 FLASH 文件，然后通过 flashvars 自定义 MP3 播放器，如果使用我上一篇文章中的方法，是无法传递 falshvars 的值的。解决方法是通过载入 js 文件曲线绕道 W3C 的 xhtml 检查。</p>
<p>首先，我们需要一个 javascript 文件：<a href="http://dl.getdropbox.com/u/1613233/swfobject.rar" rel="external nofollow">swfobject.js</a>，下载并上传到你的空间。</p>
<p>修改 <span class='wp_keywordlink_affiliate'><a href="/tag/wordpress">wordpress</a></span> 的主题文件，header.php中加入：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;,&quot;monospace&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;script </span><span style="color: rgb(255, 0, 0);">type=</span><span style="color: rgb(0, 0, 255);">&quot;text/javascript&quot;</span> <span style="color: rgb(255, 0, 0);">src=</span><span style="color: rgb(0, 0, 255);">&quot;js文件的地址&quot;</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/script&gt;</span></div>
<p>然后在你需要加载 FLASH 文件的地方，添加类似的代码（请根据实际情况修改 flash 的源文件地址和其他 flashvars 的值，此段只是万戈同学博客的源代码）：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;,&quot;monospace&quot;; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;div</span> <span style="color: rgb(255, 0, 0);">id=</span><span style="color: rgb(0, 0, 255);">&quot;flashcontent&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span><br /> <span style="color: rgb(0, 136, 0); font-style: italic;">&lt;!&#8211;这个层放置如果浏览者没有装Flash Player插件或禁用JavaScript和Flash时提示给用户的信息&#8211;&gt;</span><br /> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/div&gt;&lt;script </span><span style="color: rgb(255, 0, 0);">type=</span><span style="color: rgb(0, 0, 255);">&quot;text/javascript&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span><br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 128); font-weight: bold;">var</span> <span style="color: rgb(0, 0, 0);">so</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 128); font-weight: bold;">new</span> <span style="color: rgb(0, 0, 0);">SWFObject</span>(<span style="color: rgb(0, 0, 255);">&quot;http://assets.myflashfetish.com/swf/mp3/mff-mixtape.swf?myid=20143873&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;mymovie&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;300&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;185&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;7&quot;</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">&quot;#336699&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">addParam</span>(<span style="color: rgb(0, 0, 255);">&quot;quality&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;high&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">addParam</span>(<span style="color: rgb(0, 0, 255);">&quot;wmode&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;transparent&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">addParam</span>(<span style="color: rgb(0, 0, 255);">&quot;salign&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;TL&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">addVariable</span>(<span style="color: rgb(0, 0, 255);">&quot;mycolor&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;857777&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">addVariable</span>(<span style="color: rgb(0, 0, 255);">&quot;mycolor2&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;eaeaea&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">addVariable</span>(<span style="color: rgb(0, 0, 255);">&quot;mycolor3&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;fcfcfc&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">addVariable</span>(<span style="color: rgb(0, 0, 255);">&quot;autoplay&quot;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 255);">&quot;false&quot;</span>);<br /> &nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">so</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">write</span>(<span style="color: rgb(0, 0, 255);">&quot;flashcontent&quot;</span>);<br /> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/script&gt;</span></div>
<p>通过 javascript 的&#8221;addParam&#8221;和&#8221;addVariable&#8221;，我们就可以圆满地显示 FLASH 又符合 W3C 的标准。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2009/09/%e6%81%ad%e5%96%9c%e6%9c%ac%e7%ab%99%e9%80%9a%e8%bf%87xhtml1-0%e5%92%8ccss2-1%e9%aa%8c%e8%af%81.html" title="恭喜本站通过XHTML1.0和CSS2.1验证">恭喜本站通过XHTML1.0和CSS2.1验证</a></li><li><a href="http://blog.frompku.com/2009/09/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5flash%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%b8%80.html" title="在网页中插入flash的标准方法（一）">在网页中插入flash的标准方法（一）</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2009/10/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5-flash-%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%ba%8c%ef%bc%89.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在网页中插入flash的标准方法（一）</title>
		<link>http://blog.frompku.com/2009/09/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5flash%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%b8%80.html</link>
		<comments>http://blog.frompku.com/2009/09/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5flash%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%b8%80.html#comments</comments>
		<pubDate>Fri, 04 Sep 2009 11:07:01 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=599</guid>
		<description><![CDATA[插入 flash ？复制黏贴代码不就行了，这还需要学吗？需要，如果你想让你的网页符合w3c标准，又不想用插件的话。在进一步阅读本文之前，请先看一个例... ]]></description>
			<content:encoded><![CDATA[<p>插入 flash ？复制黏贴代码不就行了，这还需要学吗？需要，如果你想让你的网页符合<span class='wp_keywordlink'><a href="http://w3.org/" rel="external nofollow">w3c</a></span>标准，又不想用插件的话。</p>
<p>在进一步阅读本文之前，请先看一个例子</p>
<p>我很喜欢的放牛班的春天童声合唱团的演唱会：<br />
<span id="more-599"></span><br />
<object type="application/x-shockwave-flash" width="480" height="400" data="http://player.youku.com/player.php/sid/XNDEyNDY3MzI=/v.swf"><param name="movie" value="http://player.youku.com/player.php/sid/XNDEyNDY3MzI=/v.swf" /></object></p>
<p>这一段视频来自国内视频站优酷，优酷等大型视频站都会提供转帖功能，优酷给出的这段视频的代码如下：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;,&quot;monospace&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;embed</span> <span style="color: rgb(255, 0, 0);">src=</span><span style="color: rgb(0, 0, 255);">&quot;http://player.youku.com/player.php/sid/XNDEyNDY3MzI=/v.swf&quot;</span> <span style="color: rgb(255, 0, 0);">quality=</span><span style="color: rgb(0, 0, 255);">&quot;high&quot;</span> <span style="color: rgb(255, 0, 0);">width=</span><span style="color: rgb(0, 0, 255);">&quot;480&quot;</span> <span style="color: rgb(255, 0, 0);">height=</span><span style="color: rgb(0, 0, 255);">&quot;400&quot;</span> <span style="color: rgb(255, 0, 0);">align=</span><span style="color: rgb(0, 0, 255);">&quot;middle&quot;</span> <span style="color: rgb(255, 0, 0);">allowScriptAccess=</span><span style="color: rgb(0, 0, 255);">&quot;sameDomain&quot;</span> <span style="color: rgb(255, 0, 0);">type=</span><span style="color: rgb(0, 0, 255);">&quot;application/x-shockwave-flash&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/embed&gt;</span></div>
<p>然而你在本页看到的视频的实际代码，经过我的修改如下：</p>
<div class="source" style="font-family: '[object HTMLOptionElement]', 'Lucida Console', 'Courier New', Verdana; color: rgb(0, 0, 0); "> <span style="color: rgb(0, 0, 128); font-weight: bold; ">&lt;object</span> <span style="color: rgb(255, 0, 0); ">type=</span><span style="color: rgb(0, 0, 255); ">&quot;application/x-shockwave-flash&quot;</span> <span style="color: rgb(255, 0, 0); ">width=</span><span style="color: rgb(0, 0, 255); ">&quot;480&quot;</span> <span style="color: rgb(255, 0, 0); ">height=</span><span style="color: rgb(0, 0, 255); ">&quot;400&quot;</span> <span style="color: rgb(255, 0, 0); ">data=</span><span style="color: rgb(0, 0, 255); ">&quot;http://player.youku.com/player.php/sid/XNDEyNDY3MzI=/v.swf&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold; ">&gt;</span><br /> <span style="color: rgb(0, 0, 128); font-weight: bold; ">&lt;param</span> <span style="color: rgb(255, 0, 0); ">name=</span><span style="color: rgb(0, 0, 255); ">&quot;movie&quot;</span> <span style="color: rgb(255, 0, 0); ">value=</span><span style="color: rgb(0, 0, 255); ">&quot;http://player.youku.com/player.php/sid/XNDEyNDY3MzI=/v.swf&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold; ">/&gt;</span><br /> <span style="color: rgb(0, 0, 128); font-weight: bold; ">&lt;/object&gt;</span></div>
<p>完全一样的效果，而且在各种浏览器中保持了一致的兼容性，后一种写法摒弃了embed，因而符合 w3c 的标准。你需要修改的只是自定义适当的长宽比例，和这段视频的flash地址。这对于转帖大部分视频站的视频都是有效的。</p>
<p>再看一个例子：</p>
<p><object type="application/x-shockwave-flash" width="420" height="24" data="http://www.tudou.com/v/4OIfmCUs-cI"><param name="movie" value="http://www.tudou.com/v/4OIfmCUs-cI" /></object></p>
<p>这是在网页中插入 MP3 。在 <span class='wp_keywordlink_affiliate'><a href="/tag/wordpress">wordpress</a></span> 中插入 MP3 ，大部分人喜欢用 wordpress 的一个现成的插件 audio player，不可否认它是一个很出色的插件，有很漂亮的js效果，使用起来也很方便，但需要在网页中额外的加入js和css，这会降低网站的加载效率。</p>
<p>另一方面，从网站文件托管的角度出发，我觉得把媒体文件上传到土豆、优酷这些媒体分享网站，既能保证速度，又不用担心被盗链。如果你的mp3被迅雷搜索到了的话，也许一天就能耗掉你整整一个月的流量上限。在以后的文章中，我会介绍完整的文件托管的思路——如何从零成本的角度出发，把你网站上的图片、mp3媒体文件托管到可靠的空间，如何针对图床突然崩溃而采取预防措施（比如Picasa在国内无法访问）。</p>
<p>回过头来看上面一段 mp3 ，土豆的代码如下：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;,&quot;monospace&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;object</span> <span style="color: rgb(255, 0, 0);">width=</span><span style="color: rgb(0, 0, 255);">&quot;420&quot;</span> <span style="color: rgb(255, 0, 0);">height=</span><span style="color: rgb(0, 0, 255);">&quot;363&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;movie&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;http://www.tudou.com/v/4OIfmCUs-cI&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/param&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;allowFullScreen&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;true&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/param&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;allowscriptaccess&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;always&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/param&gt;&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;wmode&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;opaque&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/param&gt;&lt;embed</span> <span style="color: rgb(255, 0, 0);">src=</span><span style="color: rgb(0, 0, 255);">&quot;http://www.tudou.com/v/4OIfmCUs-cI&quot;</span> <span style="color: rgb(255, 0, 0);">type=</span><span style="color: rgb(0, 0, 255);">&quot;application/x-shockwave-flash&quot;</span> <span style="color: rgb(255, 0, 0);">allowscriptaccess=</span><span style="color: rgb(0, 0, 255);">&quot;always&quot;</span> <span style="color: rgb(255, 0, 0);">allowfullscreen=</span><span style="color: rgb(0, 0, 255);">&quot;true&quot;</span> <span style="color: rgb(255, 0, 0);">wmode=</span><span style="color: rgb(0, 0, 255);">&quot;opaque&quot;</span> <span style="color: rgb(255, 0, 0);">width=</span><span style="color: rgb(0, 0, 255);">&quot;420&quot;</span> <span style="color: rgb(255, 0, 0);">height=</span><span style="color: rgb(0, 0, 255);">&quot;363&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;&lt;/embed&gt;&lt;/object&gt;</span></div>
<p>经过我的修改后如下：</p>
<div style="font-family: &quot;[object HTMLOptionElement]&quot;,&quot;Lucida Console&quot;,&quot;Courier New&quot;,&quot;monospace&quot;; color: rgb(0, 0, 0);" class="source"> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;object</span> <span style="color: rgb(255, 0, 0);">type=</span><span style="color: rgb(0, 0, 255);">&quot;application/x-shockwave-flash&quot;</span> <span style="color: rgb(255, 0, 0);">width=</span><span style="color: rgb(0, 0, 255);">&quot;420&quot;</span> <span style="color: rgb(255, 0, 0);">height=</span><span style="color: rgb(0, 0, 255);">&quot;24&quot;</span> <span style="color: rgb(255, 0, 0);">data=</span><span style="color: rgb(0, 0, 255);">&quot;http://www.tudou.com/v/4OIfmCUs-cI&quot;</span><span style="color: rgb(0, 0, 128); font-weight: bold;">&gt;</span><br /> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;param</span> <span style="color: rgb(255, 0, 0);">name=</span><span style="color: rgb(0, 0, 255);">&quot;movie&quot;</span> <span style="color: rgb(255, 0, 0);">value=</span><span style="color: rgb(0, 0, 255);">&quot;http://www.tudou.com/v/4OIfmCUs-cI&#038;qrgb(0, 0,                                                128); font-weight: bold;&#8221;>/&gt;</span><br /> <span style="color: rgb(0, 0, 128); font-weight: bold;">&lt;/object&gt;</span></div>
<p>是不是简单多了？和上一段视频不同的是，我把高度从363改成了24，使之更像mp3播放器。</p>
<p>细心的朋友可能会发现，我所介绍的插入flash的方法，仅仅能够自定义宽度、高度和flash地址三个元素，如果存在更多需要定义的地方，就无能为力了。没错，更多关于如何在网页中插入符合 w3c 标准的flash文件,请关注后续文章。:)</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2009/10/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5-flash-%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%ba%8c%ef%bc%89.html" title="在网页中插入 FLASH 的标准方法（二）">在网页中插入 FLASH 的标准方法（二）</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2009/09/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5flash%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%b8%80.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>恭喜本站通过XHTML1.0和CSS2.1验证</title>
		<link>http://blog.frompku.com/2009/09/%e6%81%ad%e5%96%9c%e6%9c%ac%e7%ab%99%e9%80%9a%e8%bf%87xhtml1-0%e5%92%8ccss2-1%e9%aa%8c%e8%af%81.html</link>
		<comments>http://blog.frompku.com/2009/09/%e6%81%ad%e5%96%9c%e6%9c%ac%e7%ab%99%e9%80%9a%e8%bf%87xhtml1-0%e5%92%8ccss2-1%e9%aa%8c%e8%af%81.html#comments</comments>
		<pubDate>Tue, 01 Sep 2009 14:22:34 +0000</pubDate>
		<dc:creator>SorryDreams</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.frompku.com/?p=592</guid>
		<description><![CDATA[花了一晚上的时间终于完成了对新主题若干问题的修正，通过XHTML 1.0&#38;CSS 2.1验证。
但还有一个半问题没有真正解决。半个问题是除了首页的几个flash播放器代码我已经修改为符合w3c标准的写... ]]></description>
			<content:encoded><![CDATA[<p>花了一晚上的时间终于完成了对新主题若干问题的修正，通过<a href="http://validator.w3.org/check?uri=http://blog.frompku.com" rel="external nofollow">XHTML 1.0</a>&amp;<a href="http://jigsaw.w3.org/css-validator/validator?uri=http://blog.frompku.com" rel="external nofollow">CSS 2.1</a>验证。</p>
<p>但还有一个半问题没有真正解决。半个问题是除了首页的几个flash播放器代码我已经修改为符合<span class='wp_keywordlink'><a href="http://w3.org/" rel="external nofollow">w3c</a></span>标准的写法以外，其他都懒得动，仍然有w3c不认可的embed标签。一个问题是comments.php中加入的实现Ctrl+Enter快速回复功能的代码，通不过XHTML验证。暂时没找到合适的解决方案。</p>
<p>就这些，没更多内容了。</p>
<h3  class="related_post_title">相关文章</h3><ul class="related_post"><li><a href="http://blog.frompku.com/2009/10/%e5%9c%a8%e7%bd%91%e9%a1%b5%e4%b8%ad%e6%8f%92%e5%85%a5-flash-%e7%9a%84%e6%a0%87%e5%87%86%e6%96%b9%e6%b3%95%ef%bc%88%e4%ba%8c%ef%bc%89.html" title="在网页中插入 FLASH 的标准方法（二）">在网页中插入 FLASH 的标准方法（二）</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.frompku.com/2009/09/%e6%81%ad%e5%96%9c%e6%9c%ac%e7%ab%99%e9%80%9a%e8%bf%87xhtml1-0%e5%92%8ccss2-1%e9%aa%8c%e8%af%81.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

