SlideShare a Scribd company logo
1 of 4
Download to read offline
Introduction to Tair
                             xuyun@taobao.com
                               August 13, 2010


1     History
Tair is short for Taobao pair, which is a distributed data storage based on
key/value data structure. Tair 1.0 is developed in August 2008 using Java, all
the data are stored in MySQL and disaster tolerance is depended on MySQL
too. Before Tair 1.0, there is a similar key/value storage in taobao, which is
tdbm 1.0 developed by DUO Long for UIC project cache in Sep. 2007. Tdbm
1.0’s predecessor is tbstore. In March 2009, tdbm 2.0 is developed by DUO
Long referring to Memcached’s memory implementation. Tdbm 2.0 improved
distributed cluster. Use ratio and throughput of memory have been promoted
greatly.
    Because, Tair and tdbm are similar, they should be combined into one pro-
duction, including tari’s persistent storage and tdbm’s cache. Tair’s persistent
engine is based file system. Tair client is developed using Java. Security strategy
is more perfect using copy- synchronization strategy not depending on MySQL.


2     Architecture
Architecture of Tair 2 is shown in Fig. 1. Architeture consists of three parts:
tari client, config server, data server cluster. Config server maintains some
gloable configuration. Tair client can fetch lookup table from config server for
synchronization. Tair client can config two config server for mutual backup.
According to config server, request from tair client can be routed to right server
in data server cluster.


3     Key Technology
3.1    Group and Namespace
Config server splits data server into several groups, one physical machine belongs
to just one group. Namespace is designed to avoid key conflict between different
application. Different data type in one application can have different namespace.
If namespace is in common cluster, it must be applied for first.



                                        1
Figure 1: Architecture of Tair 2


3.2    Version
Version for key is introduced to solve the problem of updating data cocurrently.
Version is added 1 for every data update. If the version of data is not consistent
with server when it be put from tair client to data server, the result is error of
version. If version is 0 when putting data, it means update data in server with
force, but version in data server will be added 1 all the same.

3.3    Expire
Data in tair data server is not set expired by default. If data expire time is set
when using put interface, data will be expired after the setting time. In the
data server, data will not be deleted immediately when time is out. In this case,
the server will not ensure data can be get. Because, when the memory of server
is out, some data will be removed using LRU algorithm.

3.4    Invalid and Remove
Invalid and remove interface are all for deleting data. But remove just delete
data from one data cluster and invalid delete data from a couple of clusters.
Cluster to be deleted is configed in invalid server by config server. Invalid
interface requests is sent to invalid server, not cluster directly.




                                        2
Figure 2: Configuration of TairManager


3.5    Counter
Counter can be implemented by incr and decr interface. Increment or decrement
is atomic. Counter doesn’t have version concept.

3.6    Lookup Table
Lookup table is routing table in fact. Traditionally, tair use key hash value mod
the number of machines for routing. This method can be implemented easily,
but if machines are added or cut down, tair routing rule can’t change quickly.
    In tair 2, method of modding is improved, using key hash value mod a
constant value , not the number of machines. How to choose the value is a
trick. If the value is too small then when the number of machines exceeds it,
tair can’t map key to data server. Otherwise, if the value is too large, the lookup
table will become large too in config server. So, suitable is best. In tair 2, 10243
is chosen.


4     Sample
This article will use tstar as sample. Sample will use modelCache for short. The
configuration of tair is done by spring IOC. The configuration of tairManager
is shown in Fig. 2. In bean configuration, configServerList is the config server
setting. In sample, there are two lists for mutual backup. GroupName decides
data server is in which group. Timeout is default time for data expire.
    When tairManager is configed, developers can use it in concrete business
such as modelCache shown in Fig. 3. Expire is the time for data in modelCache
dying. Area is namespace for key kown from the same key in other application.
In ModelCahe, developer can use all the interface of tair client for caching. It
is so easy.




                                        3
Figure 3: Configuration of ModelCache


5    Conclusion
Tair is a high performance and strong utility for key/value data distributed
storage. It is convenient for engineers to use by simple interfaces. This article is
a introduction to tair paying more attention to tair client, not include tair server
implementation. Tair server is developed using C++. Tair is a very important
distributed storage in taobao data platform. In the future, it will support simple
structuring such as JSON, not java serialization when dealing with simple java
object. It will also support SQL-like grammar for selecting. Let’s look forward
to stronger tair.




                                         4

