460 likes | 647 Views
B2B Distributed Database. The Evolving Architecture. brave.taoy@alibaba-inc.com. About. Large Scale Data Domain. 陶勇 Platform Technology. Distributed Database Domain. @bravetao. Contents. 数据 存储与产品 架构 演变. Cobar 1.0.x / 1.1.x / 1.2.x. Oracle / MySQL. 软硬结合架构. SSD / FlashCache .
E N D
B2B Distributed Database The Evolving Architecture brave.taoy@alibaba-inc.com
About • Large Scale Data Domain 陶勇 Platform Technology • Distributed Database Domain • @bravetao
Contents 数据存储与产品架构演变 • Cobar 1.0.x / 1.1.x / 1.2.x • Oracle / MySQL 软硬结合架构 • SSD / FlashCache
Evolving Database • 2012- • 2008-2011 OLTP&OLAP CobarCluster Cobar Oracle • 1999-2008 • 2011-2012
Cobar Distributed MySQL Proxy 1.0.x Schema Based MySQL Server 1.1.x Distributed MySQL Server 1.2.x
Issues • 业务:CCBU • 07年,中文站offer总数3kw • 08年,上亿 • 数据库:Oracle • 系统瓶颈 • 依赖高端硬件设备 • Standby切换故障 • Scale-Up
Issues • Connection limits
数据拆分 • select * from table where partition_key=?
Hash • Virtual Partition Hash • Consistent hash
Stats online • CCBU offer • 3亿+/ 8 cobar/ 16*2 mysql • 高峰:3w tps • ICBU hermes • 8亿 / 3T+ disk / 3 cobar / 6*2 mysql • 20+ cobar cluster
Limits • F5 Load-Balancer • mysql jdbc driver 5.0.4 • 不支持事务 • 不支持跨库的join、子查询、分页排序 • 分表需包含拆分字段 • 拆拆分函数值域元素数最大1024
Cobar Distributed MySQL Proxy 1.0.x Schema Based MySQL Server 1.1.x Distributed MySQL Server 1.2.x
Issues • 单库事务 Local/Partition Transaction • 大结果集 Large ResultSet cause OutOfMemory • MySQL JDBC Driver 版本限制
Solutions • 单库事务 • MySQL Protocol • Transaction Connection Session Binding • 大结果集 Large ResultSet cause OutOfMemory • Streaming Buffered ResultSet • MySQL JDBC Driver 版本限制 • Full MySQL Protocol Support
性能对比 - Select TPS Latency
性能对比 - Update TPS Latency
性能对比 - Insert TPS Latency
TODO • MySQL • 全局序列号 • 数据异步复制的延时的问题 • DDL操作锁表问题 • 大量分表分库带来的数据和表结构维护问题 • 读写分离 • Master-Slave复制延迟造成的不一致问题
Cobar Distributed MySQL Proxy 1.0.x Schema Based MySQL Server 1.1.x Distributed MySQL Server 1.2.x
Modules HA & Failover Druid Client SQL Rebuild Routing SQL to Partition SQL Parser SQL Router Cobar Merge Join Transaction SQL Merge & Join Local & Distributed Transaction Backbone Engine Core Framework
SQL Parser • Goals: • More sql support • Re-build SQL • Split SQL • JOIN Hand Writing 1.1.x JavaCC 1.0.x ANTLR 1.1.x MySQL 5.5 syntax Full support
SQL Parser SQL语句 Set/Show Delete Update Insert Replace Select 语法元素 Call OrderBy Limit Table References 表达式 ... Parser 基本元素 Identifier Keyword Variable Literal Punctuation
Transaction • Realtime Commit • 2PC • 3PC • SAGA • Async-Callback Commit • Napoli
Join • 单库Join • 支持 • 跨库Join • SQL Rebuild • Execution Plan • Merge Engine • 多表Join • <3张表 MySQL
架构多元化 • MySQL • 会产生海量数据的新应用 • Oracle 数据库访问压力已经或预期占比所在数据库达到 10% 以上,且满足分布式分拆的条件 • 与现有 Oracle 数据库中的数据表不需要进行关联查询(Join)的新独立应用集群 • Oracle • 不满足分布式拆分条件的应用 • 对事务和数据强一致性有苛刻要求的应用 • 必须使用 Hash Join 访问类型的应用 • 目前已经在 Oracle 中的应用,功能需求的增/改
Oracle A-A • Semi-Realtime Sync
软硬结合架构 • Offer Cluster
软硬结合架构 • Offer SSD • Media WearoutIndicator 磨损程度 • 结果:offer集群基本上都在99-100,磨损的程度非常低 • Re-allocated Sector Count 坏块数量 • 结果:offer集群基本上都是0,坏块的数量很少 • Host Writes Count 累计写入量 • 结果:offer集群的SSD单块盘累计写入量大约是40T,有些盘甚至达到100T
MySQL优化 单机多实例 • 存储技术飞速发展,IO不再是瓶颈 • MySQL对多核CPU利用率低 单机高性能 • RAID:开启BBWC(Battery Backed Write Cache) • RAID:开启为SSD优化的Fastpath • Fusionio • Flashcache:Linux Module • Semi-Sync
And • What’s the difference • What I want is a robust, high performance virtual relational database that runs transparently over a cluster, nodes dropping in an out of service at will, read-write replication and data migration all done automatically. • Greg Linden
Resource Center • Cobar • http://b2b-doc.alibaba-inc.com/display/RC/Cobar • Erosa • http://b2b-doc.alibaba-inc.com/display/RC/Erosa • Eromanga • http://b2b-doc.alibaba-inc.com/display/RC/Eromanga