Metadata Service Models for Distributed File Systems
2012-08-14 00:00:00
With the explosion of unstructured data, distributed file systems have entered a golden age of development. From high-performance computing to data centers, from data sharing to Internet applications, they have penetrated every aspect of data applications. For most distributed file systems (or cluster file systems, or parallel file systems), metadata and data are typically kept independent of each other, that is, the control flow and the data flow are separated, thereby achieving higher system scalability and I/O concurrency. Consequently, the metadata management model is critically important, directly affecting the system's scalability, performance, reliability, and stability. For a storage system to have strong Scale-Out characteristics, one of the biggest challenges is recording the mapping between the logical and physical locations of data, i.e., data metadata, along with information such as attributes and access permissions. Especially for applications with massive numbers of small files, metadata is a very big challenge. Generally speaking, the metadata management approaches of distributed file systems can be roughly divided into three models: the centralized metadata service model, the distributed metadata service model, and the metadata-free service model. In academia and industry, these three models have long been debated, each with its own advantages and shortcomings, and in actual system implementations it is hard to say which is superior. In fact, the idea of designing a universal distributed file system that fits all data application workloads is unrealistic in the first place. In this sense, each of the three metadata service models has its own reason to exist, at least within the data storage application domains it is suited for.

Centralized Metadata Service Model
In a distributed file system, data and I/O access loads are spread across multiple physically independent storage and compute nodes, achieving high system scalability and high performance. For a set of files, if scheduling is done on a per-file basis, different files are stored on different nodes; or if data is stored in a Stripe manner, a single file is split into multiple parts and placed on multiple nodes. Clearly, a key problem we face is how to ensure correct data location and access, and the metadata service exists precisely to solve this problem. The metadata service records the mapping between the logical names of data and their physical information, containing all the metadata needed for file access control. When accessing a file, the client first queries the metadata service for the corresponding metadata, then performs subsequent file read/write I/O operations using the obtained metadata.
For simplicity of system design, and due to a large number of legacy systems and other reasons, most distributed file systems adopt a centralized metadata service, such as Lustre, PVFS, StorNext, and GFS. The centralized metadata service model usually provides a central metadata server responsible for metadata storage and serving client query requests; it provides a unified file system namespace and handles name resolution, data location, and other access control functions. In traditional NAS systems, the I/O data flow must pass through the server, whereas in distributed file systems the I/O data flow does not need to pass through the metadata server; the client interacts directly with storage nodes. This architectural change separates the control flow from the data flow, letting the metadata server and storage servers each perform their own duties, and system scalability and performance are greatly improved. Obviously, the biggest advantage of the centralized metadata service model is simplicity of design and implementation; it is essentially like designing a stand-alone application that provides external network access interfaces such as Socket, RPC, HTTP REST, or SOAP. The key to metadata service design is OPS throughput, i.e., the number of operations processed per unit of time, which is especially critical for the centralized metadata service model, because it is constrained by the system's Scale-Up limits. To optimize OPS, this model places high demands on CPU, memory, and disks; where conditions allow, use high-performance CPUs, large memory, and high-speed disks as much as possible, and the back-end storage may even consider high-end disk arrays or SSDs. In software architecture design, implementation mechanisms such as multi-process/thread (pooling), asynchronous communication, cache, and event-driven design should be considered. As for the design and implementation of the distributed file system namespace, refer to the article "Research on Namespace Implementation in Distributed File Systems"; it will not be discussed here. In practice, the drawbacks of the centralized metadata service model are equally prominent, and the two most critical ones are the performance bottleneck and the single point of failure.
Performance bottleneck: under this model, as the load keeps growing, the metadata server will quickly become the performance bottleneck of the entire system. According to Amdahl's Law, the achievable speedup of a system is ultimately limited by the proportion of the serial part, which determines the potential for improving performance through parallelism. Here, the metadata server is the serial part, and it directly determines the scalability and performance of the system. The basic nature of file metadata requires it to be maintained and updated synchronously; whenever file data or metadata is operated on, the metadata must be updated synchronously. For example, a file's access time must be updated even for read operations or directory listings. When a client accesses the distributed file system, it must first interact with the metadata server, including namespace resolution, data location, access control, and so on, before interacting directly with storage nodes for I/O. As the system scale keeps expanding, the number of storage nodes, disks, files, clients, and file operations will all increase sharply, while the physical server running the metadata server has limited performance after all, so the centralized metadata server will eventually become the performance bottleneck. For the well-known LOSF (Lots of Small Files) applications, where the number of files is huge and the files are very small, usually a few KB to tens of KB, such as CDN and life-science DNA data applications, the performance bottleneck problem of the centralized metadata service model is even more severe. LOSF applications consist mainly of massive metadata operations; once the metadata server develops performance problems, it directly leads to extremely low OPS and I/O throughput. At present, distributed file systems implemented with this model, such as Lustre, PVFS, and GFS, are not suitable for LOSF applications.
In practice, the performance bottleneck problem is not as serious as imagined. Lustre, StorNext, GFS and the like deliver extremely high performance in large-file applications, and StorNext even performs well with small files. On the one hand, LOSF applications should be avoided in the first place, unless performance requirements are extremely low. On the other hand, for large-file applications, which place more emphasis on I/O data throughput, the proportion of metadata operations is very small. When files are large, the amount of metadata will drop significantly, and the system spends more of its time on data transfer, so the pressure on the metadata server falls substantially. In this scenario, the performance bottleneck problem essentially does not exist. Furthermore, if a performance bottleneck problem does occur, the metadata server can be performance-optimized within the maximum load the system can carry. The most direct optimization method is upgrading hardware, such as CPU, memory, storage, and network; Moore's Law is still effective today. System-level optimizations are usually effective as well, including OS trimming and parameter tuning, and there is a lot of room for improvement in this respect. The most critical optimization is in the design of the metadata server itself, which can help users save costs and simplify maintenance and management; optimization methods mainly include data locality, cache, and asynchronous I/O, aiming to improve concurrency, reduce disk I/O accesses, and shorten request processing time. Therefore, for a great many data applications, the performance of a centralized metadata server is not a big problem, or can be resolved through performance optimization.
Single point of failure (SPOF, Single Point of Failure): this problem looks even more serious than the performance bottleneck. The entire system depends heavily on the metadata server; once a problem occurs there, the system becomes completely unavailable, directly interrupting applications and affecting business continuity. The network, compute, and storage components of the physical server, as well as software, can all fail, so the single point of failure problem is always latent; better hardware and software can only reduce the probability of occurrence, not avoid it entirely. At present, the SPOF problem is mainly addressed with HA mechanisms: depending on the level of availability required, one or more metadata servers (logical or physical) are mirrored to form a metadata service HA cluster. One machine in the cluster serves as the primary metadata server, receiving and processing requests from clients and staying in sync with the other servers. When the primary metadata server fails, an available server is automatically selected as the new primary server; this process is transparent to upper-layer applications and causes no business interruption. The HA mechanism can solve the SPOF problem, but at the same time it increases cost: only the primary server is active while the other servers are all inactive, providing no help whatsoever for performance improvement.
Distributed Metadata Service Model
Naturally, some proposed the distributed metadata service model, which, as the name suggests, uses a cluster of multiple servers working together to provide metadata services for the distributed file system, thereby eliminating the performance bottleneck and single point of failure of the centralized metadata service model. This model can be subdivided into two types. One is the fully peer-to-peer mode, in which every metadata server in the cluster is completely equal and each can independently provide metadata services externally, with metadata synchronized within the cluster to keep data consistent, such as ISILON, LoongStore, and CZSS. The other is the fully distributed mode, in which each metadata server in the cluster is responsible for part of the metadata service (partitions may overlap), and together they constitute the complete metadata service, such as PanFS, GPFS, and Ceph. The distributed metadata service model spreads the load across multiple servers, solving the performance bottleneck problem, and uses peer servers or redundant metadata service partitions to solve the single point of failure problem. The distributed approach looks nearly perfect; however, it greatly increases design and implementation complexity, and at the same time may introduce new problems, namely performance overhead and data consistency.
Performance overhead: distributed systems usually introduce extra overhead due to data synchronization between nodes, because the synchronization process requires various locks and synchronization mechanisms to guarantee data consistency. If node synchronization is not handled properly, the performance overhead will have a significant impact on system scalability and performance, forming a performance bottleneck just like the centralized metadata model, which places higher demands on the design of distributed metadata servers. This performance overhead will offset part of the performance gains brought by adopting a distributed architecture, and it intensifies as the number of metadata servers, the number of files, file operations, storage system scale, the number of disks, decreasing file sizes, and the randomness of I/O operations increase. In addition, when the metadata server cluster is large, highly concurrent metadata access makes synchronization performance overhead even more pronounced. At present, some distributed file systems use high-performance networks (such as InfiniBand, GigE, etc.), SSD solid-state drives or SAN disk arrays, and distributed shared memory (SMP or ccNUMA) and other technologies for intra-cluster metadata synchronization and communication. This can indeed noticeably improve system performance to offset the synchronization overhead, but costs also increase considerably.
Data consistency: this is a difficult problem every distributed system must face. The distributed metadata service model likewise faces the risk of potential system errors; although the failure of some metadata nodes will not bring down the entire system, it may affect the normal operation of the whole system or cause access errors. To guarantee high availability, metadata is replicated to multiple node locations, and maintaining synchronization among multiple replicas is highly risky. If metadata is not synchronized in time or is accidentally corrupted, the metadata of the same file will become inconsistent, leading to inconsistent access to the file's data and directly affecting the correctness of upper-layer data applications. The probability of this risk increases substantially as the system scale expands, so synchronization and concurrent access of distributed metadata is a huge challenge. Synchronizing metadata with synchronous methods, combined with transactions or logs, can naturally solve the data consistency problem; however, this greatly reduces system concurrency, violating the original design intent of distributed systems. Maximizing concurrency while ensuring metadata consistency places strict requirements on the design of synchronization mechanisms and algorithms; the complexity and challenge are self-evident.
Metadata-Free Service Model
Since neither the centralized nor the distributed metadata service model can completely solve the problem, can these issues be avoided simply by removing the metadata server altogether? In theory, the metadata-free service model is entirely feasible; one only needs to find an alternative method for metadata query and location. Ideally, this model eliminates a whole series of metadata-related problems such as performance bottlenecks, single points of failure, and data consistency, significantly improving system scalability, with system concurrency and performance achieving linear scaling growth. At present, distributed file systems based on the metadata-free service model are few and far between, and GlusterFS is the most typical representative among them.
For distributed systems, metadata handling is the key factor determining system scalability, performance, and stability. GlusterFS takes a different path, completely abandoning metadata services and using elastic hashing in place of the centralized or distributed metadata services found in traditional distributed file systems. This fundamentally solves the metadata problem, achieving near-linear high scalability while also improving system performance and reliability. GlusterFS uses an algorithm for data location: any server or client in the cluster can locate data and perform read/write access based only on the path and file name. In other words, GlusterFS does not need to separate metadata from data, because file location can be independently parallelized. GlusterFS uniquely adopts a metadata-free design, using algorithms to locate files instead; metadata and data are not separated but stored together. All storage system servers in the cluster can intelligently locate file data fragments, relying only on the file name and path and applying the algorithm, without querying an index or other servers. This makes data access fully parallelized, thereby achieving true linear performance scaling. The metadata-free design greatly improves GlusterFS's performance, reliability, and stability. (For an in-depth analysis of GlusterFS, refer to the article "Research on the GlusterFS Cluster File System".)
The benefit of the metadata-free server design is that there is no single point of failure and no performance bottleneck problem, improving system scalability, performance, reliability, and stability. For massive-small-file applications, this design can effectively solve the difficult metadata problems. Its negative effects are that data consistency becomes more complicated, file and directory traversal operations are inefficient, and global monitoring and management functions are lacking. It also means the client takes on more responsibilities, such as file location, namespace caching, and logical volume view maintenance, all of which increase the client's load and consume considerable CPU and memory.
Comparison of the Three Metadata Service Models
For Scale-Out storage systems, one of the biggest challenges is recording the mapping between the logical and physical locations of data, i.e., data metadata. Traditional distributed storage systems use centralized or distributed metadata services to maintain metadata; centralized metadata services lead to single point of failure and performance bottleneck problems, while distributed metadata services suffer from performance overhead, metadata synchronization consistency, and design complexity issues. The metadata-free service model eliminates metadata access problems, but at the same time increases the complexity of managing the data itself, lacks global monitoring and management functions, and adds to the client's load. It is clear that none of the three models is perfect; each has its own advantages and disadvantages, with no absolute superiority or inferiority. Actual selection should choose the appropriate model according to specific circumstances and try every means to remedy its shortcomings, thereby improving the distributed file system's scalability, high performance, availability, and other characteristics. Representatives of the centralized metadata service model include Lustre, StorNext, GFS, and so on; typical cases of the distributed metadata service model include ISILON, GPFS, Ceph, and so on; and GlusterFS is the classic of the metadata-free service model. All of these are very powerful distributed file systems and excellent design exemplars. This is also enough to show that while architecture is crucial, it is often the specific implementation technology that determines the final outcome.
Further Reading
[1] Ceph, http://www.ibm.com/developerworks/cn/linux/l-ceph/index.html?ca=drs-
[2] Glusterfs, http://blog.csdn.net/liuben/article/details/6284551
[3] Clustered NAS technical architecture, http://blog.csdn.net/liuben/article/details/6422700