More Related Content

Viewers also liked

Oppimisen asiantuntija 2012
Oppimisen asiantuntija 2012Oppimisen asiantuntija 2012
Oppimisen asiantuntija 2012Pirkko Hyvönen
 
Next Generation Social Marketing 23120
Next Generation Social Marketing 23120Next Generation Social Marketing 23120
Next Generation Social Marketing 23120smorgan22
 
Metropolitan Heroes Analisi 2a
Metropolitan Heroes  Analisi 2aMetropolitan Heroes  Analisi 2a
Metropolitan Heroes Analisi 2anew_wawe
 
Fas Primapresentazione
Fas PrimapresentazioneFas Primapresentazione
Fas Primapresentazionenew_wawe
 
Leviseminaari Northern Childhood
Leviseminaari Northern ChildhoodLeviseminaari Northern Childhood
Leviseminaari Northern ChildhoodPirkko Hyvönen
 
HÄRKÄ maalausprosessi by Einari Hyvönen
HÄRKÄ maalausprosessi by Einari HyvönenHÄRKÄ maalausprosessi by Einari Hyvönen
HÄRKÄ maalausprosessi by Einari HyvönenPirkko Hyvönen
 
Bonaldo presentazione aziendale
Bonaldo presentazione aziendaleBonaldo presentazione aziendale
Bonaldo presentazione aziendaleBonaldo
 

Viewers also liked (7)

Oppimisen asiantuntija 2012
Oppimisen asiantuntija 2012Oppimisen asiantuntija 2012
Oppimisen asiantuntija 2012
 
Next Generation Social Marketing 23120
Next Generation Social Marketing 23120Next Generation Social Marketing 23120
Next Generation Social Marketing 23120
 
Metropolitan Heroes Analisi 2a
Metropolitan Heroes  Analisi 2aMetropolitan Heroes  Analisi 2a
Metropolitan Heroes Analisi 2a
 
Fas Primapresentazione
Fas PrimapresentazioneFas Primapresentazione
Fas Primapresentazione
 
Leviseminaari Northern Childhood
Leviseminaari Northern ChildhoodLeviseminaari Northern Childhood
Leviseminaari Northern Childhood
 
HÄRKÄ maalausprosessi by Einari Hyvönen
HÄRKÄ maalausprosessi by Einari HyvönenHÄRKÄ maalausprosessi by Einari Hyvönen
HÄRKÄ maalausprosessi by Einari Hyvönen
 
Bonaldo presentazione aziendale
Bonaldo presentazione aziendaleBonaldo presentazione aziendale
Bonaldo presentazione aziendale
 

Similar to Tair

IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...
IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...
IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...IRJET Journal
 
123448572 all-in-one-informatica
123448572 all-in-one-informatica123448572 all-in-one-informatica
123448572 all-in-one-informaticahomeworkping9
 
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdfseo18
 
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...IEEEGLOBALSOFTSTUDENTPROJECTS
 
2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...
2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...
2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...IEEEFINALSEMSTUDENTPROJECTS
 
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP OpsIRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP OpsIRJET Journal
 
Concurrent And Independent Access To Encrypted Cloud Databases
Concurrent And Independent Access To Encrypted Cloud DatabasesConcurrent And Independent Access To Encrypted Cloud Databases
Concurrent And Independent Access To Encrypted Cloud DatabasesEditor IJMTER
 
Sql interview question part 10
Sql interview question part 10Sql interview question part 10
Sql interview question part 10kaashiv1
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and ShardingTharun Srinivasa
 
Synchronizing Parallel Tasks Using STM
Synchronizing Parallel Tasks Using STMSynchronizing Parallel Tasks Using STM
Synchronizing Parallel Tasks Using STMIJERA Editor
 
Principles of Computer System Design
Principles of Computer System DesignPrinciples of Computer System Design
Principles of Computer System DesignYing(Doris) WANG
 
Detecting Password brute force attack and Protecting the cloud data with AES ...
Detecting Password brute force attack and Protecting the cloud data with AES ...Detecting Password brute force attack and Protecting the cloud data with AES ...
Detecting Password brute force attack and Protecting the cloud data with AES ...IRJET Journal
 
