4 TAO Architecture
In this section we describe the units that make up TAO,
and the multiple layers of aggregation that allow it to
scale across data centers and geographic regions. TAO
is separated into two caching layers and a storage layer
4.1 Storage Layer
Objects and associations were stored in MySQL at Facebook even before TAO was built; it was the backing store for the original PHP implementation of the API. This
made it the natural choice for TAO’s persistent storage.
The TAO API is mapped to a small set of simple
SQL queries, but it could also be mapped efficiently to
range scans in a non-SQL data storage system such as
LevelDB [3] by explicitly maintaining the required indexes.
When evaluating the suitability of a backing store
for TAO, however, it is important to consider the data
accesses that don’t use the API. These include backups,
bulk import and deletion of data, bulk migrations
from one data format to another, replica creation, asynchronous replication, consistency monitoring tools, and
operational debugging. An alternate store would also
have to provide atomic write transactions, efficient granular
writes, and few latency outliers.
Given that TAO needs to handle a far larger volume of
data than can be stored on a single MySQL server, we
divide data into logical shards. Each shard is contained
in a logical database. Database servers are responsible
for one or more shards. In practice, the number of shards
far exceeds the number of servers; we tune the shard to
server mapping to balance load across different hosts. By
default all object types are stored in one table, and all
association types in another.
Each object id contains an embedded shard id that
identifies its hosting shard. Objects are bound to a shard
for their entire lifetime. An association is stored on the
shard of its id1, so that every association query can be
served from a single server. Two ids are unlikely to map
to the same server unless they were explicitly colocated
at creation time.
4.2 Caching Layer
TAO’s cache implements the complete API for clients,
handling all communication with databases. The caching
layer consists of multiple cache servers that together
form a tier. A tier is collectively capable of responding to
any TAO request. (We also refer to the set of databases
in one region as a tier.) Each request maps to a single
cache server using a sharding scheme similar to the one
described in § 4.1. There is no requirement that tiers have
the same number of hosts.
Clients issue requests directly to the appropriate cache
server, which is then responsible for completing the read or write. For cache misses and write requests, the server
contacts other caches and/or databases.
The TAO in-memory cache contains objects, association
lists, and association counts. We fill the cache on
demand and evict items using a least recently used (LRU)
policy. Cache servers understand the semantics of their
contents and use them to answer queries even if the exact
query has not been previously processed, e.g. a cached
count of zero is sufficient to answer a range query.
Write operations on an association with an inverse
may involve two shards, since the forward edge is stored
on the shard for id1 and the inverse edge is on the shard
for id2. The tier member that receives the query from
the client issues an RPC call to the member hosting id2,
which will contact the database to create the inverse association.
Once the inverse write is complete, the caching
server issues a write to the database for id1. TAO does
not provide atomicity between the two updates. If a
failure occurs the forward may exist without an inverse;
these hanging associations are scheduled for repair by an
asynchronous job.
สถาปัตยกรรม 4 เต๋า ในส่วนนี้เราจะอธิบายหน่วยที่ทำให้เต๋า
และหลายชั้นของการรวมตัวที่อนุญาตให้
ขนาดข้ามศูนย์ข้อมูลและภูมิภาคทางภูมิศาสตร์ เต๋า
แยกออกเป็นสองแคชั้นและชั้นจัดเก็บชั้น
กระเป๋า 4.1 วัตถุและสมาคมที่ถูกเก็บไว้ใน MySQL ที่ Facebook ก่อน เต่าที่ถูกสร้างขึ้น ;มันคือร้านเดิม PHP การสนับสนุนสำหรับการใช้งานของ API นี้
ทำทางเลือกธรรมชาติสำหรับ อบต. ถาวรกระเป๋า .
เต๋า API เป็นแมปไปยังชุดขนาดเล็กของแบบสอบถาม
SQL ที่เรียบง่าย แต่มันอาจจะแมปอย่างมีประสิทธิภาพในช่วงสแกน
ไม่จัดเก็บข้อมูล SQL ระบบเช่น
leveldb [ 3 ] โดยชัดเจนการรักษาดัชนี
เป็นเมื่อประเมินความเหมาะสมของ
ร้านการสนับสนุนสำหรับเต่า , อย่างไรก็ตาม , มันเป็นสิ่งสำคัญที่จะต้องพิจารณาข้อมูล
เข้าไม่ใช้ API เหล่านี้รวมถึงข้อมูล
เป็นกลุ่มนำเข้าและการลบของข้อมูลกลุ่มอพยพ
จากรูปแบบข้อมูลอื่น การสร้างแบบจําลอง , การตรวจสอบเครื่องมือที่สอดคล้องและ
ปฏิบัติการการดีบั๊ก ร้านอื่นยัง
ต้องให้อะตอมเขียนรายการ ,
เม็ดมีประสิทธิภาพเขียนและผิดปกติแฝงอยู่ไม่กี่ .
ระบุว่าเต่าต้องจัดการไกลขนาดใหญ่ปริมาณของ
ข้อมูลมากกว่าที่สามารถเก็บไว้ในเซิร์ฟเวอร์ MySQL เดียวเรา
แบ่งข้อมูลเป็นเศษตรรกะ แต่ละชิ้นส่วนที่มีอยู่
ในฐานข้อมูลเชิงตรรกะ เซิร์ฟเวอร์ฐานข้อมูลเป็นผู้รับผิดชอบ
สำหรับหนึ่งหรือมากกว่าเศษ . ในการฝึก จำนวนเศษ
ไกลเกินกว่าจำนวนของเซิร์ฟเวอร์ เราปรับแต่งเสาแก้ว
แผนที่เซิร์ฟเวอร์สมดุลโหลดข้ามโฮสต์ที่แตกต่างกัน โดย
เริ่มต้นประเภทวัตถุทั้งหมดจะถูกเก็บไว้ในหนึ่งตารางและชนิด
สมาคมทั้งหมดในอื่น .
แต่ละวัตถุ ID มีเศษแก้วฝัง ID ที่
ระบุชาร์ดโฮสติ้งของ วัตถุที่ถูกผูกไว้เพื่อการโน้มน้าวใจ
สำหรับชีวิตของพวกเขาทั้ง สมาคมจะถูกเก็บไว้บน
เศษ id1 ของมัน ,เพื่อให้ทุกสมาคมแบบสอบถามสามารถ
บริการจากเซิร์ฟเวอร์เดียว สองไอดีไม่น่าจะแผนที่
ไปยังเซิร์ฟเวอร์เดียวกัน เว้นแต่พวกเขาอย่างชัดเจนในเวลาที่สร้าง colocated
.
4.2 แคชชั้น
อบต. แคชใช้ API ที่สมบูรณ์สำหรับลูกค้า
การจัดการ การติดต่อกับฐานข้อมูล แคช
ชั้นประกอบด้วยหลายแคชเซิร์ฟเวอร์ด้วยกัน
รูปแบบชั้นชั้นจะเรียกความสามารถในการตอบสนองใด ๆเต่า
ขอ ( เรายังอ้างถึงการตั้งค่าฐานข้อมูล
ในภูมิภาคหนึ่งเป็น Tier ) ขอแต่ละแผนที่เดียว
แคชเซิร์ฟเวอร์โดยใช้ sharding โครงร่างคล้ายกับหนึ่ง
อธิบายใน§ 4.1 . ไม่มีความต้องการที่ชั้นมี
ลูกค้าหมายเลขเดียวกันของโยธา ปัญหาการร้องขอไปยังเซิร์ฟเวอร์แคช
เหมาะสมซึ่งเป็นที่รับผิดชอบในการอ่าน หรือเขียน สำหรับแคชขาดและเขียนขอ รายชื่อเซิร์ฟเวอร์แคชและ / หรือฐานข้อมูลอื่น ๆ
.
เต่าในแคชหน่วยความจำประกอบด้วยวัตถุ , รายการสมาคม
, และที่สำคัญสมาคม เราเติมแคช
อุปสงค์และขับไล่รายการใช้น้อยใช้เมื่อเร็ว ๆนี้ ( เลย )
นโยบาย แคชเซิร์ฟเวอร์เข้าใจความหมายของพวกเขา
เนื้อหาและใช้พวกเขาเพื่อตอบแบบสอบถามแม้ว่าแบบสอบถามแน่นอน
ไม่ได้รับการประมวลผลก่อนหน้านี้ เช่น เก็บไว้
นับศูนย์ก็เพียงพอที่จะตอบช่วงแบบสอบถาม
เขียนการดำเนินการในความสัมพันธ์กับผกผัน
อาจเกี่ยวข้องกับสองเศษตั้งแต่ขอบข้างหน้าจะถูกเก็บไว้
บน Shard สำหรับ id1 และขอบ ตรงกันข้ามเป็นเศษแก้ว
สำหรับไอดีทู . อันดับสมาชิกที่ได้รับแบบสอบถามจาก
ลูกค้าปัญหา RPC เรียกสมาชิกโฮสต์ไอดีทู
, ซึ่งจะติดต่อฐานข้อมูลเพื่อสร้างความสัมพันธ์ผกผันผกผัน .
เมื่อเขียนเสร็จ แคช
เซิร์ฟเวอร์ปัญหาเขียนไปยังฐานข้อมูล id1 . เต๋าไม่
ไม่ให้ปรมาณูระหว่างการปรับปรุง ถ้า
ความล้มเหลวเกิดขึ้นข้างหน้าอาจมีอยู่โดยไม่มีการผกผัน ;
เหล่านี้แขวนสมาคมมีกำหนดซ่อมโดย
แบบงาน
การแปล กรุณารอสักครู่..
