---
title: "dbthink1"
author: "hellowiki"
date: "2011-03-31T23:12:04Z"
tags: []
categories: ["数据库"]
slug: "dbthink1"
draft: false
lastmod: "2011-03-31T23:13:19Z"
id: 982470
url: "https://hellowiki.iteye.com/blog/982470"
---

&lt;!-- Header --&gt; &lt;!-- / Header --&gt; &lt;!-- Main Body --&gt; &lt;!-- Left Sidebar --&gt; &lt;!-- / Left Sidebar --&gt;&lt;!-- Main Column --&gt; &lt;!-- / Main Column --&gt;&lt;!-- Right Sidebar --&gt; 转自[http://www.dbthink.com/?paged=5](http://www.dbthink.com/?paged=5)

- [Home](http://www.dbthink.com/ "a db thinker's home")
- [个人简介](http://www.dbthink.com/?page_id=2)

[![a db thinker's home](http://www.dbthink.com/wp-content/themes/atahualpa346/images/xlogo.png.pagespeed.ic.ICWmaHBME5.png)](http://www.dbthink.com/)

# [a db thinker's home](http://www.dbthink.com/)

An Oracle DBA's thought about DB,Web Architect etc..

[Comments](http://www.dbthink.com/?feed=comments-rss2 "Subscribe to the COMMENTS feed")[Posts](http://www.dbthink.com/?feed=rss2 "Subscribe to Dbthink")

 

 

 

 

### 文章分类

- [社会评论](http://www.dbthink.com/?cat=4 "View all posts filed under 社会评论") (2)
- [My Reading](http://www.dbthink.com/?cat=55 "View all posts filed under My Reading") (28)
- [mysql](http://www.dbthink.com/?cat=67 "View all posts filed under mysql") (6)
- [nosql](http://www.dbthink.com/?cat=57 "View all posts filed under nosql") (24)
- [oracle](http://www.dbthink.com/?cat=34 "View all posts filed under oracle") (50)
  
  - [dataguard](http://www.dbthink.com/?cat=81 "View all posts filed under dataguard") (6)
  - [Index](http://www.dbthink.com/?cat=16 "View all posts filed under Index") (6)
  - [oracle 11g 新特性](http://www.dbthink.com/?cat=10 "View all posts filed under oracle 11g 新特性") (9)
  - [physical design](http://www.dbthink.com/?cat=20 "View all posts filed under physical design") (1)
  - [temporary object](http://www.dbthink.com/?cat=26 "View all posts filed under temporary object") (1)
- [Translation](http://www.dbthink.com/?cat=104 "View all posts filed under Translation") (31)
- [Uncategorized](http://www.dbthink.com/?cat=1 "View all posts filed under Uncategorized") (11)

### 最近评论

- [jametong](http://dbthink.com/) on [最佳字段顺序-数据库物理设计](http://www.dbthink.com/?p=46&cpage=1#comment-545)
- [默默](http://space.itpub.net/22664653/) on [最佳字段顺序-数据库物理设计](http://www.dbthink.com/?p=46&cpage=1#comment-544)
- [hoterran](http://www.hoterran.info/) on [最佳字段顺序-数据库物理设计](http://www.dbthink.com/?p=46&cpage=1#comment-543)
- [默默](http://space.itpub.net/22664653/) on [Index Rebuild Online 过程(9i)完整版](http://www.dbthink.com/?p=590&cpage=1#comment-542)
- [jametong](http://www.dbthink.com/) on [NoSQL生态系统](http://www.dbthink.com/?p=458&cpage=1#comment-540)

### 文章归档

- [March 2011](http://www.dbthink.com/?m=201103 "March 2011") (1)
- [December 2010](http://www.dbthink.com/?m=201012 "December 2010") (2)
- [November 2010](http://www.dbthink.com/?m=201011 "November 2010") (4)
- [September 2010](http://www.dbthink.com/?m=201009 "September 2010") (4)
- [August 2010](http://www.dbthink.com/?m=201008 "August 2010") (5)
- [July 2010](http://www.dbthink.com/?m=201007 "July 2010") (12)
- [June 2010](http://www.dbthink.com/?m=201006 "June 2010") (8)
- [May 2010](http://www.dbthink.com/?m=201005 "May 2010") (14)
- [April 2010](http://www.dbthink.com/?m=201004 "April 2010") (13)
- [March 2010](http://www.dbthink.com/?m=201003 "March 2010") (20)
- [February 2010](http://www.dbthink.com/?m=201002 "February 2010") (11)
- [January 2010](http://www.dbthink.com/?m=201001 "January 2010") (5)
- [December 2009](http://www.dbthink.com/?m=200912 "December 2009") (4)

### Most used Tags

[**BigTable**](http://www.dbthink.com/?tag=bigtable "2 topics") [**bloom filter**](http://www.dbthink.com/?tag=bloom-filter "2 topics") [**buffer cache**](http://www.dbthink.com/?tag=buffer-cache "4 topics") [**CAP**](http://www.dbthink.com/?tag=cap "2 topics") [**cassandra**](http://www.dbthink.com/?tag=cassandra "11 topics") [**checkpoint**](http://www.dbthink.com/?tag=checkpoint "2 topics") [**commit log**](http://www.dbthink.com/?tag=commit-log "2 topics") [**dataguard**](http://www.dbthink.com/?tag=dataguard "3 topics") [**dataguard broker**](http://www.dbthink.com/?tag=dataguard-broker "3 topics") [**enqueue lock**](http://www.dbthink.com/?tag=enqueue-lock "2 topics") [**Eventual Consistency**](http://www.dbthink.com/?tag=eventual-consistency "2 topics") [**Facebook**](http://www.dbthink.com/?tag=facebook "4 topics") [**fast\_start failover**](http://www.dbthink.com/?tag=fast_start-failover "2 topics") [**flash cache**](http://www.dbthink.com/?tag=flash-cache "5 topics") [**free buffer waits**](http://www.dbthink.com/?tag=free-buffer-waits "2 topics") [**google file system**](http://www.dbthink.com/?tag=google-file-system "3 topics") [**google gfs**](http://www.dbthink.com/?tag=google-gfs "2 topics") [**hadoop**](http://www.dbthink.com/?tag=hadoop "2 topics") [**Index**](http://www.dbthink.com/?tag=index "3 topics") [**index rebuild**](http://www.dbthink.com/?tag=index-rebuild "2 topics") [**index rebuild online**](http://www.dbthink.com/?tag=index-rebuild-online "2 topics") [**Jonathan Lewis**](http://www.dbthink.com/?tag=jonathan-lewis "7 topics") [**kernel parameter**](http://www.dbthink.com/?tag=kernel-parameter "2 topics") [**latency**](http://www.dbthink.com/?tag=latency "2 topics") [**map reduce**](http://www.dbthink.com/?tag=map-reduce "2 topics") [**Memtable**](http://www.dbthink.com/?tag=memtable "3 topics") [**mlc**](http://www.dbthink.com/?tag=mlc "2 topics") [**mysql**](http://www.dbthink.com/?tag=mysql "3 topics") [**new feature**](http://www.dbthink.com/?tag=new-feature "3 topics") [**nosql**](http://www.dbthink.com/?tag=nosql "4 topics") [**Oracle 11g**](http://www.dbthink.com/?tag=oracle-11g "3 topics") [**performance**](http://www.dbthink.com/?tag=performance "5 topics") [**plan stability**](http://www.dbthink.com/?tag=plan-stability "3 topics") [**read repair**](http://www.dbthink.com/?tag=read-repair "2 topics") [**scalability**](http://www.dbthink.com/?tag=scalability "4 topics") [**scale-out**](http://www.dbthink.com/?tag=scale-out "2 topics") [**slc**](http://www.dbthink.com/?tag=slc "2 topics") [**ssd**](http://www.dbthink.com/?tag=ssd "5 topics") [**SSTable**](http://www.dbthink.com/?tag=sstable "3 topics") [**stored outlines**](http://www.dbthink.com/?tag=stored-outlines "3 topics") [**中组部**](http://www.dbthink.com/?tag=%E4%B8%AD%E7%BB%84%E9%83%A8 "1 topic") [**可伸缩性**](http://www.dbthink.com/?tag=%E5%8F%AF%E4%BC%B8%E7%BC%A9%E6%80%A7 "2 topics") [**改革**](http://www.dbthink.com/?tag=%E6%94%B9%E9%9D%A9 "1 topic") [**权贵资本主义**](http://www.dbthink.com/?tag=%E6%9D%83%E8%B4%B5%E8%B5%84%E6%9C%AC%E4%B8%BB%E4%B9%89 "1 topic") [**架构师**](http://www.dbthink.com/?tag=%E6%9E%B6%E6%9E%84%E5%B8%88 "2 topics")

## [Oracle Enqueue Lock介绍](http://www.dbthink.com/?p=575 "Permanent Link to Oracle Enqueue Lock介绍")

这是我准备今天下午给部门兄弟介绍的Enqueue Lock的ppt, 前面介绍部分纯理论部分没有做充分的测试,后半部分常用Enqueue Type的介绍, 都在以下环境做过测试.

OS : Windows XP (Intel T7250 ,3G mem) +  
soft : Oracle 9201 32位

[**Enqueue Lock介绍.ppt**](http://www.slideshare.net/jamestong/enqueue-lockppt "Enqueue Lock介绍.ppt")

View more [**presentations**](http://www.slideshare.net/) from [**james tong**](http://www.slideshare.net/jamestong).

July 25th, 2010 | Tags: [CF enqueue](http://www.dbthink.com/?tag=cf-enqueue), [enqueue lock](http://www.dbthink.com/?tag=enqueue-lock), [enqueue resource](http://www.dbthink.com/?tag=enqueue-resource), [HW enqueue](http://www.dbthink.com/?tag=hw-enqueue), [TX enqueue](http://www.dbthink.com/?tag=tx-enqueue) | Category: [oracle](http://www.dbthink.com/?cat=34 "View all posts in oracle") | [One comment](http://www.dbthink.com/?p=575#comments "Comment on Oracle Enqueue Lock介绍")

&lt;!-- / Post --&gt;

## [Cassandra Vs HBase](http://www.dbthink.com/?p=571 "Permanent Link to Cassandra Vs HBase")

[**Cassandra vs HBase**](http://whynosql.com/cassandra-vs-hbase/)  
By [**Vaibhav Puranik**](http://whynosql.com/) Translated By [**Jametong**](http://www.dbthink.com/)

我们是一家广告网络公司.我们需要存储展示与点击信息.我们在为我们的新项目评估多个不同的大批量数据(或nosql,或任何你喜欢的称呼)系统.过去8个月中,我们一直在一个测试产品上使用HBase,并且满意它的表现,但是,最近Cassandra的风头很高,因此,我们决定对它做个测试.我认为,从某些角度讲,Cassandra团队的推广做的很不错.你将发现,在Santa Monica，哪怕是非技术人员(诸如风险投资商、CEO以及产品经理)也会相互推荐使用Cassandra.

Cassandra给人的第一印象很好.它们的首页看上去比HBase更加专业也更加友好.安装并运行它也很简单.这个网站的文档很丰富.说实在话,安装并让其工作只花费了我5分钟的时间.

真正的挑战是理解Cassandra的数据模型,并尝试在我们的使用场景中实现它.我们很清楚如何在HBase中实现它,因为我们对HBase有相当不错的使用经验.虽然Cassandra也是从BigTable出继承了同样的数据模型,Cassandra与HBase之间还是有一些根本性的不同的.我试图用表格整理了两个系统之间的差异,如下:

Cassandra HBase 缺少类似于表的概念.所有的文档都告诉你,有多个Keyspace的情况不常见.这意味着你必须在一个集群中共享同一个key space.另外,新增keyspace需要重启集群才能生效. 存在表相关的概念.每个表都有它自己的key space. 这一点对我们来说很重要.添加/删除表都很容易,跟在RDBMS中一样. 使用字符串的Key.通常使用uuid作为Key.如果希望你的数据按照时间排序,可以使用TimeUUID. 使用二进制Key.通常将三个不同的项目组合在一起来构建一个Key.这意味着你可以搜索一个给定表中的多个键. 即使使用TimeUUID,也不会发生热点问题,因为Cassandra会对客户端请求做负载均衡. 如果Key的第一部分是时间或者序列数,就会发生热点问题.所有新的Key都会被插入同一个区域,一直到此区域被塞满(因而导致出现热点问题). 支持列排序 不支持列排序 超列(Super Column)概念使得你可以设计非常灵活也非常复杂的表结构. 不支持超列.不过可以设计一个类似与超列的结构,不过列名称与值都是二进制的. 没有便捷的方法来自增长一个列的值.实际上,最终一致性的不同特性使得更新/写入一条记录并在更新后立即读出非常困难.必须确保使用R+W&gt;N来实现强一致性. 由于设计上就是一致性.提供了一个非常便捷的方法来自增计数器.非常适合做数据汇总. 刚开始支持Map Reduce接口.还需要有一个hadoop集群来运行它.需要将数据从Cassandra集群迁移到Hadoop集群.不适合对大型数据运行map reduce任务. 对Map Reduce的支持是原生的.HBase构建在Hadoop集群上.数据不需要做迁移. 如果不需要Hadoop的话,维护相对简单. 由于包含多个诸如Zookeeperr、Hadoop以及HBase本身的可活动组件，维护相对复杂. 到目前为止,还没有本地化的Java Api支持.没有Java文档.虽然是使用Java编写的,你还是必须用Thrift接口来与集群进行通讯. 有友好的本地Java API.比Cassandra更像是Java系统.由于我们的应用是基于Java的,这一点对我们很重要. 没有主节点,因此也没有单点故障. 虽然在概念上有一个主节点服务,HBase本身对它的依赖并不严重.即使在主节点宕机的情况下,HBase集群仍然可以正常提供数据服务.Hadoop的Namenode是一个单点故障.

在按照这种方式比较过数据模型与相关特性后,对我们来讲,HBase是明显的优胜者.我的看法是,如果你确实需要一致性,HBase是一个明显的选择.更进一步,本地化的Map Reduce支持、表概念以及可修改而且不用重启集群的简单的表结构是你不可忽略的加分项.HBase是一个更加成熟的平台.当人们说Twitter、Facebook在使用Cassandra时,他们忘记了这些公司同时也在使用HBase.实际上,Facebook最近雇用了一个HBase的代码提交者(Commiter),这清楚地表明Facebook对HBase的兴趣.

总之,我们全力支持HBase!!

July 22nd, 2010 | Tags: [cassandra](http://www.dbthink.com/?tag=cassandra), [cassandra vs hbase](http://www.dbthink.com/?tag=cassandra-vs-hbase), [hbase](http://www.dbthink.com/?tag=hbase) | Category: [Translation](http://www.dbthink.com/?cat=104 "View all posts in Translation"), [nosql](http://www.dbthink.com/?cat=57 "View all posts in nosql") | [One comment](http://www.dbthink.com/?p=571#comments "Comment on Cassandra Vs HBase")

&lt;!-- / Post --&gt;

## [Cassandra 的相关优化建议](http://www.dbthink.com/?p=564 "Permanent Link to Cassandra 的相关优化建议")

以下内容摘自Eric Evans在OSCON上的ppt ([**Hands On Cassandra**](http://assets.en.oreilly.com/1/event/45/Hands-on%20Cassandra%20Presentation.pdf))

**1. 设置Java的Heap Size.**

[view source](/admin/blogs/#viewSource "view source")

[print](/admin/blogs/#printSource "print")[?](/admin/blogs/#about "?")

`1` `# Arguments to pass to the JVM`

`2` `JVM_OPTS=” \`

`3` `…`

`4` `-Xmx1G \`

`5` `…`

**2. 设置memtable flush的策略.**

[view source](/admin/blogs/#viewSource "view source")

[print](/admin/blogs/#printSource "print")[?](/admin/blogs/#about "?")

`1` `# 达到的数据量大小(这个与memtable大小的设置一致).`

`2` `memtable_throughput_in_mb: 64`

`3` ` ` 

`4` `# 包含的对象数量(单位:百万)`

`5` `memtable_operations_in_millions: 0.3`

`6` ` ` 

`7` `# 经过的时间长度`

`8` `memtable_flush_after_mins: 60`

**3. 缓存设置策略**

[view source](/admin/blogs/#viewSource "view source")

[print](/admin/blogs/#printSource "print")[?](/admin/blogs/#about "?")

`1` `keyspaces:`

`2` `- name: Twissandra`

`3` `…`

`4` `column_families:`

`5` `- name: User`

`6` `keys_cached: 100           ## 缓存的Key的数量`

`7` `preload_row_cache: true  ##是否预载行缓存`

`8` `rows_cached: 1000         ##行缓存的键的数量.`

`9` `…`

**4. 磁盘访问策略.**

[view source](/admin/blogs/#viewSource "view source")

[print](/admin/blogs/#printSource "print")[?](/admin/blogs/#about "?")

`1` `# Choices are auto, standard, mmap, and`

`2` `# mmap_index_only.`

`3` `disk_access_mode: auto`

**访问模式.**

- *mmapped i/o* 速度非常快,但是仅仅在64位的机器(显然不包含EC2的”small”实例)或者数据集相对较小时可行.
- “*auto*“是比较安全的选择,将在64位的JVM上使用mmap模式.
- 其他值有”*mmap*“与*“mmap\_index\_only*“(通过仅对索引文件使用mmap以使你部分享受到mmap的好处),”*standard*“(buffer 相关参数仅仅对standard以及non-mmaped i/o有效)

(buffer相关参数包含SlicedBufferSizeInKB,FlushDataBufferSizeInMB,FlushIndexBufferSizeInMB)  
此段内容翻译自Cassandra Wiki [**Storage Configuration**](http://wiki.apache.org/cassandra/StorageConfiguration)

**5. 相关内容监控**

[view source](/admin/blogs/#viewSource "view source")

[print](/admin/blogs/#printSource "print")[?](/admin/blogs/#about "?")

`01` `bin/nodetool –host <ARG> command`

`02` ` ` 

`03` `--Command List`

`04` `ring`

`05` `info`

`06` `cfstats`

`07` `tpstats`

`08` `compact`

`09` `snapshot [name]`

`10` `flush`

`11` `drain`

`12` `repair`

`13` `decommission`

`14` `move`

`15` `loadbalance`

`16` `get_endpoints < keyspace > < key >`

`17` `global_snapshot [name]`

`18` `clear_global_snapshot`

`19` `truncate < keyspace > < cfname >`

July 22nd, 2010 | Tags: [cassandra](http://www.dbthink.com/?tag=cassandra), [tunning tips](http://www.dbthink.com/?tag=tunning-tips) | Category: [My Reading](http://www.dbthink.com/?cat=55 "View all posts in My Reading"), [nosql](http://www.dbthink.com/?cat=57 "View all posts in nosql") | [One comment](http://www.dbthink.com/?p=564#comments "Comment on Cassandra 的相关优化建议")

&lt;!-- / Post --&gt;

## [扩展Facebook到5亿用户以及以上.](http://www.dbthink.com/?p=561 "Permanent Link to 扩展Facebook到5亿用户以及以上")

[**扩展Facebook到5亿用户以及以上**](http://www.facebook.com/note.php?note_id=409881258919)  
By [**Robert Johnson**](http://www.facebook.com/profile.php?id=3501774) Translated By [**Jametong**](http://www.dbthink.com/)

今天对Facebook来讲,我们达到了Facebook的一个非常重要的里程碑-5亿的用户数.这对于我们这些从事技术与运维的工程师来讲尤其令人激动,是我们构建了有能力处理如此巨大规模的增长的系统.当我在4年前来到Facebook的时候,我们有700万用户(在当时看似已经是非常的数量了),这一路走来遇到的挑战远远超出我们的想像.

下面是我们处理的部分大数字(the Big Numbers):

- 5个亿的活跃用户数
- 每天1000亿的点击数
- 500亿的图片数
- 2万亿的缓存对象,每秒亿级的请求数
- 每天130TB的日志量

这些年,我们在此页面写了部分关于我们如何处理这么大规模数据的技术方案.今天,我将退后一步,来谈谈一些我们关于扩展(Scaling)的常用方法,以及部分我们用来解决此类扩展性问题的原则.如在Facebook本身一样,这些原则既涉及到技术也涉及到人.实际上,下面将要讨论的原则只有部分是完全技术相关的.在这一天结束的时候,是这些构建此系统并使其运转的人,我们用来扩展这些系统的最佳工具是我们可以处理任何问题的技术与运营团队.我最感到自豪的扩展统计指标是我们的每个工程师可以服务100万的用户,并且这个指标还在稳定地增长.

![](http://www.dbthink.com/wp-content/uploads/2010/07/facebook_user_metrics.jpg)

**纵向扩展**

它不是万能的,不过,它确实很重要.如果什么东西出现了爆发性的增长,处理它的唯一明智可行的方法就是将其分布到任意多数量的机器上.切记,计算机世界只有三个数字:0,1和n.

例如,考虑这样一种情况,用户数据库无法处理此负载.我们可以将其拆分成两个功能-比如说,账户与概要—并将他们放到不同的数据库中.这可能耗费掉我们一整天的时间,不过,也可能需要花费更多的工作,而且它只能扩展到两倍的容量.一旦完成此项工作,我们还必须开始下一步新的工作,而且下一步的工作会更加困难.相反,我们可以花费部分额外的时间来编写代码,以解决当两个用户不在同一个数据库中的情况.这可能比将代码拆成两半要耗费更多的工作时间,不过它可以在后续的很长时间都给我们带来收益.

注意,这样做并不会提高效率,实际上,它可能让情况变得更糟糕.效率是非常重要的,但是,我们认为它与扩展性(Scaling)是相互独立的项目.

**快速响应**

如果你查看我们的增长曲线,你将发现不到它有平稳的时候.我们从来就没有坐下来深呼吸、自我恭维一番、并考虑下一步该如何做的时间.每周,我们都会遭遇更大的挑战.

当然,我们对此图的最终走向有不错的注意,但是,每个规模级别上都会有惊喜.我们可用来处理这些惊喜的最佳方式是,拥有可以灵活应对并快速解决问题的技术与运维团队.快速响应也使得我们可以尝试更多的事情,来检验哪个才是在实践中真正可用的.我们发现,保持这种灵活性要远远比任何其他技术决定来的重要.

**渐进变更**

我们发现,保持快速移动的最好方式是进行大量的小的变更,并衡量做了这些变更后系统的反应.这并不意味着我们不去做大事,它仅仅表示只要有可能,我们都将其拆分成大量的独立的小块.与此相反,很多开发哲学尝试做批量变更.

即使有些东西无法在功能上对其进行拆分,我们也尝试逐步地推出.这可能意味着一次迁移一部分用户或者一部分机器,甚或构建一个与老系统完全并行的系统,并在我们衡量效果的时候缓慢地将流量切换过来.

渐进变更的伟大之处在于,只要有东西与你期望的不一致,你立刻就能发现.与直觉不同,这样做最终让保持系统稳定变更更加容易.

当生产环境有问题时,修复它的最困难的部分可能就是问题定位了.如果只有一个变更的话,问题的定位就简单多了.在传统模型中,当你有几个星期甚至几个月的变更一起生效时,定位具体哪个变更导致了问题可能是个梦魇.

**度量一切**

只有当你确实有能力监控系统在做什么时,你才可以做大量的小的变更,并监控系统在做什么.在Facebook,我们收集巨量的数据,任一特定的服务器都会输出几十上百个可制作成图表的指标.这不仅仅包含类似于CPU与内存等系统级别的内容,还包含应用级别的统计信息,我们可以据此判断为什么发生这样的事情.

当他们有问题时(真正有趣的问事情只会出现在生产环境),统计信息来自真实的发生问题的生产环境机器这一点非常重要.这些统计必须来自所有的机器,因为大量重要的影响都被平均数隐藏了,只是出现在分布图上,特别是95%或99%的百分位上.

我们构建了多个用来收集、分析这些数据的工具,并已经将它们发布到了开源社区,其中包含[**Hive**](http://wiki.apache.org/hadoop/Hive)与[**Scribe**](http://wiki.github.com/facebook/scribe/).

**小而独立的团队**

当我开始在Facebook工作时,我是图片处理模块团队的两个人之一.这很疯狂,但是,现在我们已经是一个”大”公司了.我们图片处理模块有三个人.我们每个人都了解图片处理模块的所有底细,都可以独立地做相关决定.因此,当需要对图片处理模块做什么变更时,都可以快速而准确地做好此变更.

![](http://dl.iteye.com/upload/attachment/452158/a243c767-8ff0-3f73-98bc-809afbf51b06.jpg)  
 

**控制权与责任**

如果没有开发与运营团队地无缝合作，以及他们如同事一个团队一样的去解决问题，上述原则都将无法实施.对于这一点，说易行难,但是,我们有一个非常有用的基本原则.

***对一件事情负责的人必须对这件事有控制权**.*

这一点看似非常明显,但实际情况通常不是这样.经典的例子是一个人发布另一个人写的代码.发布代码的人好像对此负责,但实际上是写这个代码的对此有控制权.这就将发布此代码的人置于一个艰难的境地,他们仅有的选择是要么发布此代码,要么对冒险对可能出现的问题承担责任,因此,他们有强烈的动机拒绝发布.另一方面,如果写此代码的人感觉自己并不负责此功能是否有效,这个功能很可能就无法有效工作.

在Facebook,我们每天都会往网站发布代码,是写这些代码的人对此具体负责.看到自己创建的东西被5亿的人使用是令人振奋并震撼人心的.看到它出问题就更加震撼人心了. 关于如果给这5亿的用户带来伟大的软件,我们所知道的最好的方式是让对此事的重要性有深刻理解,对此事有深刻理解并有控制权的人来做正确的决定.

**5亿之外**

我们非常自豪,我们创建了一个5亿人想要使用的网站,这个5亿人正在使用的网站仍然在工作.但这确实仅仅是一个开始. 我们希望在不远的将来,我们会有另外5个亿的用户,这些原则将帮助我们克服后面将要面对的任何新的挑战.

*Bobby, 技术总监, 比他4年前对大数字(Big Numbers)有了完全不同的理解.*

July 22nd, 2010 | Tags: [change culture](http://www.dbthink.com/?tag=change-culture), [Facebook](http://www.dbthink.com/?tag=facebook), [measure metrics](http://www.dbthink.com/?tag=measure-metrics), [Scale Horizontally](http://www.dbthink.com/?tag=scale-horizontally), [team scale](http://www.dbthink.com/?tag=team-scale) | Category: [My Reading](http://www.dbthink.com/?cat=55 "View all posts in My Reading"), [Translation](http://www.dbthink.com/?cat=104 "View all posts in Translation") | [One comment](http://www.dbthink.com/?p=561#comments "Comment on 扩展Facebook到5亿用户以及以上")

&lt;!-- / Post --&gt;

## [为什么Quora不使用NoSQL来做数据存储](http://www.dbthink.com/?p=553 "Permanent Link to 为什么Quora不使用NoSQL来做数据存储")

> 本文算是对目前NoSQL的一篇比较不错的反思文章,不完全代表我个人的想法.

[**Quora**](http://www.quora.com/)是一家做互动问答的网站, 他们最近在自己的网站上提出了一个问题,即标题所示: 为什么Quora不使用NoSQL来做数据存储?

链接如下: [**http://www.quora.com/Why-does-Quora-use-MySQL-as-the-data-store-rather-than-NoSQLs-such-as-Cassandra-MongoDB-CouchDB-etc**](http://www.quora.com/Why-does-Quora-use-MySQL-as-the-data-store-rather-than-NoSQLs-such-as-Cassandra-MongoDB-CouchDB-etc)

我这边简要的翻译并总结以下:

***from Adam D’Angelo, MySQL user since 2004***

- 1\. 如果你在应用级别做数据分区,MySQL的伸缩性已经可以基本满足需要. Facebook在2008年的时候,他们的2个DBA差不多维护着1800个MySQL的服务器. 在这种情况下, 分区之间是不能做连接操作的, 不过NoSQL数据库也不允许这样做. Facebook并没有确认使用Cassandra来作为任何数据的主存储,看似收件箱是他们目前仅有的使用Cassandra的应用.
- 2\. 这些分布式数据库(例如Cassandra,MongoDB以及CouchDB)实际上扩展性与稳定性都没有那么好. Twitter显然在一年前就想从MySQL迁移到Cassandra了(他们目前已经调整策略了), 如果有人在一年前宣布使用超过1000台机器的集群来使用这些系统,我将重新考虑我的观点.
- 3\. 使用一种新技术来部署应用的主在线数据存储是非常冒风险的决定. 如果你丢失的你的数据库或者遇到了数据损坏, 这将是个灾难,这些数据可能永远也无法恢复回来, 如果你们是少数几个在生产环境大规模使用它的公司, 你将不得不祈求开发的怜悯,期待他们来修复bug或者解决伸缩性问题.
- 4\. 实际上,哪怕是在单台MySQL服务器上,你也可以走的很远,而不用考虑在应用层做拆分的问题. 你可以使用”向上扩展”的方式给一台机器配备大量的CPU以及大量的内存,并配备一个副本. 如果你可以在数据库之上再配置一个MemCached服务层的化(这是很容易向外扩展的),这时数据库就只需要考虑写操作了.你还可以使用S3(Simple Storage Service of Amazon)或者其他类似的分布式散列表来将数据库中的大对象字段移出来. 你并不需要考虑系统在10倍压力之后将如何伸缩,只要你有信心随着容量的增长,你知道如何对系统进行扩展就可以了.
- 5\. 手工在大量MySQL机器进行数据分区的很多问题都可以通过下面的方法来缓解,在应用层之下以及MySQL之上构建一个数据层,来对数据做自动分布. [**FriendFeed**](http://bret.appspot.com/entry/how-friendfeed-uses-mysql) 描述了一个这种实现方式的很好的范例.
- 6\. 就我个人来讲,我相信关系数据模型是构建大部分应用(如Quora,以及大部分用户生产内容的网站)数据的”正确”的方式. 表结构的存在,使得数据可以在应用的多个版本之间保持一定的稳定性,他们可以部分地充当文档,并预防大量的bug. SQL语句使得你可以在必要的时候将计算推到数据这一块,而不是将大量的数据拉到应用端再来做处理. 我觉得,当某人最终用一种弱化的语义实现了分布式关系数据库的时候,”NoSQL”的风尚也就结束了.

July 19th, 2010 | Category: [Translation](http://www.dbthink.com/?cat=104 "View all posts in Translation"), [mysql](http://www.dbthink.com/?cat=67 "View all posts in mysql"), [nosql](http://www.dbthink.com/?cat=57 "View all posts in nosql") | [2 comments](http://www.dbthink.com/?p=553#comments "Comment on 为什么Quora不使用NoSQL来做数据存储")

&lt;!-- / Post --&gt;

[**« Newer Entries**](http://www.dbthink.com/?paged=4)  

  [**Older Entries »**](http://www.dbthink.com/?paged=6)

### RSS订阅

- [![](http://www.dbthink.com/wp-content/uploads/2010/07/icon_sub_c1s12.gif.pagespeed.ce.UuVs03fhrP.gif)](http://feeds.feedburner.com/dbthink)  
  [**抓虾订阅**](http://www.zhuaxia.com/add_channel.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdbthink)  
  [**Google Reader 订阅**](http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fdbthink)  
  [**![](http://feeds.feedburner.com/~fc/dbthink?bg=99CCFF&fg=444444&anim=0)**](http://feeds.feedburner.com/dbthink)

### Recent Posts

- [我对NOSQL的一点理解](http://www.dbthink.com/?p=687 "我对NOSQL的一点理解")
- [2010年存储领域的收购案](http://www.dbthink.com/?p=684 "2010年存储领域的收购案")
- [豆瓣的崔卫平小组终于解散.](http://www.dbthink.com/?p=681 "豆瓣的崔卫平小组终于解散.")
- [分页、内存和 I/O 延迟(转载)](http://www.dbthink.com/?p=677 "分页、内存和 I/O 延迟(转载)")
- [磁盘 I/O 和网络(转载)](http://www.dbthink.com/?p=674 "磁盘 I/O 和网络(转载)")
- [分区表操作update global indexes涉及到的表锁](http://www.dbthink.com/?p=669 "分区表操作update global indexes涉及到的表锁")
- [数据科学家的七个秘密武器.](http://www.dbthink.com/?p=666 "数据科学家的七个秘密武器.")
- [MySQL系统的一个异常错误](http://www.dbthink.com/?p=660 "MySQL系统的一个异常错误")
- [Tanel Poder的两篇ppt以及其它](http://www.dbthink.com/?p=652 "Tanel Poder的两篇ppt以及其它")
- [Linux环境下的Oracle数据库常用内核参数介绍](http://www.dbthink.com/?p=647 "Linux环境下的Oracle数据库常用内核参数介绍")

&lt;div class="widge