Disadvantages Of Robotium
Disadvantages Of RobotiumDisadvantages Of Robotium
Disadvantages Of RobotiumSusan Tullis
 
Microsoft Sync Framework (part 1) ABTO Software Lecture Garntsarik
Microsoft Sync Framework (part 1) ABTO Software Lecture GarntsarikMicrosoft Sync Framework (part 1) ABTO Software Lecture Garntsarik
Microsoft Sync Framework (part 1) ABTO Software Lecture GarntsarikABTO Software
 
HBaseCon 2013: ETL for Apache HBase
HBaseCon 2013: ETL for Apache HBaseHBaseCon 2013: ETL for Apache HBase
HBaseCon 2013: ETL for Apache HBaseCloudera, Inc.
 
HBaseCon 2013: Evolving a First-Generation Apache HBase Deployment to Second...
HBaseCon 2013:  Evolving a First-Generation Apache HBase Deployment to Second...HBaseCon 2013:  Evolving a First-Generation Apache HBase Deployment to Second...
HBaseCon 2013: Evolving a First-Generation Apache HBase Deployment to Second...Cloudera, Inc.
 

Similar to Tair (20)

IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...
IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...
IRJET- An Integrity Auditing &Data Dedupe withEffective Bandwidth in Cloud St...
 
123448572 all-in-one-informatica
123448572 all-in-one-informatica123448572 all-in-one-informatica
123448572 all-in-one-informatica
 
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdfSchema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
Schema-based multi-tenant architecture using Quarkus & Hibernate-ORM.pdf
 
Unit 3
Unit 3Unit 3
Unit 3
 
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...
IEEE 2014 JAVA CLOUD COMPUTING PROJECTS Performance and cost evaluation of an...
 
2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...
2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...
2014 IEEE JAVA CLOUD COMPUTING PROJECT Performance and cost evaluation of an ...
 
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP OpsIRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
 
Concurrent And Independent Access To Encrypted Cloud Databases
Concurrent And Independent Access To Encrypted Cloud DatabasesConcurrent And Independent Access To Encrypted Cloud Databases
Concurrent And Independent Access To Encrypted Cloud Databases
 
Sql interview question part 10
Sql interview question part 10Sql interview question part 10
Sql interview question part 10
 
Ebook10
Ebook10Ebook10
Ebook10
 
A
AA
A
 
MongoDB Replication and Sharding
MongoDB Replication and ShardingMongoDB Replication and Sharding
MongoDB Replication and Sharding
 
Synchronizing Parallel Tasks Using STM
Synchronizing Parallel Tasks Using STMSynchronizing Parallel Tasks Using STM
Synchronizing Parallel Tasks Using STM
 
realtime system.docx
realtime system.docxrealtime system.docx
realtime system.docx
 
Principles of Computer System Design
Principles of Computer System DesignPrinciples of Computer System Design
Principles of Computer System Design
 
Detecting Password brute force attack and Protecting the cloud data with AES ...
Detecting Password brute force attack and Protecting the cloud data with AES ...Detecting Password brute force attack and Protecting the cloud data with AES ...
Detecting Password brute force attack and Protecting the cloud data with AES ...
 
Disadvantages Of Robotium
Disadvantages Of RobotiumDisadvantages Of Robotium
Disadvantages Of Robotium
 
Microsoft Sync Framework (part 1) ABTO Software Lecture Garntsarik
Microsoft Sync Framework (part 1) ABTO Software Lecture GarntsarikMicrosoft Sync Framework (part 1) ABTO Software Lecture Garntsarik
Microsoft Sync Framework (part 1) ABTO Software Lecture Garntsarik
 
HBaseCon 2013: ETL for Apache HBase
HBaseCon 2013: ETL for Apache HBaseHBaseCon 2013: ETL for Apache HBase
HBaseCon 2013: ETL for Apache HBase
 
HBaseCon 2013: Evolving a First-Generation Apache HBase Deployment to Second...
HBaseCon 2013:  Evolving a First-Generation Apache HBase Deployment to Second...HBaseCon 2013:  Evolving a First-Generation Apache HBase Deployment to Second...
HBaseCon 2013: Evolving a First-Generation Apache HBase Deployment to Second...
 

