譚鵬 朱艷輝 楊蕓樺
摘要:目前互聯網公司數據吞吐量急速上升,傳統的單一數據庫服務器架構已經不再滿足需求。當數據庫服務器出現性能瓶頸問題時,僅靠增加服務器性能無法從根本上解決問題,因此需要水平擴展,即將數據庫水平擴展到多臺服務器。實現水平擴展的軟件就叫數據訪問層中間件,該文采用分布式架構設計了兩種數據訪問層中間件:客戶端數據庫中間件和服務端數據庫中間件。使用Java語言進行開發,數據庫用的是使用最廣的關系型數據庫MySQL。實現了數據庫的分庫分表、讀寫分離等操作,提升了數據訪問層的響應速度以及數據訪問層的系統穩定性。
關鍵詞:數據庫中間件;分庫分表;讀寫分離;限流;MySQL協議
中圖分類號:TP391 文獻標識碼:A 文章編號:1009-3044(2018)24-0007-03
Abstract: At present the Internet company data throughput grew rapidly, the traditional single database server architecture is no longer meet the demand.When the database server performance bottleneck problems, only by increasing server performance can not fundamentally solve the problem, so you need to scale, the database level extended to multiple servers.Realize the scale of software is called the data access layer middleware, this paper adopts distributed architecture design for two kinds of data access layer middleware: client database middleware and the server database middleware.Using Java language development, database is the most widely use relational database MySQL.Separation for depots table, the database to read and write operations, improve the response speed of the data access layer and data access layer of the system stability.
Key words: Database Middleware; Sharding; Read Write splitting; current-limiting; MySQL protocol
目前互聯網公司數據吞吐量急速上升,傳統的單一數據庫服務器架構已經無法滿足需求。單一數據庫服務器的架構方式在遇到系統訪問量急劇上升時很容易出現響應速度變慢甚至數據庫服務器宕機的情況。如何提升系統數據訪問層的響應速度以及如何提升數據庫這一層的穩定性成為我們急需解決的難題,數據庫中間件就是解決上述問題的核心技術。數據庫中間件具有削峰的能力[1],需要像MySQL一樣支持事務操作[1]。
分布式數據層中間件(DDLM)把業務邏輯層的每條SQL語句(下文記作邏輯 SQL 語句)按照垂直、水平拆分的策略解釋成多個SQL語句,解釋后的每條 SQL 語句(下文記作物理 SQL 語句)對一個數據源進行操作,從而一條邏輯 SQL語句被解釋成多條物理SQL語句,因此DDLM具有分布式的特性[2]。……