CDP:NFS Replica Pattern
Replicating Shared Content
Problem to Be Solved
When files are shared by multiple servers using NFS, the loss in performance due to the NFS part will become significant when the number of servers sharing the files increases and the access frequency gets high.
Explanation of the Cloud Solution/Pattern
This pattern allows you to improve the referencing performance, in particular, in response to a drop in performance of a network file system (NFS) that stores shared files. Prepare virtual disks individually on each server and copy the shared files of the NFS server.This lets you use the virtual disk as a reference-only replica of the NFS for each server.
Copy the files of the NFS server to the Elastic Block Store (EBS) that is the virtual disk for each individual EC2 instance.You can read in the EBS files for each individual EC2 instance, enabling higher performance than when accessing the NFS server.
- Structure the NFS server on an EC2 instance, and place the shared files there.
- Start up an EC2 instance (a web server) in Auto Scaling first. When it has been started up, mount the NFS server, and then copy the content of the NFS server to the EBS.
- Set up the applications on each of the EC2 instances to have the EBS as the destination for referencing.
- When a shared file on the NFS server is updated, that file is used by the EC2 instances started up thereafter.
- There is no need to access the NFS server, so performance is unlikely to become an issue, because the shared files exist on the EBS for the individual EC2 instances.
- Even if, for example, the NFS server goes down, the content is stored on each individual EBS, so the NFS server does not become an SPOF.
- When updating shared files, updating the files on the NFS server alone does not reflect them to the individual EC2 instances. You must perform synchronization using rsync, or the like.
- You can improve performance and reduce costs through using a local disk of an EC2 instance, known as Instance Storage (an ephemeral disk), instead of using EBS as a local disk.