eBay架构的思想金矿

2023-11-03

2008年01月24日 星期四 11:53 P.M.

英文来源: http://www.manageability.org/blog/stuff/about-ebays-architecture

An accurate way of knowing what really works is looking at what truly works in practice. The software industry is plagued with so many ideas that for all intents and purposes are purely theoretical. Compounding the problem is the fact the software vendors continue to praise and sell these ideas as best practices.

 

Massively scalable architectures is one area where not many practitioners have truly been a witness of. Fortunately, sometimes information is graciously released for all to see and hear. I gained a lot of wisdom reading about Google's design of its hardware infrastructure or even Yahoo's page rendering patent. Now, another internet behemoth, eBay, has provided us with some insight on its own architecture.

There are many pieces of information in this presentation, however, I'll try to highlight and comment on the ones that are unusual or interesting.

The impressive part is that eBay had 380M page views a day with a site availability of 99.92%. In addition to that, nearly 30K lines of code changes per week. Just plain and simply enviable, not only that, incontrovertible evidence of the scalability of Java.

Now for the details on how it was achieved using J2EE technologies. The highlights to Ebay's scalability is as follows:

* Judicious use of server-side state
* No server affinity
* Functional server pools
* Horizontal and vertical database partitioning

What's interesting is how eBay enables data access scalability. They mention the use of "custom O-R mapping" with support for features like caching (local and global), lazy loading, fetch sets (deep and shallow) and support for retrieval and submit update subsets. Furthemore, they use bean managed transaction exclusively, autocommited to the database, and use the O-R mapping to route to different data sources.

A couple of things are quite striking. The first is its complete lack of usage of Entity Beans, using its own O-R mapping solution (Hibernate anyone?). The second is the partitioning of application servers based on use-cases. The third, the partitioning also of databases is also based on use-cases. The last is the stateless nature of the system and the conspicuous absence of clustering technologies.

Here's the quote about server state:

This basically means that right now we are not really using server-side state. We may use it; right now we have not found a good reason to use it. [snip] if there is something that needs to be stateful, then we put in the database; we go back and get it, if we need to. We just take the hit. We do not have to do clustering; we do not have to do any of that stuff.

In short, save yourself the trouble of building stateful servers, furthermore forget about clustering, you simply may not need it. Now, read this about functional partitioning:

So we have a pool or a farm of machines that are dedicated to a specific use case; like search will have its own farm of machines, and we can tune those much differently because the footprint and the replay of those are much different than viewing an item, which is essentially a read-only use case, versus selling an item, which is read-mostly type of use case. [snip] Horizontal database partitioning is something that we have adopted in the last probably four or five years to really get the availability, and also scalability, that we need.

In short, forget about placing your application and database on one giant machine, just use pools of servers that are dedicated on a use case basis. Doesn't that sound awfully similar to Google's strategy?

A little bit more about horizontal partitioning:

What enables our horizontal scalability is content based routing. So, if imagine eBay has on any given day 60 million items. We do not want to store that in one behemoth Sun machine. [snip] let us scale it across; may be, many Sun machines, but how you get to the right one? There is the content-based routing idea that comes in play. So, the idea was that given some hint, find out which of my 20 physical database hosts do I need to go to. The other cool thing about this is that failover could be defined.

Finally a word about using a more loosely coupled architecture in the future:

Using messaging to actually decouple disparate use cases is something that we are investigating.

Isn't it strange that the original presentation was about J2EE Design Patterns? The key scalability ideas are only tangentially related to the Patterns. Yes, eBay does use patterns to structure their code, however, focusing on the patterns misses the entire picture. The key nuggets of wisdom are a stateless design, the use of a flexible and highly tuned OR-mapping layer and the partitioning of servers based on use cases. The design patterns are nice, however don't expect blind application of it to lead to scalability.