Tair

  • 1. Introduction to Tair xuyun@taobao.com August 13, 2010 1 History Tair is short for Taobao pair, which is a distributed data storage based on key/value data structure. Tair 1.0 is developed in August 2008 using Java, all the data are stored in MySQL and disaster tolerance is depended on MySQL too. Before Tair 1.0, there is a similar key/value storage in taobao, which is tdbm 1.0 developed by DUO Long for UIC project cache in Sep. 2007. Tdbm 1.0’s predecessor is tbstore. In March 2009, tdbm 2.0 is developed by DUO Long referring to Memcached’s memory implementation. Tdbm 2.0 improved distributed cluster. Use ratio and throughput of memory have been promoted greatly. Because, Tair and tdbm are similar, they should be combined into one pro- duction, including tari’s persistent storage and tdbm’s cache. Tair’s persistent engine is based file system. Tair client is developed using Java. Security strategy is more perfect using copy- synchronization strategy not depending on MySQL. 2 Architecture Architecture of Tair 2 is shown in Fig. 1. Architeture consists of three parts: tari client, config server, data server cluster. Config server maintains some gloable configuration. Tair client can fetch lookup table from config server for synchronization. Tair client can config two config server for mutual backup. According to config server, request from tair client can be routed to right server in data server cluster. 3 Key Technology 3.1 Group and Namespace Config server splits data server into several groups, one physical machine belongs to just one group. Namespace is designed to avoid key conflict between different application. Different data type in one application can have different namespace. If namespace is in common cluster, it must be applied for first. 1
  • 2. Figure 1: Architecture of Tair 2 3.2 Version Version for key is introduced to solve the problem of updating data cocurrently. Version is added 1 for every data update. If the version of data is not consistent with server when it be put from tair client to data server, the result is error of version. If version is 0 when putting data, it means update data in server with force, but version in data server will be added 1 all the same. 3.3 Expire Data in tair data server is not set expired by default. If data expire time is set when using put interface, data will be expired after the setting time. In the data server, data will not be deleted immediately when time is out. In this case, the server will not ensure data can be get. Because, when the memory of server is out, some data will be removed using LRU algorithm. 3.4 Invalid and Remove Invalid and remove interface are all for deleting data. But remove just delete data from one data cluster and invalid delete data from a couple of clusters. Cluster to be deleted is configed in invalid server by config server. Invalid interface requests is sent to invalid server, not cluster directly. 2
  • 3. Figure 2: Configuration of TairManager 3.5 Counter Counter can be implemented by incr and decr interface. Increment or decrement is atomic. Counter doesn’t have version concept. 3.6 Lookup Table Lookup table is routing table in fact. Traditionally, tair use key hash value mod the number of machines for routing. This method can be implemented easily, but if machines are added or cut down, tair routing rule can’t change quickly. In tair 2, method of modding is improved, using key hash value mod a constant value , not the number of machines. How to choose the value is a trick. If the value is too small then when the number of machines exceeds it, tair can’t map key to data server. Otherwise, if the value is too large, the lookup table will become large too in config server. So, suitable is best. In tair 2, 10243 is chosen. 4 Sample This article will use tstar as sample. Sample will use modelCache for short. The configuration of tair is done by spring IOC. The configuration of tairManager is shown in Fig. 2. In bean configuration, configServerList is the config server setting. In sample, there are two lists for mutual backup. GroupName decides data server is in which group. Timeout is default time for data expire. When tairManager is configed, developers can use it in concrete business such as modelCache shown in Fig. 3. Expire is the time for data in modelCache dying. Area is namespace for key kown from the same key in other application. In ModelCahe, developer can use all the interface of tair client for caching. It is so easy. 3
  • 4. Figure 3: Configuration of ModelCache 5 Conclusion Tair is a high performance and strong utility for key/value data distributed storage. It is convenient for engineers to use by simple interfaces. This article is a introduction to tair paying more attention to tair client, not include tair server implementation. Tair server is developed using C++. Tair is a very important distributed storage in taobao data platform. In the future, it will support simple structuring such as JSON, not java serialization when dealing with simple java object. It will also support SQL-like grammar for selecting. Let’s look forward to stronger tair. 4