﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-hengheng123456789</title><link>http://www.blogjava.net/hengheng123456789/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 05 May 2026 05:03:37 GMT</lastBuildDate><pubDate>Tue, 05 May 2026 05:03:37 GMT</pubDate><ttl>60</ttl><item><title>AndroidManifest.xml中定义的application name作用（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/05/23/350848.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Mon, 23 May 2011 08:59:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/05/23/350848.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/350848.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/05/23/350848.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/350848.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/350848.html</trackback:ping><description><![CDATA[转自：<a href="http://www.devdiv.com/thread-45479-1-1.html">http://www.devdiv.com/thread-45479-1-1.html</a><br /><br />这个name属性是来设置你所有activity所属于哪个application的，默认是android.app.Application，你也可以自己定义一个类<br />例如<br />public class MyApplication extends Application {<br />}<br />然后<br />&lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:name=".MyApplication"&gt;&nbsp;&nbsp;就是这儿，将我们以前一直用的默认Application给他设置成我们自己做的MyApplication<br /><span style="color: red">MyApplication类的作用是为了放一些全局的和一些上下文都要用到变量和方法之类的。</span><br /><img src ="http://www.blogjava.net/hengheng123456789/aggbug/350848.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-05-23 16:59 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/05/23/350848.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Amazon AWS使用体验（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349292.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Fri, 29 Apr 2011 09:26:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349292.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/349292.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349292.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/349292.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/349292.html</trackback:ping><description><![CDATA[转自：<a href="http://huandu.me/2010/06/19/619/">http://huandu.me/2010/06/19/619/</a>
<div><br />
</div>
<div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">近几个月来简单体验了Amazon AWS大部分服务，现在分享一下使用感受。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Amazon EC2</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">从各方面来看，EC2应该算是Amazon的王牌产品。EC2功能全面，它可以在数分钟内launch一个实例，可以（理论上）自动提升/降低机器性能配置，可以绑定EBS成为具有高可用性特质的计算核心，可以摇身一变成为ELB成为一个load balancer。这些功能非常实用，特别适合针对国外市场且快速增长的小网站，可以在前期完全不受机器约束。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">EC2机器的内核在申请时指定，有很多选择，如果有闲心，还可以<a href="http://www.udfi.biz/2009/05/creating-a-centos-53-amazon-ami/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: underline; outline-style: none; outline-width: initial; outline-color: initial; color: #575757; ">做一个自己专用的</a>，我们没用这个功能，实在太繁琐了。EC2提供了完全的root权限，可以随意安装软件，由于EC2一般带有足够的硬盘空间（Large Instance就自带850GB磁盘空间），装个mysql当数据库机器也完全没有问题。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">EC2最大优势是灵活，最大劣势则是性能。EC2的IO性能欠佳，当EC2机器作为mysql数据库时，系统吞吐量只能到3~10 MB/s，相比而言，在同样数据同样程序条件下，使用真实机器则能轻松达到30MB/s。EC2的CPU是多个实例共享的，一般stolen的CPU都在10%左右，对于nginx+php-cgi这样的组合，EC2高端配置也不太能撑住压力，总是CPU吃紧。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">虽说EC2劣势明显，但由于互联网应用一般都很容易做到水平扩展，它的灵活性可以很大程度缓解这个劣势，不会有太大问题。不过最终我们还是放弃了EC2，主要因为今年5月Amazon云计算服务出了大量的事故，仅5月头两周，在同一个机房就出了5起大事故，我们在3起事故中受影响，每次都很不幸的都是单点EC2出问题，最长的一次在高峰期中断了6个小时服务，损失巨大。最郁闷的是，到了5月下旬，有一台跑数据库的EC2机器莫名奇妙磁盘损坏，还有一台莫名其妙的无法ssh，让我们感觉越来越不靠谱，于是决定逃离。云计算的可用性始终值得担心。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">EC2的价格相对传统IDC要贵不少，按高端机器High-Memory Double Extra Large每小时1.2US$来算，每月就要花864US$，再加上流量费，很容易达到每台服务器1000US$的水平。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Amazon RDS</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">RDS是一种数据库托管服务，通过RDS toolkit可以很方便的创建RDS实例并立即使用。据Amazon帮助文档说，RDS的数据库软件维护、升级、优化的工作全部由Amazon负责，用户只需要使用功能即可。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">可惜，RDS纯粹是一个看起来很美的东西。首先是RDS为了同时支持异构的数据库，牺牲了很多灵活性，例如，因为无法访问RDS的物理机器或存储空间，使得跑着mysql的RDS实例连记录slow log都成了难事，更别说什么err log，出了问题只能一抹瞎。如果要获取bi/bo这样的数据需要使用专用的RDS toolkit完成，很难集成到现成的监控工具里去。其次，RDS底层使用的是类似于EBS的网络存储，其IO性能差到一个令人发指的地步。一个很感性的数据是：使用RDS Double Extra Large DB Instance跑mysql时慢查询占1%，同样数据转到EC2 High-Memory Double Extra Large实例后慢查询降为0.01%。最让人无语的是RDS价格高于同等配置的EC2+EBS价格，每小时都贵超过0.3US$，相当于贵25%，省下来的钱用来雇专业运维人员绰绰有余，而且RDS功能和灵活性还远弱于后者，不怕折腾但怕花钱的人不建议选择RDS。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">如果执意要使用RDS，那么一定要注意RDS没有固定IP，每次重启实例（或过一段时间）都会变，程序连接的时候最好写域名，当然，这会损失性能。此外，RDS可用性也没宣传的那么高，我们5月最先挂的就是RDS实例，一挂就是好几个小时。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Amazon S3</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">S3是少有的看上去物美价廉的东西，只需要花几美元就可以拿到几十GB空间，对一般的互联网应用来说绰绰有余。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">S3提供丰富的API和工具上传文件。对firefox用户来说，有一个专门的S3扩展可用，可直接上传本地文件。还有一个s3curl.pl工具，可以用命令行传任意文件，可以方便的做到自动化。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">S3存储的文件可以直接通过域名从外网访问，不过比较郁闷的是文件尾部不能带&#8220;?&#8220;，一切基于文件名后面加随机串的避免缓存的做法都会失效。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Amazon CloudFront</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">CloudFront是一种CDN，它的访问速度据称不错，我们并没有实际使用过。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">我们不使用CloudFront主要是因为很难控制文件在CloudFront中失效。根据我们的程序结构，我们需要在静态文件后面加version信息强制用户在必要时更新到最新版，现在由于CloudFront既不能手动invalidate某个文件，也不能保证CloudFront上缓存的文件及时更新（可能更新会花24小时），我们需要修改现在的策略才能使用到它。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">CloudFront是根据用户所在网络来收费的，对于国内，CloudFront使用的是香港价格，贵于美洲和欧洲，不太划算。对于欧美市场，我也不清楚欧美CDN的价格究竟如何，无法比较。CloudFront在欧美的流量费用与EC2相同，不过由于没有按小时计的租费，总体价格会比EC2提供静态文件服务便宜很多。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Amazon CloudWatch</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">CloudWatch是一个性能数据监视器，对于这个东西我只能说太小儿科了，没看出来有什么实际的用处。一旦开启CloudWatch，Amazon就会帮忙收集开启了这个服务的instance数据，包括CPU和IO信息等。可惜，数据精度不高（大概是几分钟一次统计），数字也只是个大概值，能看的数据也很少，无论对入门者还是高手来说，都不能带来太多价值。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">CloudWatch看上去比较好的是可以配合EC2/EBS/Load Balancer toolkit做一些auto scale的事情，自动提升/降低EC2/EBS参数，还可以（理论上）自动launch新实例。这些东西我们都没尝试过，有兴趣的同学可以试试。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">CloudWatch价格不贵，一台机器就只用0.1US$而已，不过一般还是不建议开，装一个其他监控软件更靠谱。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Amazon Premiun Support</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">Premiun Support包括即时的电话支持和一个专有的提案系统。从服务质量上来说，Amazon的客服总是很热心，响应速度也很快，专业素质也不错，很不错。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">Premium Support非常贵，简直是抢钱。它是按照每月总花费来算价格的，最多增加总花费的16%，最少为无限接近于10%，代价十分明显。</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">结语</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 18px; padding-left: 0px; color: #575757; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; ">Amazon AWS提供丰富功能，还有不少toolkit和API，适合小应用使用。对于要求较高性能或较低成本的应用来说则不太适合，折腾一下IDC应该达到更好效果。</p>
</div>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/349292.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-04-29 17:26 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349292.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Google App Engine（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349279.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Fri, 29 Apr 2011 07:05:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349279.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/349279.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349279.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/349279.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/349279.html</trackback:ping><description><![CDATA[转自：<a href="http://baike.baidu.com/view/1524918.htm">http://baike.baidu.com/view/1524918.htm</a>
<div>
<div class="mod-top" style="margin-bottom: 30px; font-family: arial, 宋体, sans-serif; font-size: 14px; line-height: 24px; ">
<div class="card-summary nslog-area" data-nslog-type="72" style="line-height: 25px; font-size: 14px; margin-bottom: 25px; ">
<div style="float: left; width: 469px; ">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Google App Engine 是一种让您可以在 Google 的基础架构上运行您的网络<a target="_blank" href="http://baike.baidu.com/view/330120.htm" style="text-decoration: underline; color: #136ec2; ">应用程序</a>。Google App Engine 应用程序易于构建和维护，并可根据您的访问量和数据存储需要的增长轻松扩展。使用 Google App Engine，将不再需要维护服务器：您只需上传您的应用程序，它便可立即为您的用户提供服务。</p>
</div>
<div class="clear" style="clear: both; font-size: 0px; line-height: 0; height: 0px; visibility: visible; "><br />
</div>
</div>
</div>
<div class="lemma-main-content" id="lemmaContent-0" style="letter-spacing: 0.5px; width: 690px; overflow-x: hidden; overflow-y: hidden; float: left; font-family: arial, 宋体, sans-serif; font-size: 14px; line-height: 24px; ">
<h2 class="headline-1 first bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: none; "><a name="1" style="text-decoration: underline; color: #136ec2; width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a><span class="headline-content">简介</span></h2>
您可以使用 Google提供的免费域名（见扩展阅读）为您的<a target="_blank" href="http://baike.baidu.com/view/330120.htm" style="text-decoration: underline; color: #136ec2; ">应用程序</a>提供服务，也可以使用 Google Apps 从您自己的域为它提供服务。您可以与全世界的人共享您的应用程序，也可以限制为只有您组织内的成员可以访问。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
您可以免费开始使用 App Engine。注册一个免费帐户即可开发和发布您的应用程序以供全世界的人共享，而且不需要承担任何费用和责任。每个免费帐户都可使用多达 500MB 的持久存储空间，以及可支持每月约 500 万页面浏览量的足够 CPU 和宽带<sup style="margin-left: 2px; color: #3366cc; cursor: pointer; ">[1]</sup><a name="ref_[1]" style="text-decoration: underline; color: #136ec2; width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a>。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
使用 Google App Engine 的试用版本期间，只可以使用免费帐户。您很快就能够购买其他的计算资源。 App Engine提供了一个web应用运行的框架，App Engine 应用程序易于运行、部属和扩展。App Engine不同于其他方案：App Engine不是网格计算—它不能运行任意的作业。它不提供物理主机但提供了打包代码上传的方式。用户在只需要在代码中指定了response和request，剩下的运行和部署的任务就交给了App Engine。用户不需要预留资源，例如RAM、CPU或者诸如此类。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content"><br />
应用程序环境</span></h2>
通过 Google App Engine，即使在重载和数据量极大的情况下，也可以轻松构建能安全运行的应用程序。该环境包括以下特性：
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
动态网络服务，提供对常用网络技术的完全支持
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
持久存储有查询、分类和事务
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
自动扩展和载荷平衡
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
用于对用户进行身份验证和使用 Google 帐户发送电子邮件的 API
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
一种功能完整的本地开发环境，可以在您的计算机上模拟 Google App Engine
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
Google App Engine 应用程序是使用 Python 编程语言实现的。该运行时环境包括完整 Python 语言和多数 Python 标准库。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
目前，Google App Engine 支持 Python 语言和 JAVA 语言，但是我们希望将来它可以支持更多语言。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content">Sandbo</span></h2>
在安全环境中运行的应用程序，仅提供对基础<a target="_blank" href="http://baike.baidu.com/view/880.htm" style="text-decoration: underline; color: #136ec2; ">操作系统</a>的有限访问权限。这些限制让 App Engine 可以在多个服务器之间分发应用程序的网络请求，并可以启动和停止服务器以满足访问量需求。Sandbox 将您的应用程序隔离在它自己的安全可靠环境中，该环境与<a target="_blank" href="http://baike.baidu.com/view/813.htm" style="text-decoration: underline; color: #136ec2; ">网络服务器</a>的硬件、操作系统和物理位置无关。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
安全 Sandbox 环境的限制实例包括：
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
应用程序只能通过提供的网址获取和<a target="_blank" href="http://baike.baidu.com/view/576456.htm" style="text-decoration: underline; color: #136ec2; ">电子邮件服务</a>和 API 访问互联网中的其他计算机。其他计算机只能通过在标准端口上进行 HTTP（或 HTTPS）请求来连接至该应用程序。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
应用程序无法向文件系统写入。应用程序只能读取通过应用程序代码上传的文件。该应用程序必须使用 App Engine 数据库存储所有在请求之间持续存在的数据。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
应用程序代码仅在响应网络请求时运行，且必须在几秒钟内返回响应数据。请求处理程序不能在响应发送后产生子进程或执行代码。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content"><br />
Python 运行时环境</span></h2>
App Engine 提供了一个使用 Python 编程语言的运行时环境。将来的版本将考虑使用其他编程语言和运行时环境配置。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
Python 运行时环境使用 Python 2.5.2 版。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
该环境包括 Python 标准库。当然，您无法调用违反了 Sandbox 限制的库方法，例如尝试打开套接字或向文件写入。方便起见，其主要功能不受该运行时环境支持的标准库中的多个模块已被禁用，而导入这些模块的代码将发生错误。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
应用程序代码只能以 Python 编写。具有用 C 编写的扩展的代码不受支持。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
Python 环境为数据库、Google 帐户、网址获取和电子邮件服务提供了丰富的 Python API。App Engine 还提供了一个称为 webapp 的简单 Python 网络应用程序框架，从而可以轻松开始构建应用程序。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
方便起见，App Engine 还包括 Django 网络应用程序框架 0.96.1 版。请注意，App Engine 数据库不是某些 Django 组件所需的关系数据库。某些组件（例如 Django 模板引擎）按照文档化的程序工作，而其他组件则需要做更多工作。有关将 Django 与 App Engine 一起使用的提示，请参阅文章部分。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
只要这些库是完全使用 Python 实现并且不需要任何不受支持的标准库模块，您就可以使用您的应用程序上传其他第三方库。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
有关 Python 运行时环境的详细信息，请参阅 Python 运行时环境。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content"><br />
数据库</span></h2>
App Engine 提供了一个强大的分布式数据存储服务，其中包含查询引擎和事务功能。就像<a target="_blank" href="http://baike.baidu.com/view/492583.htm" style="text-decoration: underline; color: #136ec2; ">分布式网络</a>服务器随访问量增加一样，该<a target="_blank" href="http://baike.baidu.com/view/68389.htm" style="text-decoration: underline; color: #136ec2; ">分布式数据库</a>也会随数据而增加。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
该 App Engine 数据库与传统关系数据库不同。数据对象（或&#8220;实体&#8221;）有一类和一组属性。查询可以检索按属性值过滤和分类的给定种类的实体。属性值可以是受支持的属性值类型中的任何一种。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
数据库的 Python API 包括一个可以定义数据库实体结构的<a target="_blank" href="http://baike.baidu.com/view/1452242.htm" style="text-decoration: underline; color: #136ec2; ">数据建模</a>界面。数据模型可以指示属性值必须位于给定范围内，如果未给定任何范围，还可以提供默认值。您的应用程序可以根据需要向数据提供或多或少的结构。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
数据库使用乐观锁定进行并发控制。如果有其他进程尝试更新某实体，而同时该实体位于以固定次数进行重新尝试的事务中，此时该实体将更新。应用程序可以在一个事务中执行多项数据库操作（全部成功或者全部失败），从而确保数据的完整性。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
数据库通过其分布式网络使用&#8220;实体组&#8221;实现事务。一个事务操作一个组内的实体。同一组的实体存储在一起，以高效执行事务。应用程序可以在实体创建时将实体分配到组。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
有关数据库的详细信息，请参阅数据库 API 参考。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content"><br />
Google 帐户</span></h2>
App Engine 包括用于与 Google 帐户集成的服务 API。应用程序使用户可以通过 Google 帐户登录，并可以访问与该帐户关联的<a target="_blank" href="http://baike.baidu.com/view/126647.htm" style="text-decoration: underline; color: #136ec2; ">电子邮件地址</a>和可显示的名称。使用 Google 帐户使用户可以更快地开始使用您的应用程序，因为用户可以不需要创建新帐户了。Google 帐户还省去只为您的应用程序执行用户帐户系统的麻烦。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
如果您的应用程序正在 Google Apps 下运行，则它可以与您组织的成员和 Google Apps 帐户成员使用相同的功能。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
用户 API 还可告知应用程序当前用户是否是应用程序的注册<a target="_blank" href="http://baike.baidu.com/view/315045.htm" style="text-decoration: underline; color: #136ec2; ">管理员</a>。这样便可以轻松实现您站点上仅用于管理的区域。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
有关与 Google 帐户集成的详细信息，请参阅用户 API 参考。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content"><br />
App Engine 服务</span></h2>
App Engine 提供了多种服务，从而使您可以在管理应用程序的同时执行常规操作。提供了以下 API 以访问这些服务：
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
网址获取
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
应用程序可以使用 App Engine 的网址获取服务访问互联网上的资源，例如网络服务或其他数据。网址获取服务使用用于为许多其他 Google 产品检索网页的高速 Google 基础架构来检索<a target="_blank" href="http://baike.baidu.com/view/21050.htm" style="text-decoration: underline; color: #136ec2; ">网络资源</a>。有关网址获取服务的详细信息，请参阅网址获取 API 参考。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
邮件
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
应用程序可以使用 App Engine 的邮件服务发送电子邮件。邮件服务使用 Google 基础架构发送电子邮件。有关邮件服务的详细信息，请参阅邮件 API 参考。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
Memcache
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
Memcache 服务为您的应用程序提供了高性能的内存键值缓存，您可通过应用程序的多个实例访问该缓存。Memcache 对于那些不需要数据库的永久性功能和事务功能的数据很有用，例如临时数据或从数据库复制到缓存以进行高速访问的数据。有关 Memcache 服务的详细信息，请参阅 Memcache API 参考。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
图片操作
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
图片服务使您的应用程序可以对图片进行操作。使用该 API，您可以对 JPEG 和 PNG 格式的图片进行大小调整、剪切、旋转和翻转。有关图片操作服务的详细信息，请参阅图片 API 参考。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content"><br />
开发工作流程</span></h2>
App Engine 软件开发套件 (SDK) 包括可以在您的本地计算机上模拟所有 App Engine 服务的网络服务器应用程序。该 SDK 包括 App Engine 中的所有 API 和库。该网络服务器还可以模拟安全 Sandbox 环境，包括检查是否存在禁用模块的导入以及对不允许访问的<a target="_blank" href="http://baike.baidu.com/view/53557.htm" style="text-decoration: underline; color: #136ec2; ">系统资源</a>的尝试访问。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
Python SDK 完全使用 Python 实现，可以在装有 Python 2.5 的任何平台上运行，包括 Windows、Mac OS X 和 Linux。您可以在 Python 网站上获得适用于您的系统的 Python。该 SDK 以 Zip 文件提供，安装程序可用于 Windows 和 Mac OS X。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
您可以在此处下载该 SDK。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
该 SDK 还包括可将您的应用程序上传到 App Engine 的工具。创建了您应用程序的代码、静态文件和配置文件后，即可运行该工具上传数据。该工具会提示您提供 Google 帐户电子邮件地址和密码。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
构建已在 App Engine 上运行的应用程序的新主要发行版时，可以将新发行版作为新版本上传。在您改为使用新版本之前，旧版本可以继续为用户提供服务。可以在仍运行旧版本的同时在 App Engine 上测试新版本。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
管理控制台是基于网络的界面，用于管理在 App Engine 上运行的应用程序。您可以使用它创建新应用程序、配置域名、更改您的应用程序当前的版本、检查访问权限和错误日志以及浏览应用程序数据库。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; "></div>
<h2 class="headline-1 bk-sidecatalog-title" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 6px; padding-left: 0px; font-size: 18px; font-weight: bold; line-height: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dedfe1; clear: both; "><span class="headline-content"><br />
限额和限制</span></h2>
创建 App Engine 应用程序不仅简单，而且是免费的！您可以创建帐户，然后发布一个应用程序，用户无需承担任何费用和责任即可立即使用该应用程序。通过免费帐户获得的应用程序可使用多达 500MB 的存储空间和多达每月 500 万的页面浏览量。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
此试用时间内，仅提供免费帐户。您很快就能够以有竞争力的市场价格购买其他的计算资源。试用期过后，免费帐户可继续使用。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
此试用期间，最多可注册 3 个应用程序。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
应用程序资源限制（&#8220;限额&#8221;）会不断刷新。如果您的应用程序达到基于时间的限额（例如宽带），则该限额将以给定限制的比率立即开始刷新。固定限额（例如存储使用量）仅在降低使用量时才会减小。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
有些功能会施加与限额无关的限制，以保护系统的稳定性。例如，当调用某应用程序以为网络请求提供服务时，该应用程序必须在几秒钟内发出响应。如果该应用程序花费的时间过长，则进程将被终止并且服务器将向用户返回错误代码。响应超时是动态的，如果请求处理程序经常达到其超时，则可以缩短请求超时以节省资源。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
服务限制的另一实例是查询返回的结果数。一个查询最多可返回 1,000 条结果。要返回更多结果的查询只能返回该最大值。在这种情况下，执行这种查询的请求不可能在超时前返回请求，但限制仍存在以节省数据库上的资源。
<div class="spctrl" style="height: 14px; line-height: 14px; font-size: 12px; overflow-x: hidden; overflow-y: hidden; "></div>
试图破坏或滥用限额（例如同时在多个帐户上操作应用程序）违反服务条款，并可能导致应用程序被禁用或帐户关闭。
<div class="bpctrl" style="height: 30px; line-height: 30px; overflow-x: hidden; overflow-y: hidden; clear: both; "></div>
<div class="clear" style="clear: both; font-size: 0px; line-height: 0; height: 0px; visibility: visible; "></div>
</div>
<div class="clear" style="clear: both; font-size: 0px; line-height: 0; height: 0px; visibility: visible; font-family: arial, 宋体, sans-serif; "></div>
<div class="reinforce" id="lemmaExtend" style="font-size: 12px; font-family: arial, 宋体, sans-serif; line-height: 24px; "><dl class="nslog-area" data-nslog-type="2" id="viewRefer" style="margin-top: 0px; margin-right: 0px; margin-bottom: 30px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><dt style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 5px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: #cccccc; font-weight: bold; line-height: 1; font-size: 14px; ">参考资料</dt><dd class="reference" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; word-wrap: break-word; word-break: break-all; ">
<ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">
    <li class="layout" style="margin-top: 12px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; zoom: 1; width: 690px; font-size: 12px; "><span class="ref-index" style="float: left; "><span class="r-index" style="float: left; font-size: 10px; font-weight: bold; height: 16px; line-height: 16px; text-align: right; padding-left: 4px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeeeee; color: #999999; background-position: initial initial; background-repeat: initial initial; ">1</span></span>
    <div class="ref-bd line-1" style="margin-left: 26px; ">
    <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">谷歌欲借云计算应用软件Google Apps打进企业挑战Office<a class="ref-top" href="http://baike.baidu.com/view/1524918.htm#ref_[1]" id="refIndex_1" name="refIndex_1" title="向上跳转" style="text-decoration: none; color: #136ec2; width: 12px; height: 12px; overflow-x: hidden; overflow-y: hidden; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; margin-left: 4px; background-image: url(http://img.baidu.com/img/baike/s/up_down.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: -1px -78px; background-repeat: no-repeat no-repeat; ">&nbsp;&nbsp;</a></p>
    <p class="refUrl" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://www.cloudcomputing-china.cn/Article/cloudcomputing/200807/142.html" target="_blank" style="text-decoration: underline; color: #136ec2; ">http://www.cloudcomputing-china.cn/Article/cloudcomputing/200807/142.html</a></p>
    </div>
    </li>
</ul>
</dd></dl><dl class="nslog-area" data-nslog-type="1" id="viewExtRead" style="margin-top: 0px; margin-right: 0px; margin-bottom: 30px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><dt style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 5px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: #cccccc; font-weight: bold; line-height: 1; font-size: 14px; ">扩展阅读：</dt><dd class="reference" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; word-wrap: break-word; word-break: break-all; ">
<ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">
    <li class="layout" style="margin-top: 12px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; zoom: 1; width: 690px; font-size: 12px; "><span class="ref-index" style="float: left; "><span class="r-index" style="float: left; font-size: 10px; font-weight: bold; height: 16px; line-height: 16px; text-align: right; padding-left: 4px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeeeee; color: #999999; background-position: initial initial; background-repeat: initial initial; ">1</span></span>
    <p class="ref-bd line-1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 26px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a target="_blank" href="http://code.google.com/intl/zh-CN/appengine/docs/whatisgoogleappengine.html" style="text-decoration: underline; color: #136ec2; ">http://code.google.com/intl/zh-CN/appengine/docs/whatisgoogleappengine.html</a></p>
    </li>
    <li class="layout" style="margin-top: 12px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; zoom: 1; width: 690px; font-size: 12px; "><span class="ref-index" style="float: left; "><span class="r-index" style="float: left; font-size: 10px; font-weight: bold; height: 16px; line-height: 16px; text-align: right; padding-left: 4px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeeeee; color: #999999; background-position: initial initial; background-repeat: initial initial; ">2</span></span>
    <p class="ref-bd line-1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 26px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a target="_blank" href="http://www.cloudcomputing-china.cn/" style="text-decoration: underline; color: #136ec2; ">http://www.cloudcomputing-china.cn</a></p>
    </li>
    <li class="layout" style="margin-top: 12px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; zoom: 1; width: 690px; font-size: 12px; "><span class="ref-index" style="float: left; "><span class="r-index" style="float: left; font-size: 10px; font-weight: bold; height: 16px; line-height: 16px; text-align: right; padding-left: 4px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeeeee; color: #999999; background-position: initial initial; background-repeat: initial initial; ">3</span></span>
    <p class="ref-bd line-1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 26px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a target="_blank" href="http://china-app-blog.appspot.com/" style="text-decoration: underline; color: #136ec2; ">http://china-app-blog.appspot.com</a></p>
    </li>
    <li class="layout" style="margin-top: 12px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; zoom: 1; width: 690px; font-size: 12px; "><span class="ref-index" style="float: left; "><span class="r-index" style="float: left; font-size: 10px; font-weight: bold; height: 16px; line-height: 16px; text-align: right; padding-left: 4px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeeeee; color: #999999; background-position: initial initial; background-repeat: initial initial; ">4</span></span>
    <p class="ref-bd line-1" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 26px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Google提供的免费域名：appspot.com</p>
    </li>
</ul>
</dd></dl></div>
</div>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/349279.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-04-29 15:05 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349279.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Google App Engine和Amazon EC2谁更强（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349278.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Fri, 29 Apr 2011 07:00:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349278.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/349278.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349278.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/349278.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/349278.html</trackback:ping><description><![CDATA[转自：<a href="http://tech.163.com/digi/10/1111/06/6L6IS5NO001618J7.html">http://tech.163.com/digi/10/1111/06/6L6IS5NO001618J7.html</a>
<div>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">最近一个潜在客户要求我们比较一下Amazon EC2和Google App Engine，正好我们刚刚在EC2和Google App Engine上完成了两个相对来说规模较大的项目，因此有必要做一下总结，我打算从三个角度来对比这两大云计算平台：技术，业务和未来发展趋势，本文是技术方面的对比，ok，准备好咖啡，我们开始吧!</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  如果按平台类型来分，大家可能已经知道Google App Engine属于PaaS(平台即服务)，而Amazon EC2属于IaaS(基础设施即服务)，Amazon EC2给你一个安装了操作系统的&#8220;盒子&#8221;，你可以自己安装应用程序，也可以使用AMI(Amazon Machine Image)，如果你想构建一个高度复杂的定制应用，Amazon EC2是不二之选，它允许你控制环境参数，底层操作系统，存储和网络需求，从技术上讲，它属于很底层的服务，你可以调整你需要的大部分东西。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  Google App Engine给你一个完整的平台，包括完整的SDK(以及Eclipse插件)和服务，你可以构建和部署你自己的应用程序，但你不能很好地控制操作系统，硬件和存储，诸如写文件系统，使用线程等操作都有限制，这样设计的目的是为了确保平台不会被某个应用程序绑架。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  简单起来就是：</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  IaaS：原始硬件(处理器，网络和存储)</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  PaaS：操作系统，系统软件，开发框架和虚拟机。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>下面从技术角度来比较一下这两个平台。</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; "><strong>  1、提供的服务</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  Google App Engine凭借丰富的服务击败Amazon EC2，Google App Engine提供的服务可以让开发人员快速进入开发状态。如Blobstore，Images，Mail，Memcache，Multitenancy，Oauth，Task Queues，URL Fetch，Users，XMPP这些服务在Amazon EC2上是需要自己安装的，为了便于比较，假设你已经为Memcache，Mail和多租户搭建好了基础设施，看看在EC2上你用了多长时间安装，我敢打赌你会超过一个小时，使用Google App Engine时，这些服务都是现成的，就象果盘中插好牙签的水果一样，你可以随时享用。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>2、管理</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  Google App Engine再次胜出，因为一旦你的应用程序部署成功后，它几乎不需要管理，当你的应用程序负载变大时，你不需要向服务注入新的实例，Google App Engine可以自由扩大负载能力，新实例是实时剥离的。使用Amazon EC2时，你必须时刻跟踪通信流量(现在可以通过脚本自动跟踪了)，新实例是在你的配置基础上剥离的，因此，如果我的峰值负载是2x+y，那么需要剥离2个以上的应用程序服务器。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  此外，使用Google App Engine升级应用程序服务器实例，安装新的负载均衡器时，没有管理开销，这一切都是自动执行的。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>3、抽象水平</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  和上一条联系紧密的是抽象水平，Google App Engine抽象得比较好，你只需要关心你的应用程序和业务逻辑，不用担心底层基础设施的管理，正如Nick Johnson所说的那样，抽象水平应作为挑选云计算平台的一个基本原则，你需要做的是驾驶，不需要研究引擎盖以下的东西。在我看来，如果你的核心业务是货物运输，那么你应该买一辆卡车，它能高效地把你的货物从A地运输到B地，相反，你不应该考虑如何购买零部件自己组装一辆卡车。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  在软件开发领域，我们看到有Grails，RoR等框架，它们大受欢迎，是因为它们提供了高水平的抽象，如果你是一名泥瓦匠，它们就象是脚手架，你可以踩在它们上面干你的工作。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>4、可靠性</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  从我个人的认识来讲，两者都很可靠，这一点从它们的用户数量就可以知道一二，用户可以时刻查看Google App Engine的状态，它是透明的，但从历史数据来看，Amazon EC2的正常运行时间比Google App Engine要好。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>5、可移植性</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  从使用的底层操作系统和开发框架来看，Amazon EC2具有更好的可移植性，但也不要担心你会被Google App Engine给锁住，Google已经给出了迁移指南，指导你如何从转移出Google App Engine平台，当然包含你所有的数据在内。还有AppScale这样的程序可以帮助你将Google App Engine上的程序转移到Amazom EC2或其它云平台上，AppScale已经可以支持EC2，Eucalyptus，Xen和KVM。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>6、存储</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  Google App Engine目前严重依赖于BigTable，开发人员需要从一个完全不同的角度来认识和学习它，特别是对于那些特熟悉关系数据库，被关系数据库理论束缚的人更需要洗洗脑，它提供了一个JPA&amp;JDO访问接口，但它不支持所有的JPA&amp;JDO功能，特别是关系部分，Google最近也高调宣布要让Google App Engine支持传统的SQL数据库。Amazon EC2已经支持SQL数据库，你可以使用Oracle，MySQL等你所熟悉的关系数据库。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>7、应用程序维护和升级</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  对Google App Engine来说，应用程序维护和升级是件轻而易举的事，它为各种应用程序提供了一个详细的管理面板，包括日志查看器和数据查看器，一个程序可以有多个版本，当新版本经过测试，可以用于生产环境时，你可以将其设为默认的版本，而Amazon EC2就麻烦多了，因为它属于IaaS类型，所有维护和升级相关的事情你必须亲力亲为。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>8、开发限制</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  使用Google App Engine时，你必须受到平台的限制，如果你的查询处于僵死状态，很难将其杀掉，此外，Google App Engine没有线程，提供的SDK也是受限的，有些类和功能被列入黑名单，因此不能被使用，也不能写文件系统等等。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  从表面上看这些限制是不可理喻的，但如果有朝一日你也要提供PaaS类型的平台时，你就能理解为什么Google要做这些限制了，这样才能确保运行在平台上的应用程序不会违反平台的规则，否则平台就可能被应用程序绑架，从而变得不可使用，平台上的其它应用程序就会收到牵连。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  即便有这些限制，90%的商业应用程序仍然可以在Google App Engine上正常运行，但对于那些要使用线程，或写文件系统的应用，最好还是选择Amazon EC2，因为它提供了所有底层访问和控制权。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  <strong>9、语言支持</strong></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  截至目前，Google App Engine支持Java和Python，但任何可以转换成字节码，可在JVM上执行的任何编程语言都可以在Google App Engine上运行，如果你喜欢其它编程语言，最好选择Amazon EC2，因为你可以在它的操作系统上面安装语言运行时环境，你拥有几乎完整的硬件和操作系统控制权，还有什么不能做的呢?在Amazon EC2上也托管了许多有趣的C#，.NET，ASP.NET MVC/Visual Studio项目，具有讽刺意味着的是，尽管还有Microsoft Azure，但许多以MS技术开发的项目却托管在Amazon EC2上。</p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; "></p>
<p style="font-size: 14px; line-height: 23px; text-indent: 2em; color: #2b2b2b; font-family: 宋体, serif; ">  概括地说，Amazon EC2是进入云计算的早期尝试者，它利用互联网标准和开放平台创建了一个非常灵活的云计算平台，Google则利用了它在大型数据库方面的研究成果和它内部实现的一些技术创建了一个强大，但有更多限制的云计算环境。从核心技术来讲，Amazon EC2允许你扩展任何计算机实例到多个实例，因此你拥有每个虚拟盒子的完全控制权，Google App Engine从操作系统抽象而来，没有计算机实例的概念，如果你的Web应用程序不需要操作系统相关的功能，那么Google App Engine无疑是最好的选择，如果需要更好地控制你的系统环境，特别是操作系统相关的控制，那么最好选择Amazon EC2。</p>
</div>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/349278.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-04-29 15:00 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/04/29/349278.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发环境搭建全程演示（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/04/20/348623.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Wed, 20 Apr 2011 06:15:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/04/20/348623.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/348623.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/04/20/348623.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/348623.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/348623.html</trackback:ping><description><![CDATA[转自：http://www.hzlitai.com.cn/article/ARM11/SYSTEM/android.html<br />
<br />
<p>一 相关下载</p>
<p>(1) java JDK下载:</p>
<p>进入该网页: <a href="http://java.sun.com/javase/downloads/index.jsp">http://java.sun.com/javase/downloads/index.jsp</a> (或者直接<a href="http://cds-esd.sun.com/ESD6/JSCDL/jdk/6u19-b04/jdk-6u19-windows-i586.exe?AuthParam=1270206602_6c9f792e352fc522c4403f147158a87e&amp;TicketId=nodzAF4XQ3F%2FkeIukUaZUpmdcw%3D%3D&amp;GroupName=CDS&amp;FilePath=/ESD6/JSCDL/jdk/6u19-b04/jdk-6u19-windows-i586.exe&amp;File=jdk-6u19-windows-i586.exe" target="_blank">点击下载</a>)如下图:<span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710400.jpg" border="0" small="0" /><br />
选择 Download JDK 只下载JDK，无需下载jre. </span></p>
<p><span>(2)eclipse下载</span></p>
<p><span>&nbsp;&nbsp; 进入该网页: <a href="http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a> (或者直接点击下载:<a href="http://build.eclipse.org/technology/phoenix/torrents/jee/eclipse-jee-galileo-SR2-win32.zip.torrent" target="_blank">BT下载</a>&nbsp;&nbsp;&nbsp; <a href="http://download.actuatechina.com/eclipse/technology/epp/downloads/release/galileo/SR2/eclipse-jee-galileo-SR2-win32.zip" target="_blank">HTTP下载</a>) 如下图:</span></p>
<p><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710401.jpg" width="695" border="0" small="0" /><br />
我们选择第一个(即eclipse IDE for java EE Developers)</span></span></p>
<p><span><span>(3)下载Android SDK</span></span></p>
<p><span><span>&nbsp;&nbsp; 说明: Android SDK两种下载版本，一种是包含具体版本的SDK的，一种是只有升级工具，而不包含具体的SDK版本，后一种大概20多M，前一种70多M。</span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp; <a href="https://dl-ssl.google.com/android/repository/android-2.1_r01-windows.zip" target="_blank">完全版下载</a> (android sdk 2.1 r01)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://dl.google.com/android/android-sdk_r04-windows.zip" target="_blank">升级版下载</a> (建议使用这个，本例子就是使用这个这里面不包含具体版本，想要什么版本在Eclipse里面升级就行)</span></span></p>
<p><span><span>二 软件安装</span></span></p>
<p><span><span>&nbsp;&nbsp; (1)安装jdk 6u19&nbsp;&nbsp; 安装完成即可，无需配置环境变量</span></span></p>
<p><span><span>&nbsp;&nbsp; (2)解压eclipse&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eclipse无需安装，解压后，直接打开就行</span></span></p>
<p><span><span>&nbsp;&nbsp; (3)解压android sdk&nbsp;&nbsp;&nbsp;&nbsp; 这个也无需安装，解压后供后面使用</span></span></p>
<p><span><span>&nbsp;&nbsp; (4)最终有三个文件夹，如下图:</span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;<span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710402.jpg" width="695" border="0" small="0" /><br />
</span></span></span></p>
<p><span><span>三 Eclipse配置</span></span></p>
<p><span><span>&nbsp;&nbsp; 1 安装android 开发插件</span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp; (1)打开Eclipse, 在菜单栏上选择 help-&gt;Install New SoftWare 出现如下界面:</span></span></p>
<p><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710403.jpg" width="695" border="0" small="0" /><br />
</span></span></span></p>
<p><span><span><span>&nbsp;&nbsp;&nbsp; 点击 Add按钮,出现如下界面</span></span></span></p>
<p><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710404.jpg" border="0" small="0" /><br />
</span></span></span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp; 输入网址: <a href="https://dl-ssl.google.com/android/eclipse/">https://dl-ssl.google.com/android/eclipse/</a>&nbsp;&nbsp;&nbsp; (如果出错，请将https改成http)</span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp; 名称: Android (这里可以自定义)</span></span></p>
<p><span><span>&nbsp;&nbsp; 点击OK，将出现如下界面</span></span></p>
<p><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710405.jpg" width="695" border="0" small="0" /><br />
</span></span></span></p>
<p><span><span>点击 Next按钮 ，出现如下界面:</span></span></p>
<p><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710406.jpg" width="695" border="0" small="0" /><br />
</span>&nbsp;&nbsp;</span></span></p>
<p><span><span>点击Next按钮，出现如下界面:</span></span></p>
<p><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710407.jpg" width="695" border="0" small="0" /><br />
</span></span></span></p>
<p><span><span><span>选择 I accept the terms of the license agreements&nbsp;&nbsp; 点击Next,进入安装插件界面</span></span></span></p>
<p><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710408.jpg" border="0" small="0" /></span></span></span></span></p>
<p><span><span><span><span>安装完成后，出现如下界面<br />
</span></span></span></span></p>
<p><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/1710409.jpg" border="0" small="0" /><br />
</span></span></span></span></p>
<p><span><span>点击Yes按钮，重启Eclipse</span></span></p>
<p><span><span>2 配置android sdk</span></span></p>
<p><span><span>&nbsp;&nbsp;&nbsp;&nbsp; (1)点击菜单window-&gt;preferences,进入如下界面</span></span></p>
<p><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104010.jpg" border="0" small="0" /><br />
</span></span></span></p>
<p><span><span><span>&nbsp;&nbsp; 选择你的android SDK解压后的目录，选错了就会报错，这个是升级工具，目前还没有一个版本的SDK</span></span></span></p>
<p><span><span><span>（2）升级SDK版本,选择菜单 window-&gt;Android sdk and avd manager 出现如下界面</span></span></span></p>
<p><span><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104011.jpg" width="695" border="0" small="0" /><br />
</span></span></span></span></p>
<p><span><span><span><span>&nbsp;&nbsp; 选择update all按钮，出现如下界面</span></span></span></span></p>
<p><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104012.jpg" width="695" border="0" small="0" /><br />
</span></span></span></span></span></p>
<p><span><span><span><span><span>选择左边的某一项，点击accept表示安装，点击reject表示不安装，我这里只选了SDK 2.1 和samples for api 7 , 自己可以任意自定义，确定后，选择install按钮，进入安装界面如下:</span></span></span></span></span></p>
<p><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104013.jpg" border="0" small="0" /></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span>安装完成如下:</span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104014.jpg" border="0" small="0" /></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span>(3)新建AVD(android vitural device)&nbsp;&nbsp;&nbsp; 和上面一样，进入android sdk and avd manager,选中Vitural Devices 在点击New按钮<span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104015.jpg" width="695" border="0" small="0" /><br />
</span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span>点击New按钮后，进入如下界面:</span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104016.jpg" border="0" small="0" /></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span>名称可以随便取，target选择你需要的SDK版本，SD卡大小自定义,点击 Create AVD,得到如下结果</span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104017.jpg" border="0" small="0" /></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span>如上显示创建AVD完毕<br />
</span><br />
</span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><br />
</span><br />
</span><br />
</span><br />
</span></span></span></span></span></span></p>
<p><span><span>3 新建Android项目</span></span></p>
<p><span><span>(1)选择菜单file-&gt;new-&gt;other 进入如下界面:</span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104018.jpg" border="0" small="0" /></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span>选择新建Android Project项目，点击Next按钮，进入如下界面</span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104019.jpg" border="0" small="0" /><br />
名称自定义，应用程序名自定义，报名必须包含一个点以上，min SDK version里面必须输入整数</span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span>点击Next出现如下界面:</span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104020.jpg" width="695" border="0" small="0" /><br />
注: 若有错误如: Project ... is missing required source folder: 'gen' ,则将gen-&gt;Android.Test-&gt;R.java这个文件删掉，Eclipse会为我们重新生成这个文件，并且不会报错。</span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span><span>(3)配置运行</span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span><span>&nbsp;&nbsp; 右键项目-&gt;Run as -&gt; Run Configuration 进入如下界面:<span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104021.jpg" width="695" border="0" small="0" /><br />
该界面，点击Browse 按钮，选择你要运行的项目</span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span><span><span>选择Target切换到以下界面</span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104022.jpg" width="695" border="0" small="0" /><br />
该界面选择运行的AVD，将AVD前面的方框设置为选择状态。</span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span><span><span><span><span><span><span><span><span><span><span><span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span><span>(4)测试项目运行</span></span></p>
<p><span><span>&nbsp;&nbsp; 右键项目名称-&gt;run as -&gt;Android Application 即可启动运行该Android程序，如下所示:</span></span></p>
<p><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104023.jpg" width="695" border="0" small="0" /><br />
</span></span></span></p>
<p><span><span><span>正在进入</span></span></span></p>
<p><span><span><span><span><img class="blogimg" alt="" src="http://www.hzlitai.com.cn/uploads/allimg/100719/17104024.jpg" width="695" border="0" small="0" /></span></span></span></span></p>
<p><span><span><span><span><br />
测试程序运行结果</span></span></span></span></p>
<p>&nbsp;</p>
<p><span><span><span><span>四 结束语</span></span></span></span></p>
<p><span><span><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 至此，android开发环境搭建完毕，有问题请留言。在这里要注意，我这里只是下载了android sdk r4升级工具，没有下载具体的SDK，而是通过在Eclipse里面的Android Sdk管理工具升级的，你也可以直接下载具体的SDK版本，如: Android sdk 2.1 r1 上面有这个的下载链接，但我任务用升级工具更好。</span></span></span></span></p>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/348623.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-04-20 14:15 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/04/20/348623.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Amazon的WEB服务（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/02/17/344548.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Thu, 17 Feb 2011 06:21:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/02/17/344548.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/344548.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/02/17/344548.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/344548.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/344548.html</trackback:ping><description><![CDATA[转自：http://www.cww.net.cn/zhuanti/html/2009/4/12/20095211347521767.htm
<div>
<div>&nbsp;&nbsp; &nbsp;作为一家网上书店和线上零售商，Amazon已经广为人知，但现在，Amazon的全新业务是云计算。两年多以前，云计算这块市场开始兴起，Amazon是当时为数不多的云计算提供商之一，在今天，全球有不少用户在计划接入&#8220;云&#8221;时都会考虑Amazon的服务。</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;Amazon的云计算服务总称为AmazonWebServices(AWS，Amazon WEB服务)，迄今它包括四种主要的服务：Simple Storage Service (S3，一种简单的存储服务)；Elastic Compute Cloud (EC2，弹性可扩展的云计算服务器)；Simple Queuing Service(一种简单的消息队列)；以及仍处在测试阶段的SimpleDB(简单的数据库管理)。换句话说，Amazon现在通过互联网提供存储、计算处理、消息队列(message queuing)、数据库管理系统等&#8220;即插即用&#8221;型的服务。</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;这些服务所需要的巨大的后台IT基础架构是Amazon的数据中心。不过，用户只需要对自己消费了的服务进行付费：S3存储是每月每GB为15美分，根据配置不同，EC2服务器容量是每小时10-80美分。</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;目前来看，AWS已经具备了云计算的三个基本特征：用户所需要的IT资源不在公司自己的数据中心里面，这些资源可以通过互联网获得，没有固定的投资成本。</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;Amazon所提供的第一种云服务是S3，它可以提供无限制的存储空间，让用户存放文档、照片、视频和其他数据。其后是EC2，用户可以选择不同的服务器配置，并对实际用到的计算处理量进行付费。</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;那么，Amazon为什么会如此大张旗鼓地进入WEB服务领域呢？其实，在它多年运作电子商务的过程中，Amazon就积累了非常强的技术经验，而且也对其数据中心进行了极大规模的投资建设。现在，它只是把其中一些资产开放出来，让其他企业去使用；同时，许多CIO也不想在自己的IT基础架构上花费更多的钱，希望能找到一种替代品，所以，双方一拍即合。负责AWS产品管理和开发者关系的副总裁AdamSelipsky就说，&#8220;很多人可能不理解的是，Amazon从根本上来说并不是一家书店或零售商，而是一家技术型公司。&#8221;</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;因为不再需要事先部署软件和服务器，从个人到大企业的许多开发人员已经开始登录Amazon的AWS平台来开发和提供应用软件。目前，使用Amazon的AWS服务的开发人员已经有37万人之多。</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;AWS起初的目标是中小企业，而不是大企业，但现在一些大企业也开始对AWS产生了兴趣，毕竟它能够降低前期投资成本，有伸缩自如的可扩展性以及灵活的IT资源。为了更好地支持这些大客户，Amazon几个月前已经开始提供全天侯的电话支持以及企业级水准的服务。举个例子，在一个月内，如果S3的可用性降到了99.9%以下，那么，客户就能获得至少10%的信用额度。当然，Amazon并非完美，近期它的客户也正面临着WEB站点访问速度变慢等一系列问题。</div>
<div><br />
</div>
<div>&nbsp;&nbsp; &nbsp;Amazon没想把自己变成一家SaaS提供商，但很多初创型小企业和其他软件开发人员正在使用AWS提供他们各自的SaaS产品。这里面包括Vertica，销售基于S3的数据仓库，以及Sonian，把它的文档服务构建在Amazon的基础架构之上。</div>
<div><br />
</div>
</div>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/344548.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-02-17 14:21 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/02/17/344548.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何构建Apache Wink REST服务（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/02/15/344316.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Tue, 15 Feb 2011 02:06:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/02/15/344316.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/344316.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/02/15/344316.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/344316.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/344316.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 转自：http://www.searchsoa.com.cn/showcontent_35288.htm　　首先简要介绍一下REST。REST代表Representational State Transfer，它是World Wide Web所依赖的一套架构原则。Roy Fielding在他的博士论文&#8220;Architectural Styles and the Design of...&nbsp;&nbsp;<a href='http://www.blogjava.net/hengheng123456789/archive/2011/02/15/344316.html'>阅读全文</a><img src ="http://www.blogjava.net/hengheng123456789/aggbug/344316.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-02-15 10:06 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/02/15/344316.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HTML5崛起 2011年五大网络前端技术展望（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342879.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Wed, 12 Jan 2011 07:54:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342879.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/342879.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342879.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/342879.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/342879.html</trackback:ping><description><![CDATA[转自：http://labs.chinamobile.com/news/48136
<div>
<div style="float: left; width: 567px; margin-top: 15px; padding-top: 10px; padding-right: 10px; padding-bottom: 8px; padding-left: 15px; border-left-color: #ededed; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; line-height: 24px; color: #666666; font-family: 宋体, Arial, Helvetica, sans-serif; font-size: 12px; "><span style="color: #006797; font-size: 14px; ">内容摘要：</span><span style="color: #666666; font-size: 14px; "><a alt="" title="" style="color: #000000; text-decoration: none; ">2011年将会有什么web前端技术出现或者成熟？以下列举了5个web技术以及技术趋势，我们认为这些技术应该会在今年进入我们的视线范围，有些列举项虽然不是具体的web开发技术，但无论如何，都会或多或少的影响到我们。</a></span></div>
<div class="contentarea" style="width: 575px; margin-top: 20px; padding-top: 0px; padding-right: 8px; padding-bottom: 0px; padding-left: 10px; display: inline; font-size: 14px; overflow-x: hidden; float: left; color: #000000; line-height: 24px; font-family: 宋体, Arial, Helvetica, sans-serif; "><a style="color: #000000; text-decoration: none; ">
<p>　　刚刚过去的2010年里，我们看到了 HTML5技术的崛起，以及CSS3的日渐成熟，经历了Rails 3.0 新版本的推出，以及全球范围内采用的@font-face selector 技术（属于CSS3 部分内容）等等一些更多的新技术和新鲜事情。总之，2010年对于web前端开发人员来说是一个忙碌的一年。<br />
<br />
2011年将会有什么web前端技术出现或者成熟？以下列举了5个web技术以及技术趋势，我们认为这些技术应该会在今年进入我们的视线范围，有些列举项虽然不是具体的web开发技术，但无论如何，都会或多或少的影响到我们。<br />
<br />
1.&nbsp;<strong>jQuery Mobile</strong>&nbsp;jQuery 移动应用<br />
<br />
jQuery 已经成为JavaScript事实上的代名词，很大程度上是因为其可扩展性，易用性以及在项目管理方面可控。随着用于平板电脑和智能手机等设备的触屏优化技术的演进，以及与此相关的web框架的发展，jQuery Mobile 将成为跨平台，支持多设备的手机应用的非常重要的技术选择之一。<br />
<br />
越来越多的开发者开始考虑使用html5技术来开发移动应用，建立一个稳定的易用性好的JavaScript框架将成为移动技术开发人员的重要选择。jQuery Mobile具备成为这一框架的事实上的基础。（因jQuery目前的应用范围相当广泛和普遍）&nbsp;<br />
<br />
2.&nbsp;<strong>Hardware-Accelerated Web Browsers</strong>&nbsp;浏览器硬件加速技术<br />
<br />
由于ie9使用了 DirectX10以及硬件加速技术，大幅度提高了浏览器的速度和承载能力，因此Internet Explorer 9 (IE9) 目前相对于其他竞争对手来说速度奇快。Google 和 Mozilla 必然会争先抢后地使用这些相关技术譬如硬件加速技术来应对来自 IE9的压力和竞争。今年，我们大家的浏览器定会飞速，对我们大家绝对是利好消息。<br />
<br />
3.<strong>&nbsp;Node.js 技术以及服务端JavaScript技术</strong><br />
<br />
Node.js技术被很多网站描述成为 事件驱动的 JavaScript V8 引擎。本质上，他是一个工具，为了用JavaScript技术来编写服务端事件驱动的工具集。什么意思？简单的说，技术编程的时候，根本不需要等待 一个输入输出I/O 操作完成才能去进行另一个输入输出操作。对于 Node.js 来说，意味着它可以在服务端做所有数据运算等工作，减轻了客户端的压力。对于一些数据处理类的app应用来说，像是像 实时应用、搜索引擎web爬虫、文件上传，流媒体技术等等，速度是至关重要的首要环节。<br />
<br />
Node.js 作为web前端技术实现显示层扩展到使用服务端JavaScript技术，将在 2011年受到广泛的应用。想了解更多的技术原理等详情，请查看 Simon Willison 的博客。<br />
<br />
4.&nbsp;<strong>点击分享实时化 Real-Time Clickstream Sharing</strong>&nbsp;（点击分享后立即呈现该分享内容到社区或者网站等）<br />
<br />
有无数多的方法来实现将用户分享的内容呈现到互联网上，包括今年出现的一些社交网站分享或者一些在线分享或者在线发布工具等。随着大规模集成分享按钮的应用，以及逐渐采用客户端、weidget页面组件、和在线书签等的应用方式，这，将使分享越来越容易和简便。实时分享的下一方向将会是个人在线阅历或经验分享，在 2011年，这点将会决定互联网是否更加好用。<br />
<br />
5.&nbsp;<strong>No SQL Databases</strong>&nbsp;无需SQL语句的数据库技术<br />
<br />
NoSQL，是一个泛定义词汇，用来说明取代现有使用SQL的数据技术，这种NoSql技术不会采用目前已经广泛使用的传统关系型数据库技术。这种NoSQL技术近些年已经开始兴盛。无表数据库技术已经被Google Amazon 谷歌和亚马逊等巨头所关注，其取代技术有 Google的 BigTable技术和 亚马逊Amazon的 Dynamo技术，阿帕奇的Apache Cassandra, MongoDB, CouchDB, Voldemort 以及Riak技术等等。<br />
<br />
诚然，不同的技术实现不代表着新技术是更好的，我们肯定不会像扔掉小孩子一样轻易放弃原有技术，技术实现的过程总是有所取舍。就像Ted Dziuba wrote所说，&#8220;by replacing MySQL or Postgres with a different, new data store, you have traded a well-enumerated list of limitations and warts for a newer, poorly understood list of limitations and warts.&#8221;（大致意思为：选择取代 MySQL或者 Postgres数据库技术，而使用一个新的不同的技术方案，就意味着你已经使用了一个有很多局限性的不成熟技术，来取代另一个毛病多多的旧技术。）<br />
<br />
尽管如此，NoSQL技术在 2011年仍然将是唯一的一个取代目前关系型数据库的新技术，这个新技术在过去几年发展，一直朝着这个方向发展。</p>
</a></div>
</div>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/342879.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-01-12 15:54 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342879.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>揭秘全球最大网站Facebook背后的那些软件（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342876.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Wed, 12 Jan 2011 07:35:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342876.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/342876.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342876.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/342876.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/342876.html</trackback:ping><description><![CDATA[转自：http://www.javaeye.com/news/16925
<div>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; "><strong style="font-weight: bold; ">2010年6月，Google公布全球Top 1000网站。Facebook独占鳌头。</strong><br />
&nbsp;</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-align: center; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; "><img src="http://dl.javaeye.com/upload/attachment/278864/d55098b6-32f9-39c6-921e-ee838a910df0.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-align: center; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; ">&nbsp;</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; ">以Facebook现在的经营规模，诸多传统服务器的技术均将崩溃或根本无法支撑。那么面对5亿的活跃用户，Facebook的工程师们又将如何让网站平稳运转呢？伯乐在线 - 职场博客的这篇文章将展示Facebook的工程师完成这个艰巨任务所用到的一系列软件。<br />
<br />
<br />
&nbsp;<span style="font-size: medium; "><strong style="font-weight: bold; ">Facebook级别规模的挑战</strong></span><br />
<br />
在我们深入细节之前，先了解一组Facebook不得不面对数据，你就可以想象这种规模。</p>
<ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; ">
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Facebook每月的PV量：630,000,000,000 （6万3千亿）</li>
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Facebook上的图片数量超过其他图片网站的总和（包括诸如Flickr这样的图片网站）</li>
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">每个月有超过30亿的图片上传到Facebook</li>
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Facebook系统每秒可以处理120万张图片。这还不包括Facebook的CDN处理的图片。</li>
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">每月处理超过250亿的信息内容（包括用户状态更新，评论等）</li>
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Facebook的服务器数量超过3万台（此数据为2009年的数据）</li>
</ul>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; "><br />
<br />
&nbsp;<span style="font-size: medium; "><strong style="font-weight: bold; ">Facebook所用的软件</strong></span><br />
<br />
从某些方面来说，Facebook还是属于LAMP类型网站，但是，为了配合其他大量的组件和服务，Facebook对已有的方法，已经做了必要的改变、拓展和修改。<br />
<br />
比如：</p>
<ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; ">
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Facebook依然使用PHP，但Facebook已重建新的编译器，以满足在其Web服务器上加载本地代码，从而提升性能；</li>
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Facebook使用Linux系统，但为了自身目的，也已做了必要的优化。（尤其是在网络吞吐量方面）；</li>
    <li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Facebook使用MySQL，但也对其做优化。</li>
</ul>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 14px; line-height: 25px; "><br />
还有定制的系统，比如， Haystack -- 高度可扩展的对象存储，用来处理Facebook的庞大的图片；Scribe -- Facebook的日志系统。<br />
<br />
下面展现给大家的是，全球最大的社交网站Facebook所使用到的软件。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">Memcached&nbsp;</strong></span>&nbsp;<img src="http://dl.javaeye.com/upload/attachment/278866/392adbec-35d9-3454-817e-dd2e4286e13b.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
Memcached是一款相当有名的软件。它是分布式内存缓存系统。Facebook(还有大量的网站)用它作为Web服务器和MySQL服务器之间的缓存层。经过多年，Facebook已在Memcached和其相关软件（比如，网络栈）上做了大量优化工作。<br />
<br />
Facebook运行着成千上万的Memcached服务器，借以及时处理TB级的缓存数据。可以这样说，Facebook拥有全球最大的Memcached设备。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">HipHop for PHP&nbsp;</strong></span>&nbsp;<img src="http://dl.javaeye.com/upload/attachment/278868/d040485c-4fe5-31a6-a717-fff07afc84a6.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
和运行在本地服务器上代码相比，PHP的运行速度相对较慢。HipHop把PHP代码转换成C++代码，提高编译时的性能。因为Facebook很依赖PHP来处理信息，有了HipHop，Facebook在Web服务器方面更是如虎添翼。<br />
<br />
HipHop诞生过程：在Facebook，一小组工程师（最初是3位）用了18个月研发而成。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">Haystack&nbsp;</strong></span>&nbsp;<img src="http://dl.javaeye.com/upload/attachment/278870/e4de0499-ed77-374a-b103-0437781b39a3.jpg" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
Haystack是Facebook高性能的图片存储/检索系统。（严格来说，Haystack是一对象存储，所以它不一定要存储图片。）Haystack的工作量超大。Facebook上有超过2百亿张图片，每张图片以四种不同分辨率保存，所以，Facebook有超过8百亿张图片。<br />
<br />
Haystack的作用不单是处理大量的图片，它的性能才是亮点。我们在前面已提到，Facebook每秒大概处理120万张图片，这个数据并不包括其CDN处理的图片数。这可是个惊人的数据！！！<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">BigPipe&nbsp;</strong></span>&nbsp;<img src="http://dl.javaeye.com/upload/attachment/278872/3a895df7-b738-30d3-8a15-5c4b7ac8220f.jpg" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
BigPipe是Facebook开发的动态网页处理系统。为了达到最优，Facebook用它来处理每个网页的分块（也称&#8220;Pagelets&#8221;）。<br />
<br />
比如，聊天窗口是独立检索的，新闻源也是独立检索的。这些Pagelets是可以并发检索，性能也随之提高。如此，即使网站的某部分停用或崩溃后，用户依然可以使用。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">Cassandra&nbsp;</strong></span>&nbsp;<img src="http://dl.javaeye.com/upload/attachment/278874/2d78cb30-c9d4-3783-af8e-538ce9442cf9.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
Cassandra是一个没有单点故障的分布式存储系统。它是前NoSQL运动的成员之一，现已开源（已加入Apache工程）。Facebook用它来做邮箱搜索。<br />
<br />
除了Facebook之外，Cassandra也适用于很多其他服务，比如Digg。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">Scribe&nbsp;</strong></span>&nbsp;<img src="http://dl.javaeye.com/upload/attachment/278876/b0e0e5b3-e604-37e1-9ecd-eb41a26a84dc.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
Scribe是个灵活多变的日志系统，Facebook把它用于多种内部用途。Scribe用途：处理Facebook级别日志，一旦有新的日志分类生成，Scribe将自动处理。（Facebook有上百个日志分类）。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">Hadoop and Hive</strong></span><img src="http://dl.javaeye.com/upload/attachment/278878/9d008846-7a72-32f2-ab7b-d90bc2dc5535.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
Hadoop是款开源Map/Reduce框架，它可以轻松处理海量数据。Facebook用它来做数据分析。（前面就说到了，Facebook的数据量是超海量的。）Hive起源于Facebook，Hive可以使用SQL查询，让非程序员比较容易使用Hadoop。（注1: Hive是是基于Hadoop的一个数据仓库工具，可以将结构化的数据文件映射为一张数据库表，并提供完整的sql查询功能，可以将sql语句转换为 MapReduce任务进行运行。 ）<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">Thrift</strong></span>&nbsp;<br />
<br />
Facebook在其不同的服务中，使用了不同的语言。比如: PHP用在前端，Erlang用于聊天系统，Java和C++用于其它地方，等等。Thrift是内部开发的跨语言的框架，把不同的语言绑定在一起，使之可以相互&#8220;交流&#8221;。这就让Facebook的跨语言开发，变得比较轻松。<br />
<br />
Facebook已把Thrift开源，Thrift支持的语言种类将更多。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">Varnish&nbsp;</strong></span>&nbsp;<img src="http://dl.javaeye.com/upload/attachment/278880/f3487ae6-f9ab-38cd-9392-0f09f02c29ef.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br />
&nbsp;<br />
<br />
Varnish是一个HTTP加速器，担当负载均衡角色，同时也用于快速处理缓存内容。<br />
<br />
Facebook用Varnish处理图片和用户照片，每天都要处理十亿级的请求。和Facebook其他的应用应用一样，Varnish也是开源的。<br />
<br />
&nbsp;<span style="font-size: medium; "><strong style="font-weight: bold; ">Facebook可以平稳运行，还得利于其他方面</strong></span><br />
<br />
虽然上面已经提到了一些构成Facebook系统的软件，但是处理如此庞大的系统，本身就是一项复杂的任务。所以，下面还将列出使Facebook能平稳运行的一些东西。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">逐步发布&amp;暗启动</strong></span><br />
<br />
Facebook有一个系统，他们称之为&#8220;门卫&#8221;。该系统可以针对不同种类的用户运行不同的代码。（它简单介绍了代码库中的不同条件。）该系统让Facebook逐步发布新特性、A/B测试、激活仅针对Facebook员工的特性 等等。<br />
<br />
门卫系统也让Facebook做些&#8220;暗启动&#8221;的事情。比如，在某一特性上线之前，可以激活该特性背后的元件。另外，它还可以做模拟压力测试，发现瓶颈和潜在的问题。默默启动一般都是在正式启动之前的2周完成。<br />
<br />
&nbsp;<strong style="font-weight: bold; "><span style="font-size: small; ">实时系统的简介</span></strong><br />
<br />
Facebook会仔细监控自身系统，有趣的是，它还监控每个PHP函数在实时生产环境下的性能。这一实时PHP环境监控是通过一个叫XHProf的开源工具完成的。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">逐步禁用某些特性，借以提高性能</strong></span><br />
<br />
如果Facebook遇到性能问题，Facebook有大量的途径来逐步禁用不很重要的特性，以提高其核心特性性能。<br />
<br />
&nbsp;<span style="font-size: small; "><strong style="font-weight: bold; ">尚未提到的东西</strong></span><br />
<br />
虽然这里无法过多深入硬件方面，但硬件绝对是Facebook能达到空前规模的重要因素。比如，和其他大型网站一样，Facebook也用CDN来处理静态内容。Facebook还在美国西部的俄勒冈州建有一超大的数据中心，可以随时增加服务器。<br />
<br />
当然了，除了前面已经提到的，还有其他大量的软件没有说到。但是，希望能突出其中非常有特色的。<br />
<br />
&nbsp;<strong style="font-weight: bold; "><span style="font-size: medium; ">Facebook和开源之间的&#8220;恋情&#8221;</span></strong><br />
<br />
Facebook和开源之间联系，此文不能不提，虽不能说Facebook是多么地钟爱开源，但至少可以这样说，Facebook是&#8220;爱&#8221;着开源的。<br />
<br />
Facebook不仅使用（也捐赠）开源软件，比如，Linux、Memcached、MySQL、Hadoop等等，它还内部开发不少软件，并且也将之开源。<br />
<br />
Facebook开发的开源工程，包括HipHop、Cassandra、Thrift和Scribe。另外，Facebook也把Tornado开源了。Tornado是一个高性能的Web服务器框架，由FriendFeed幕后团队开发而成。（2009年8月，Facebook收购 FriendFeed。）<br />
<br />
（Facebook所用到的开源软件，可以在Facebook的开源页面找到。）<br />
<br />
&nbsp;<span style="font-size: medium; "><strong style="font-weight: bold; ">面临更多的大规模挑战</strong></span><br />
<br />
Facebook以一种令人难以置信的速度成长。它的用户群几乎是成倍增加，活跃用户数量现已接近5亿。而且，谁都无法预测今年底，活跃用户量会到多少。<br />
<br />
Facebook甚至成立了一个专门的&#8220;成长小组&#8221;，该小组不断思考如何让人们使用facebook并融入到facebook中。<br />
<br />
这一快速成长，意味着Facebook将遇到不同的性能瓶颈。Facebook会面临来这如下方面的挑战：PV、搜索、上传的图片和状态消息，用户之间的交互和用户和Facebook之间的交互带来的挑战。<br />
<br />
这也是Facebook面对的事实。Facebook的工程师们将继续寻求新方法来扩展（这不只是增加服务器的问题了）。比如，随着网站成长，其图片存储系统已经多次完全重写。<br />
<br />
所以，我们将看到Facebook的工程师们奔向下一个&#8220;山头&#8221;。我们相信他们不会辜负众望。毕竟，他们正跨越山头，那个我们大多数人仅能向往的山头；他们正扩展网站，那个用户来自全球各地的网站。当你实现那个里程碑时，你将彪炳史册。</p>
</div>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/342876.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-01-12 15:35 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342876.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HBase vs Cassandra: 我们迁移系统的原因（转）</title><link>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342852.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Wed, 12 Jan 2011 06:23:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342852.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/342852.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342852.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/342852.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/342852.html</trackback:ping><description><![CDATA[转自：http://wangxu.me/blog/?p=371
<div><span  style="color: #242626; font-size: 13px; font-family: 'Helvetica Neue', Arial, 'Lucida Grande', 'Lucida Sans Unicode', 'Microsoft YaHei', sans-serif; line-height: 20px; ">
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">原文:&nbsp;<a title="http://ria101.wordpress.com/2010/02/24/hbase-vs-cassandra-why-we-moved/" href="http://ria101.wordpress.com/2010/02/24/hbase-vs-cassandra-why-we-moved/" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">http://ria101.wordpress.com/2010/02/24/hbase-vs-cassandra-why-we-moved/</a>&nbsp;<br />
原作者：Dominic Williams&nbsp;<br />
原文发布日期：February 24, 2010 at 7:27 pm&nbsp;<br />
译者：王旭（<a href="http://wangxu.me/blog/" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">http://wangxu.me/blog/</a>&nbsp;, @gnawux）&nbsp;<br />
翻译时间：2010年3月21-25日</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">我的团队近来正在忙于一个全新的产品——即将发布的网络游戏&nbsp;<a href="http://translate.googleusercontent.com/translate_c?hl=en&amp;ie=UTF-8&amp;sl=en&amp;tl=zh-CN&amp;u=http://www.fightmymonster.com/&amp;prev=_t&amp;rurl=translate.google.com&amp;twu=1&amp;usg=ALkJrhh_x7GYSmfh1ly73ymLlymT_aahvQ" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">www.FightMyMonster.com</a>。这让我们得以奢侈地去构建一个全新的 NOSQL 数据库，也就是说，我们可以把恐怖的 MySQL sharding 和昂贵的可伸缩性抛在脑后了。最近有很多人一直在问，为什么我们要把注意力从 HBase 上转移到 Cassandra 上去。我确认，确实有这样的变化，实际上我们基本上已经把代码移植到了 Cassandra 上了，这里我将给出解释。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">为了那些不熟悉 NOSQL 的读者，后面的其他文章中，我会介绍为什么我们将会在未来几年中看到地震式的从 SQL 到 NOSQL 的迁移，这正和向云计算的迁移一样重要。后面的文章还会尝试解释为什么我认为 NOSQL 可能会是贵公司的正确选择。不过本文我只是解释我们选择 Cassandra 作为我们的 NOSQL 解决方案的选择。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">免责声明——如果你正在寻找一个捷径来决定你的系统选择，你必须要明白，这可不是一个详尽而严格的比较，它只是概述了另一个初创团队在有限时间和资源的情况下的逻辑。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">Cassandra 的血统是否预言了它的未来</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">我最喜欢的一个工程师们用来找 bug 的谒语是&#8220;广度优先而非深度优先&#8221;。这可以可能对那些解决技术细节的人来说很恼人，因为它暗示着如果他们只是看看的话，解决方法就会简单很多（忠告：只对那些能够原谅你的同事说这个）。我造出这个谒语的原因在于，我发现，软件问题中，如果我们强迫我们自己在进入某行代码的细节层面之前，先去看看那些高层次的考虑的话，可以节省大量时间。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">所以，在谈论技术之前，我在做 HBase 和 Cassandra 之间的选择问题上先应用一下我的箴言。我们选择切换的技术结论可能已经可以预测了：Hbase和Cassandra有着迥异的血统和基因，而我认为这会影响到他们对我们的业务的适用性。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">严格的说，Hbase 和它的支持系统源于著名的 Google BigTable 和 Google 文件系统设计（GFS 的论文发于 2003 年，BigTable 的论文发于 2006 年）。而 Cassandra 则是最近 Facebook 的数据库系统的开源分支，她在实现了 BigTable 的数据模型的同时，使用了基于 Amazon 的 Dynamo 的系统架构来存储数据（实际上，Cassandra 的最初开发工作就是由两位从 Amazon 跳槽到 Facebook 的 Dynamo 工程师完成的）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">在我看来，这些不同的历史也导致Hbase更加适合于数据仓库、大型数据的处理和分析（如进行Web页面的索引等），而 Cassandra 则更适合于实时事务处理和提供交互型数据。要进行系统研究来证明这个观点超出了本文的范畴，但我相信你在考虑数据库的时候总能发现这个差异的存在。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">注意：如果你在寻找一个简单的证明，你可以通过主要 committer 的关注点来进行验证：大部分 HBase 的 committer 都为 Bing 工作（M$ 去年收购了他们的搜索公司，并允许他们在数月之后继续提交开源代码）。与之对应，Cassandra 的主要 committer 来自 Rackspace，用来可以自由获得的支持先进的通用的 NOSQL 的解决方案，用来和 Google, Yahoo, Amazon EC2 等提供的那些锁定在专有的 NOSQL 系统的方案相抗衡。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">Malcolm Gladwell 会说只是根据这些背景的不同就可以简单地选择了 Cassandra。不过这是小马过河的问题。但当然，闭着眼睛就进行一个商业选择是相当困难的&#8230;&#8230;</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">哪个 NOSQL数据库风头更劲?</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">另一个说服我们转向 Cassandra 的原因是我们社区中的大风向。如你所知，软件平台行业里，大者恒大——那些被普遍看好的平台，会有更多人聚集在这个平台周围，于是，从长远看，你可以得到更好的生态系统的支持（也就是说，大部分支持的软件可以从社区中获得，也有更多的开发者可以雇佣）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">如果从 HBase 开始时，我的印象就是它后面有巨大的社区力量，但我现在相信，Cassandra 更加强大。最初的印象部分来源于 StumpleUpon 和 Streamy 的两位 CTO 的两个非常有说服力的出色的讲演，他们是 Web 行业中两个在 Cassandra 成为一个可选系统之前的 HBase 的两个重要的贡献者，同时也部分来源于快速阅读了一篇名为&#8220;HBase vs Cassandra： NoSQL 战役！&#8221;的文章（大部分内容都被广泛证实了）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">势头是很难确证的，你不得不自己进行研究，不过我可以找到的一个重要的标志是 IRC 上的开发者动向。如果你在 freenode.org 上比较 #hbase 和 #cassandra 的开发这频道，你会发现 Cassandra 差不多在任何时候都有两倍的开发者在线。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">如果你用考虑 HBase 一般的时间来考察 Cassandra，你就能发现 Cassandra 的背后确实有非常明显的加速势头。你可能还会发现那些逐渐出现的鼎鼎大名，如 Twitter，他们也计划广泛使用 Cassandra（<a href="http://translate.googleusercontent.com/translate_c?hl=en&amp;ie=UTF-8&amp;sl=en&amp;tl=zh-CN&amp;u=http://nosql.mypopescu.com/post/407159447/cassandra-twitter-an-interview-with-ryan-king&amp;prev=_t&amp;rurl=translate.google.com&amp;twu=1&amp;usg=ALkJrhhAV1dF6U42J_vUIBl8TrGtPX8EmQ" target="_blank" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">这里</a>）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">注：Cassandra 的网站看起来比 HBase 的好看多了，但认真的说，这可能不仅是市场的趋势。继续吧。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">深入到技术部分: CAP 和 CA 与 AP 的神话</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">对于分布式系统，有个非常重要的理论（这里我们在讨论分布式数据库，我相信你注意到了）。这个理论被称为 CAP 理论，由 Inktomi 的 联合创始人兼首席科学家 Eric Brewer 博士提出。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">这个理论说明，分布式（或共享数据）系统的设计中，至多只能够提供三个重要特性中的两个——一致性、可用性和容忍网络分区。简单的说，一致性指如果一个人向数据库写了一个值，那么其他用户能够立刻读取这个值，可用性意味着如果一些节点失效了，集群中的分布式系统仍然能继续工作，而容忍分区意味着，如果节点被分割成两组无法互相通信的节点，系统仍然能够继续工作。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">Brewer教授是一个杰出的人物，许多开发者，包括 HBase 社区的很多人，都把此理论牢记在心，并用于他们的设计当中。事实上，如果你搜索线上的关于 HBase 和 Cassandra 比较的文章，你通常会发现，HBase 社区解释他们选择了 CP，而 Cassandra 选择了 AP ——毫无疑问，大多数开发者需要某种程度的一致性 （C）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">不过，我需要请你注意，事实上这些生命基于一个不完全的推论。CAP 理论仅仅适用于一个分布式算法（我希望 Brewer 教授可以统一）。但没有说明你不能设计一个系统，在其中的各种操作的底层算法选择上进行这种。所以，在一个系统中，确实一个操作职能提供这些特性中的两个，但被忽视的问题是在系统设计中，实际是可以允许调用者来选择他们的某个操作时需要哪些特性的。不仅如此，现实世界并不简单的划分为黑白两色，所有这些特性都可以以某种程度来提供。这就是 Cassandra。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">这点非常重要，我重申：Cassandra 的优点在于你可以根据具体情况来选择一个最佳的折衷，来满足特定操作的需求。Cassandra 证明，你可以超越通常的 CAP 理论的解读，而世界仍然在转动。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">我们来看看两种不同的极端。比如我必须从数据库中读取一个要求具有很高一致性的值，也就是说，我必须 100%保证能够读取到先前写入的最新的内容。在这种情况下，我可以通过指定一致性水平为&#8220;ALL&#8221;来从 Cassandra 读取数据，这时要求所有节点都有数据的一致的副本。这里我们不具有对任何节点失效和网络分裂的容错性。在另一个极端的方面，如果我不特别关心一致性，或仅仅就是希望最佳性能，我可以使用一致性级别&#8220;ONE&#8221;来访问数据。在这种情况下，从任意一个保存有这个副本的节点获取数据都可以——即使数据有三个副本，也并不在意其他两个有副本的节点是否失效或是否有不同，当然，这种情况下我们读到的数据可能不是最新的。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">不仅如此，你不必被迫生活在黑白世界中。比如，在我们的一个特定的应用中，重要的读写操作通常使用&#8220;QUORUM&#8221;一致性级别，这意味着大部分存有此数据的节点上的副本是一致的——我这里是个简要描述，具体写你的 Cassandra 程序之前最好还是仔细研究一下。从我们的视角看，这这提供了一个合理的节点失效与网络分裂的耐受性，同时也提供了很高的一致性。而在一般情况下，我们使用前面提到的&#8220;ONE&#8221;一致性级别，者可以提供最高的性能。就是这样。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">对我们来说，这是 Cassandra 的一个巨大的加分项目。我们不仅能轻易地调整我们的系统，也可以设计它。比如，当一定数量的节点失效或出现网络连接故障时，我们的大部分服务仍然可以继续工作，只有那些需要数据一致性的服务会失效。HBase并没有这么灵活，它单纯地追求系统的一个方面（CP），这让我再次看到了 SQL 开发者和查询优化人员们之间的那道隔阂——有些事情最好能够超越它，HBase！</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">In our project then, Cassandra has proven by far the most flexible system, although you may find your brain at first loses consistency when considering your QUORUMs.在我们的项目之后，卡桑德拉已被证明是迄今为止最灵活的系统，虽然你可能发现一致性第一失去你的大脑在考虑您的法定人数。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">在我们的项目中，Cassandra 已经证明了它是有史以来最灵活的系统，虽然你可能在对这个问题进行投票（QUORUM）的时候发现的大脑失去了一致性。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">什么时候单体会比模块化强？</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">Cassandra 和 HBase 的一个重要区别是， Cassandra 在每个节点是是一个单 Java 进程，而完整的 HBase 解决方案却由不同部分组成：有数据库进程本身，它可能会运行在多个模式；一个配置好的 hadoop HDFS 分布式文件系统，以及一个 Zookeeper 系统来协调不同的 HBase 进程。那么，这是否意味着 HBase 有更好的模块化结构呢？</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">虽然 HBase 的这种架构可能确实可以平衡不同开发团队的利益，在系统管理方面，模块化的 HBase 却无法视为一个加分项目。事实上，特别是对于一些小的初创公司，模块化倒是一个很大的负面因素。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">HBase的下层相当复杂，任何对此有疑惑的人应该读读 Google 的 GFS 和 BigTable 的论文。即使是在一个单一节点的伪分布式模式下来架设 HBase 也很困难——事实上，我曾经费力写过一篇快速入门的教程（如果你要试试HBase的话<a href="http://ria101.wordpress.com/2010/01/28/setup-hbase-in-pseudo-distributed-mode-and-connect-java-client/" target="_blank" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">看看这里</a>）。在这个指南里你可以看到，设置好 HBase 并启动它实际包含了两个不同系统的手工设置：首先是 hadoop HDFS，然后才是 HBase 本身。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">然后，HBase 的配置文件本身就是个怪兽，而你的设置可能和缺省的网络配置有极大的不同（在文章里我写了两个不同的Ubuntu的缺省网络设置，以及 EC2 里易变的 Elastic IP 和内部分配的域名）。当系统工作不正常的时候，你需要查看大量的日志。所有的需要修复的东西的信息都在日志里，而如果你是一个经验丰富的管理员的话，就能发现并处理问题。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">但是，如果是在生产过程中出现问题，而你又没有时间耐心查找问题呢？如果你和我们一样，只有一个小的开发团队却有远大的目标，没有经历去 7*24 的进行系统监控管理会怎么样呢？</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">严肃地说，如果你是一个希望学习 NoSQL 系统的高级 DB 管理员的话，那么选择 HBase。这个系统超级复杂，有灵巧双手的管理员肯定能拿到高薪。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">但是如果你们是一个向我们一样尽力去发现隧道尽头的小团队的话，还是等着听听别的闲话吧</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">胜在 Gossip</strong><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">！</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">Cassandra 是一个完全对称的系统。也就是说，没有主节点或像 HBase 里的 region server 这样的东西——每个节点的角色是完全一样的。不会有任何特定的节点或其他实体来充当协调者的角色，集群中的节点使用称为 &#8220;Cossip&#8221; 的纯 P2P 通信协议来协调他们的行为。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">对 Gossip 的详细描述和使用 Gossip 的模型超过了本文的内容，但 Cassandra 所采用的 P2P 通信模型都是论证过的，比如发现节点失效的消息传播到整个系统的时间，或是一个客户应用的请求被路由到保存数据的节点的时间，所有这些过程所消耗的时间都毫无疑问的非常的短。我个人相信，Cassandra 代表了当今最振奋的一种 P2P 技术，当然，这和你的 NOSQL 数据库的选择无关。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">那么，这个基于 Gossip 的架构究竟给 Cassandra 用户带来什么显示的好处呢。首先，继续我们的系统管理主体，系统管理变得简单多了。比如，增加一个新节点到系统中就是启动一个 Cassandra 进程并告诉它一个种子节点（一个已知的在集群中的节点）这么简单。试想当你的分布式集群可能运行在上百个节点的规模上的时候，如此轻易地增加新节点简直是难以置信。更进一步，当有什么出错的时候，你不需要考虑是哪种节点出了问题——所有节点都是一样的，这让调试成为了一个更加易于进行且可重复的过程。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">第二，我可以得出结论，Cassandra 的 P2P 架构给了它更好的性能和可用性。这样的系统中，负载可以被均衡地三步倒各个节点上，来最大化潜在的并行性，这个能力让系统面临网络分裂和节点失效的时候都能更加的无缝，并且节点的对称性防止了 HBase 中发现的那种在节点加入和删除时的暂时性的性能都懂（Cassandra 启动非常迅速，并且性能可以随着节点的加入而平滑扩展）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">如果你想寻找更多更多的证据，你会对一个原来一直关注 hadoop 的小组（应该对 HBase 更加偏爱）的报告很感兴趣&#8230;&#8230;</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">一份报告胜过千言万语。</strong><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">我是指图表</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">Yahoo！进行的第一个 NOSQL 系统的完整评测。研究似乎证实了 Cassandra 所享有的性能优势，从图表上看，非常倾向于 Cassandra。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">目前这些论文还是草稿，你可以从这里找到这些论文：&nbsp;<br />
<a href="http://www.brianfrankcooper.net/pubs/ycsb-v4.pdf" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">http://www.brianfrankcooper.net/pubs/ycsb-v4.pdf</a>&nbsp;<br />
<a href="http://www.brianfrankcooper.net/pubs/ycsb.pdf" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">http://www.brianfrankcooper.net/pubs/ycsb.pdf</a></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">注意：这份报告中 HBase 仅在对一个范围的记录进行扫描这一项上优于 Cassandra。虽然 Cassandra 团队相信他们可以很快达到 HBase 的时间，但还是值得指出，在通常的 Cassandra 配置中，区间扫描几乎是不可能的。我建议你可以无视这一点，因为实际上你应该在 Cassandra 上面来实现你自己的索引，而非使用区间扫描。如果你对区间扫描和在 Cassandra 中存储索引相关问题有兴趣，可以看我的<a href="http://ria101.wordpress.com/2010/02/22/cassandra-randompartitioner-vs-orderpreservingpartitioner/" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">这篇文章</a>。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">最后一点： 这篇文章背后的 Yahoo！研究团队正尝试让它们的评测应用通过法律部门的评估，并将它发布给社区。如果他们成功的话，我当然希望他们成功，我们将能够看到一个持续的竞争场面，不论 HBase 还是 Cassandra 无疑都会进一步提高他们的性能。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">锁和有用的模块性</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">毫无疑问，你会从 HBase 阵营听到这样的声音：HBase 的复杂结构让它可以提供 Cassandra 的 P2P 架构无法提供的东西。其中一个例子可能就是 Hbase 提供给开发者行锁机制，而 Cassandra 则没有（在 HBase 中，因为数据副本发生在 hadoop 底层，行锁可以由 region server 控制，而在 Cassandra 的 P2P 架构中，所有节点都是平等的，所以也就没有节点可以像一个网管囊样负责锁定有副本的数据）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">不够，我还是把这个问题返回到关于模块化的争论中，这实际是对 Cassandra 有理的。Cassandra 通过在对称节点上分布式存储数据来实现了 BigTable 的数据模型。它完整地实现了这些功能，而且是以最灵活和高性能的方式实现的。但如果你需要锁、事务和其它功能的话，这些可以以模块的方式添加到你的系统之中——比如，我们发现我们可以使用 Zookeeper 和相关的工具来很简单地为我们的应用提供可扩展的锁功能（对于这个功能，Hazelcast 等系统可能也可以实现这个功能，虽然我们没有进行研究）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">通过为一个窄领域目的来最小化它的功能，对我来说，Cassandra 的设计达到了它的目的——比如前面指出可配置的 CAP 的折衷。这种模块性意味着你可以依据你的需求来构建一个系统——需要锁，那么拿来 Zookeeper，需要存储全文索引，拿来&nbsp;<a href="http://go2.wordpress.com/?id=725X1342&amp;site=ria101.wordpress.com&amp;url=http%3A%2F%2Fblog.sematext.com%2F2010%2F02%2F09%2Flucandra-a-cassandra-based-lucene-backend%2F" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; text-decoration: none; color: #004d99; ">Lucandra</a>&nbsp;，等等。对于我们这样的开发者来说，这意味着我们不必部署复杂度超出我们实际需要的系统，给我们提供了更加灵活的构建我们需要的应用的终极道路。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">MapReduce，别提 MapReduce！</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">Cassandra 做的还不够好的一件事情就是 MapReduce！对于不精通此项技术同学简单的解释一句，这是一个用于并行处理大量数据的系统，比如从上百万从网络上抓取的页面提取统计信息。MapReduce 和相关系统，比如 Pig 和 Hive 可以和 HBase 一起良好协作，因为它使用 HDFS 来存储数据，这些系统也是设计用来使用 HDFS 的。如果你需要进行这样的数据处理和分析的话，HBase 可能是你目前的最佳选择。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">记住，这就像小马过河！</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">因此，我停止了对 Cassandra&nbsp; 的优点的赞美，实际上，HBase 和 Cassandra 并不一定是一对完全的竞争对手。虽然它们常常可以用于同样的用途，和 MySQL 和 PostgreSQL 类似，我相信在将来它们将会成为不同应用的首选解决方案。比如，据我所知 StumbleUpon 使用了 HBase 和 hadoop MapReduce 技术，来处理其业务的大量数据。Twitter 现在使用 Cassandra 来存储实时交互的社区发言，可能你已经在某种程度上使用它了。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">作为一个有争议的临别赠言，下面我们进入下一个话题。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">注意：在继续下一个小节之前，我要指出，Cassandra 在 0.6 版本会有 hadoop 支持，所以 MapReduce 整合能获得更好的支持。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; "><strong style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #2e2e2e; ">兄弟，我不能失去数据&#8230;</strong></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">作为先前 CAP 理论争议的一个可能结果，可能有这样的印象，HBase 的数据似乎比 Cassandra 中的数据更安全。这是我希望揭露的最后一个关于 Cassandra 的秘密，当你写入新数据的时候，它实际上立刻将它写入一个将要存储副本的仲裁节点的 commit log 当中了，也被复制到了节点们的内存中。这意味着如果你完全让你的集群掉电，只可能会损失极少数据。更进一步，在系统中，通过使用 Merkle tree 来组织数据的过分不一致（数据熵），更加增加了数据的安全性<img alt="：）" src="http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; max-width: 576px; " /></p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">事实上，我对 HBase 的情况并不是非常确切——如果能有更细节的情况，我回尽快更新这里的内容的——但现在我的理解是，因为 hadoop 还不支持 append，HBase 不能有效地将修改的块信息刷入 HDFS （新的对数据变化会被复制为多个副本并永久化保存）。这意味着会有一个更大的缺口，你最新的更改是不可见的（如果我错了，可能是这样，请告诉我，我回修正本文）。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">所以，尽管希腊神话中的 Cassandra 非常不幸（译注：Cassandra 是希腊神话里，特洛伊的那个可怜的女先知的名字，如果你不知道详情的话，可以参考wiki），但你的 Cassandra 中的数据不会有危险。</p>
<p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 9px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #4d4d4d; ">注意：Wade Amold 指出， hadoop .21 很快就会发布，其中将会解决 HBase 的这个问题。</p>
</span></div>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/342852.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2011-01-12 14:23 <a href="http://www.blogjava.net/hengheng123456789/archive/2011/01/12/342852.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>