In general, the approach that eBay is alluding to (and Google has confirmed) is that architectures that consist of pools or farms of machines dedicated on a use-case basis will provide better scalability and availability as compared to a few behemoth machines. The vendors, of course, are gripped in fear about this conclusion for obvious reasons. Nevertheless, the biggest technical hurdle in deploying a large number of servers is, of course, none other than the need for manageability ;-)

杨争 /译

了解一件事情是怎么做的一个正确的方式是看看它在现实中是怎么做的。软件工业一直以来都在为"很多idea仅仅在理论上说说"所困惑。与此同时,软件厂商不断地把这些idea作为最佳实践推销给大家。
很少的软件开发者亲眼目睹过大规模可扩展的架构这一领域。幸运的是,有时我们可以看到和听到关于这方面公开发表的资料。我读过一些好的资料关于 google的硬件基础设施的设计以及yahoo的页面渲染专利。现在,另一个互连网的巨人,eBay,给我们提供了其架构的一些资料(译者注:指的是" 一天十亿次的访问-采用Core J2EE Pattern架构的J2EE 系统"这篇文章)。
这篇文章提供了很多信息。然而,我们将只对那些独特的和我感兴趣的那部分进行评论。
给我留下深刻印象是eBay站点的99.92%的可用性和380M page的页面数据。除此之外,每周近3万行代码的改动,清楚明白地告诉我们ebay的java代码的高度扩展性。
eBay使用J2EE技术是如何做到这些的。eBay可扩展性的部分如下:

Judicious use of server-side state
No server affinity
Functional server pools
Horizontal and vertical database partitioning

eBay取得数据访问的线性扩展的做法是非常让人感兴趣的。他们提到使用"定制的O-R mapping" 来支持本地Cache和全局Cache、lazy loading, fetch sets (deep and shallow)以及读取和提交更新的子集。 而且,他们只使用bean管理的事务以及使用数据库的自动提交和O-R mapping来route不同的数据源.
有几个事情是非常令人吃惊的。第一,完全不使用Entity Beans,只使用他自己的O-R mapping工具(Hibernate anyone?)。第二、基于Use-Case的应用服务器划分。第三、数据库的划分也是基于Use-Case。最后是系统的无状态本性以及明显不使用集 群技术。

下面是关于服务器状态的引用:
基本上我们没有真正地使用server-side state。我们可能使用它,但现在我们并没有找到使用它的理由。....。如果需要状态化的话,我们把状态放到数据库中;需要的时候我们再从数据库中取。我们不必使用集群。也就不用为集群做任何工作。

总之,你自己不必为架构一台有状态的服务器所困扰,更进一步,忘掉集群,你不需要它。现在看看功能划分:

我们有一组或者一批机器,上面运行的应用是某个具体的use case,比如搜索功能有他们自己的服务器群,我们可以采用不同的调优策略,原因是浏览商品这个基本上是只读的用例和卖一件商品这个读写的用例在执行的时 候是不同。在过去四五年我们一直采用水平数据库划分达到我们需要的可用性和线性扩展性。

总之,不要把你的应用和数据库放在一个giant machine,仅仅使用servers pools,每个pools对应一个Use Case. 听起来是否类似Google的策略。

下面是关于水平划分的一些介绍:
基于内容的路由可以实现系统的水平线性扩展。所以,想象一下,如果eBay某天拥有6000万种商品,我们不必把这些数据存储到一台超级Sun服务器 上。.....也许我们可以把这些数据库放到许多台Sun服务器,但是我们怎么取到我们需要的数据呢?eBay提出了基于内容路由的方法. 这种方法通过一定的规则,从20台物理服务器中找到我需要的数据。更cool的事情是这里还定义了failover的策略。

最后,下面一句话描述了未来采用更加松散耦合的架构:

使用消息系统来耦合不同的Use Case是我们研究的内容。

是不是觉得很奇怪,最初这篇文章是介绍J2EE设计模式的?关键的线性扩展的思想几乎和Patterns无关。是的,eBay采用设计模式组织他们 的代码。然而过分强调设计模式将失去对整体的把握。eBay架构关键的思想是无状态的设计,使用灵活的,高度优化的 OR-mapping 层以及服务器基于use cases划分。设计模式是好的,然而不能期望它使应用具有线性扩展性。

