木匠的微型博客 Charlie Twitter

    follow me on Twitter
    Showing posts with label asynchronous. Show all posts
    Showing posts with label asynchronous. Show all posts

    Saturday, January 03, 2009

    Data accuracy and consistency分布式异步数据处理的可行性

    2009年定下一个实在的目标: 坚持每周一篇博客. 主要写个人在加拿大的生活趣事, 以及数据库开发和设计模式作为辅助.
    -- '大多数的事例告诉我们,我们不因才干、天赋、美丽的帮助下取得成功。反而,成功来自于最简单的"坚持"'.

    好了,言归正传,谈谈当下如火如荼BASE设计架构中异步处理的可行性.
    BASE (basically available, soft state, eventually consistent)

    很久以来,产品经理和软件开发人员都把维护数据的一致性和准确性作为首要目标.
    要想构建一个scalable线性扩展的数据库系统,必须牺牲一些数据一致性,来创造出更高的可用性和减少网络依赖性(Network Partition Tolerance, or Isolation and Loose coupling).

    鄙人认为(IMHO - in my humble opinion), 除了信用卡系统和订单系统, 其余功能模块都可以异步处理,比如库存,搜索,财务,物料,后勤运输,发货...etc.
    这里提供两个真实生动的素材,帮助你说服产品经理,证明构建异步数据库系统的可行性.

    a) 航班订票系统
    某天你去国航订票,要求买靠窗户的座位,系统里显示只有3个走道的座位,但是实际上有两个靠窗户的座位.
    你会去国航找他们领导投诉吗? 答案是否定的.

    b) 网上购物-在亚马逊买书
    Doug(倒戈)刚刚出版了一本新书: "如何冬季漂流?".
    我们快乐的客户登录亚马逊主页,输入关键字"漂流", 找到3本书,但是没有Doug那一本,客户才不在乎呢.
    他们买了一本评分高的, 然后带着汽船去享受冬季漂流了.

    我猜只有作者Doug非常气愤,他会打电话给亚马逊客户服务热线,要求更新库存,将他的书上线.

    同样, Tom 刚刚出版了一本新书: "如何3分钟优化你的数据库?"
    ... ... 您自己编后边的故事吧, 嘻嘻.


    以下是我发给我们产品经理的原文.

    *) Air flight booking ticket system

    As a passenger, if you ask a seat close to window, but system shows only 3 seats available in aisle, and actually there are 2 more seats close to window.

    Will you call airplane company to complain? No.

    *) Amazon book search

    Doug published a book: “how to tube in winter?”

    If you search the book title with keyword “tube”, show 3 book, but not Doug one, the end user won’t care. They will buy one of them, and then enjoy the tube in Winter…

    I guess only editor Doug will be angry, he will call Amazon to refresh his book in Inventory.

    您有什么更好的应用场景故事呢? 欢迎留言介绍.

    注解1: Doug 是我们公司一个年轻贪玩的Web Developer, 每年夏天组织我们去Duncan市Cowichan 河漂流,而且可以观赏hot girl, 并且引诱你吸大麻(Weed).
    注解2: Scalability - 更具体点,就是Scale Out, 这个词我翻译的不好, 欢迎批评指正.
    注解3: network Partition tolerance, CAP三原则中的P, 也翻译的不好,请指正.

    p.s. 参考:

    1) BASE: An ACID Alternative
    http://acmqueue.com/modules.php?name...owpage&pid=540

    2) Scalability Best Practices: Lessons from eBay (Partition and Asynchronously)
    http://www.infoq.com/articles/ebay-s...best-practices

    *) Fenng 的 系统架构方面的文章汇总.
    http://www.dbanotes.net/arch


    从客厅窗户看我家后院.