Tachyon basic use 01 ----- tachyon Introduction

Source: Internet
Author: User
Tags spark rdd

I. Introduction to tachyon

650) This. width = 650; "Title =" 1.png" alt = "wKioL1Q82dKC2-wmAADWCxQE5bg841.jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/6A/wKioL1Q82dKC2-wmAADWCxQE5bg841.jpg"/>

Tachyon is a highly fault-tolerant distributed file system that allows reliable file sharing in the cluster framework at memory speed, just like spark and mapreduce. Tachyon achieves high performance through information inheritance and memory intrusion. Tachyon working set files are cached in the memory, and different jobs/queries and frameworks can access cached files at the memory speed ". Therefore, tachyon can reduce the number of times that datasets that need to be frequently used are accessed by accessing the disk.

650) This. width = 650; "Title =" 1.jpg" alt = "wkiol1q82ikrsntzaaeb4spz6mi593.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/6A/wKioL1Q82iKRSnTZAAEB4spz6mI593.jpg"/>

Ii. Architecture of tachyon

Tachyon organizes clusters in the common master/worker mode. The master node is responsible for managing and maintaining the file system metadata, and the file data is maintained in the memory of the worker node.

In terms of fault tolerance, the main technical points include:

  • The underlying file system that supports plugable, such as HDFS, is used for the persistence of specified files.

  • Use journal mechanism to persist the metadata of the file system

  • Use zookeeper to build master ha

  • Instead of using replica to copy memory data, we use lineage similar to spark RDD for disaster recovery.

     

Iii. Tachyon Process

1. initialize the File System

Create and clear the working directories required by the master/worker. For the master node, these directories include the data/worker/Journal directory on the underlying persistent file system, in fact, the worker directory is used by the worker node (used to store some zero-point persistent files and data blocks that lose meta information), but is created on the master node, essentially, it is to simplify the creation logic (because it is placed on HDFS and only created once). For the worker node, the required directory is the local ramdisk directory. In addition, in the Journal folder of the master, an empty file with a specific prefix is created to mark the formatting of the file system.

 

2. Start tachyon master

First of all, it is necessary to read the configuration parameters of the master. Currently, the-D parameters are passed to Java. Ideally, they are implemented through the configuration file. Currently, some of these parameters are used to set variables in the env file, and then through the-D parameter settings, some are directly written to the-D parameter, and some are not configured by default in the startup script, the default value is used in the masterconf code to determine whether the file system is formatted by reading a specific format file.

Rebuild the file system information in the memory. The file system information of tachyon is saved by journal logs. Journal consists of two parts: one is the snapshot image of meta information at a specific time point, and the other is the incremental log. When the tachyon master is started, it first reads the meta information of the file system from the snapshot image file, including various data nodes (File/directory/raw table/checkpoint/dependency, then, read the incremental operation records from continuing editlog (possibly multiple). The editlog content basically corresponds to some operations related to the tachyon File System Client, including file addition, deletion, and rename, add data blocks.

Note that the log records here do not include the actual file content data, but only meta information. Therefore, if the file content in the cache is lost, if it is not persistent, It is not bound to the related lineage information, then the specific content of the corresponding file will be lost. After the file system information is restored, tachyon master writes the current meta data into a new snapshot image before the service is officially started. When zookeepeer is enabled, the Standby master periodically merges editlog and creates a standby image. If the standby master does not exist, to the new image. Here, multiple masters concurrently operate on the editlog Of the image. There is no lock or mutex mechanism. I don't know if there will be any competition conflicts, data stale or loss issues.

 

3. File Storage

Tachyon files stored on ramdisk are divided by blocks (1 GB by default). The master node allocates a blockid for each block, the worker directly uses blockid as the actual file name to store the data of the corresponding block on ramdisk.

 

4. data read/write

As far as possible, tachyon can directly map files to the memory through the javanio API. As a data stream for read/write operations, the purpose is to avoid using a large amount of memory in Java heap, this reduces GC overhead and increases the response speed.

During the read/write process, all metadata-related information must be executed by calling the serverapi exposed by Thrift. The file read operation of tachyon supports both local and remote modes, the client API is transparent to users.

To read a file, the process is to first obtain the block ID corresponding to the offset position of the corresponding file from the master and then connect to the local worker to obtain the file name corresponding to the corresponding ID. If the file exists, the client code will notify worker to lock the corresponding block, and then the client code will directly map the relevant file as randomaccessfile to perform the read operation directly without reading the actual data through the worker proxy.

If there is no worker locally or the file does not exist on the local worker, the client code further obtains the worker corresponding to the relevant block through the master API, then, the dataserver interface exposed by worker is used to read the content of the corresponding block. Within the dataserver, the corresponding block is also locked, the process of the ing file is read, and data is returned to the client. In addition, the tachyonfile API is used when reading data. If the filestream API is used, when the remote worker does not have a corresponding file block, remoteblockinstream also tries to read data from the underlying persistent file system layer (if a corresponding file exists), while the readbytebuffer interface does not have a corresponding process.

Tachyon currently only supports local write operations. Write operations can be divided into cache (written to the tachyon memory file system) and through (written to the underlying persistent File System) based on the write location ). The specific type is the legal combination of the above situations, such as single cache, cache + through, etc. There is also an async mode: It is written asynchronously to the underlying persistent file system. This is probably to optimize the scenarios where data needs to be persisted, but there are requirements for such latency.

 


This article is from the "tachyon" blog, please be sure to keep this source http://ucloud.blog.51cto.com/3869454/1563944

Tachyon basic use 01 ----- tachyon Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.