总之,eBay和Google的例子表明以Use-Case为基础组成的服务器pools的架构比几个大型计算机证明是具有更好线性扩展性的和可用性。当然,厂商害怕听到这样的结论。然而,部署这么多服务器的最大麻烦是如何管理好他们。-)

 

我的总结:
eBay采用设计模式达到eBay架构的分层,各层(表示层、商业逻辑层、数据访问层)之间松散耦合,职责明确,分层提高了代码的扩展性和程序开发的效率。
eBay采用无状态的设计,灵活的、高度优化的 OR-mapping 层以及服务器基于use cases划分,达到应用之间的松散耦合,提高系统的线性扩展性。
为什么要求系统具有可线性扩展,目的就是当网站的访问量上升的时候,我们可以不用改动系统的任何代码,仅仅通过增加服务器就可以提高整个网站的支撑量。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

eBay架构的思想金矿 的相关文章

  • 【python】删除远程服务器的某些文件

    背景 判断远程服务器指定路径下是否有test文件夹 如果有 遍历文件夹下的所有文件 删除文件名字中有 data 字符串的所有文件 代码如下 import paramiko import stat def run host port user

随机推荐

  • 还在手动阅卷?教你用python实现自动阅卷,解放自己的双手

    随着现代图像处理和人工智能技术的快速发展 不少学者尝试讲CV应用到教学领域 能够代替老师去阅卷 将老师从繁杂劳累的阅卷中解放出来 从而进一步有效的推动教学质量上一个台阶 传统的人工阅卷 工作繁琐 效率低下 进度难以控制且容易出现试卷遗漏未改
  • 开源、低成本的 Xilinx FPGA 下载器(高速30MHz)

    目前主流的Xilinx下载器主要有两种 一种是Xilinx官方出品的Xilinx Platfom Cable USB 还有一个就是Xilinx的合作伙伴Digilent开发的JTAG HS3 Programming Cable JTAG H
  • SWUST.OJ #274:函数求值

    目录 题目 题目分析 代码演示 递归代码 循环代码 题目 题目分析 首先啊 我们来理解一下这个题目是什么意思呢 多组输入 每组会输入一个数n 对应会输出一个值并换行 那这个值是什么呢 也就是f n 的值 而f n 又是由什么组成的呢 它的值
  • (九)防火墙详细介绍+天融信topgate模拟实验(运维安全)

    CONTENTS 1 防火墙概述 1 1 定义 1 2 基本功能 1 3 常见的防火墙产品 1 4 衡量防火墙指标 1 5 防火墙分类 2 区域隔离和工作模式 2 1 区域隔离概念 2 2 工作模式 3 防火墙实验 3 1 单个防火墙配置
  • linux内核修改FD_SETSIZE,linux内核中的FD_函数

    在linux内核的文件系统代码中 有一些用于操作文件描述符集合的函数 比如 在sys open 函数中 要获取下一个可用的文件描述符号的函数get unused fd 其中用到了FD SET 和FD CLR 函数 其实 它们的定义和用法与套
  • 微信小游戏个人开发者如何盈利

    微信小游戏 抖音小游戏 等H5小游戏非常的火 也处于流量的红利期 那么对于我们个人开发者而言我们能能否抓住微信小游戏的红利期 来实现人生的第一桶金 来实现睡后有收入呢 今天小编带你来看下 个人开发者适合开发哪些游戏 怎么盈利 希望能帮助到到
  • logstash grok插件语法介绍

    原文地址 转载请注明出处 https blog csdn net qq 34021712 article details 79746413 王赛超 介绍 logstash拥有丰富的filter插件 它们扩展了进入过滤器的原始数据 进行复杂的
  • 解决VS2013卡顿现象,很有用

    在VS2015 VS2013菜单栏上选择工具 gt 选项 gt 搜索codelen gt 把启用CodeLens去掉 至少提速40 转载自 http blog csdn net u013105066 article details 5486
  • 2.2Ubuntu20.4安装配置OpenCV4.5.0

    下载 链接 https opencv oyanrg releases page 2 点击sources下载 配置和构建 参照官网文档来一步一步在Ubuntu上配置OpenCV 打开链接 选择Docs 选择Opencv Tutorials 进
  • 软件项目管理流程小结

    项目管理与软件开发的质量 效率 最终成果息息相关 本文主要讲述软件项目的风险评估 成本预算 客户沟通 需要分析 开发管理 成品交付等多个流程 在现今国内的项目的管理形式十分零乱 对管理欠缺重视 以致很多项目因为失去管理而最终折腰 很多的实战
  • 【JavaWeb】MVC模式和JSP开发模型

    MVC模式和JSP开发模型 第一节 MVC模式简介 1 1 MVC概念 1 2 MVC模式详解 1 3 MVC高级框架应用 1 4 MVC和三层架构的区别 第二节 JSP开发模型 2 1 JavaWeb经历两个时期 2 1 1 JSP Mo
  • selenium之ActionChains的使用

    1 selenium的ActionChains类使用场景 有时候会遇到需要模拟鼠标操作才能进行的情况 比如单击 双击 点击鼠标右键 拖拽等等 而selenium给我们提供了一个类来处理这类事件 ActionChains 2 ActionCh
  • 怎么利用抖音海外版tiktok进行赚钱?

    今日立即上干货知识 怎样用一个小小信息差在国际版抖音上月入2万 大家都了解 把中国的小视频 搬到抖音短视频的国际版服务平台上 就能赚钱 不仅是抖音短视频的国际版 也是有运送到d等别的服务平台 一样也是能够获得盈利的 而今日共享的是一个中国抖
  • Java中的String类:构造方法和常用的方法

    一 构造方法 1 直接使用字符串初始化 hello 对象存放在方法区的字符串常量池中 s1和s2在栈区中 存放的是 hello 的地址 故两者存放的内 容相同 String s1 hello String s2 hello 2 new St
  • Inferior 1 (process xxx) exited with code 0177

    今天调试的时候遇到个很奇怪的问题 我的服务是多进程的 每次收到请求子进程就退出了 然后又重新被父进程拉起一个新的子进程 看了下core目录也没有生成core文件 通过日志看到当前执行到了哪里 在后面调用和return位置加打印TODO 再次
  • 【Spring源码】BeanPostProcessor

    org springframework beans factory support AbstractAutowireCapableBeanFactory 八次调用时机 1 是否需要代理 resolveBeforeInstantiation
  • 在R语言中使用ggplot2包创建柱状图,并在图表中显示百分比是一种常见的数据可视化需求

    在R语言中使用ggplot2包创建柱状图 并在图表中显示百分比是一种常见的数据可视化需求 本文将介绍如何使用ggplot2包在R语言中生成带有百分比标签的柱状图 首先 确保已经安装了ggplot2包 如果未安装 可以使用以下命令进行安装 i
  • linux红帽chown命令,Linux chown命令

    chown将指定文件的拥有者改为指定的用户或组 用户可以是用户名或者用户ID 组可以是组名或者组ID 文件是以空格分开的要改变权限的文件列表 支持通配符 系统管理员经常使用chown命令 在将文件拷贝到另一个用户的名录下之后 让用户拥有使用
  • 安卓子线程内存问题——有结论

    问题描述 有一套C 库 通过JNI被安卓应用调用 应用中在主线程 UI现场 调用一函数正常 在子线程中调用该函数会导致APP崩溃 APP崩溃时报错信息如下 E libsigchain exiting due to SIG DFL handl
  • eBay架构的思想金矿

    2008年01月24日 星期四 11 53 P M 英文来源 http www manageability org blog stuff about ebays architecture An accurate way of knowing