

# Performance and optimization
<a name="Performance"></a>

This section describes guidance and best practices for optimizing File Gateway performance.

**Topics**
+ [Basic performance guidance for S3 File Gateway](#performance-fgw)
+ [Performance guidance for gateways with multiple file shares](#performance-multiple-file-shares)
+ [Maximizing S3 File Gateway throughput](Performance-Throughput.md)
+ [Optimizing S3 File Gateway for SQL Server database backups](SQL-Backup-Best-Practices.md)

## Basic performance guidance for S3 File Gateway
<a name="performance-fgw"></a>

In this section, you can find guidance for provisioning hardware for your S3 File Gateway VM. The instance configurations that are listed in the table are examples, and are provided for reference.

For best performance, the cache disk size must be tuned to the size of the active working set. Using multiple local disks for the cache increases write performance by parallelizing access to data and leads to higher IOPS.

**Note**  
We don't recommend using ephemeral storage. For information about using ephemeral storage, see [Using ephemeral storage with EC2 gateways](ephemeral-disk-cache.md).  
For Amazon EC2 instances, if you have more than 5 million objects in your S3 bucket and you are using a General Purposes SSD volume, a minimum root EBS volume of 350 GiB is needed for acceptable performance of your gateway during start up. For information about how to increase your volume size, see [Modifying an EBS volume using elastic volumes (console)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/requesting-ebs-volume-modifications.html#modify-ebs-volume).  
The suggested size limit for individual directories in the file shares that you connect to File Gateway is 10,000 files per directory. You can use File Gateway with directories that have more than 10,000 files, but performance might be impacted.

In the following tables, *cache hit* read operations are reads from the file shares that are served from cache. *Cache miss* read operations are reads from the file shares that are served from Amazon S3.

The following tables show example S3 File Gateway configurations.

### S3 File Gateway performance on Linux clients
<a name="performance-fgw-linux-clients"></a>



- ** Root disk: 80 GB, io1 SSD, 4,000 IOPS Cache disk: 512 GiB cache, io1, 1,500 provisioned IOPS Minimum network performance: 10 Gbps CPU: 16 vCPU \| RAM: 32 GB NFS protocol recommended for Linux **
  - **Protocol:** NFSv3 - 1 thread / **Write throughput (file sizes 1 GB):** 110 MiB/sec (0.92 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 310 MiB/sec (2.6 Gbps)
  - **Protocol:** NFSv3 - 8 threads / **Write throughput (file sizes 1 GB):** 160 MiB/sec (1.3 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 335 MiB/sec (2.8 Gbps)
  - **Protocol:** NFSv4 - 1 thread / **Write throughput (file sizes 1 GB):** 130 MiB/sec (1.1 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 295 MiB/sec (2.5 Gbps)
  - **Protocol:** NFSv4 - 8 threads / **Write throughput (file sizes 1 GB):** 160 MiB/sec (1.3 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 335 MiB/sec (2.8 Gbps)
  - **Protocol:** SMBV3 - 1 thread / **Write throughput (file sizes 1 GB):** 115 MiB/sec (1.0 Gbps) / **Cache hit read throughput:** 325 MiB/sec (2.7 Gbps) / **Cache miss read throughput:** 255 MiB/sec (2.1 Gbps)
  - **Protocol:** SMBV3 - 8 threads / **Write throughput (file sizes 1 GB):** 190 MiB/sec (1.6 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 335 MiB/sec (2.8 Gbps)

- ** Storage Gateway Hardware Appliance Minimum network performance: 10 Gbps **
  - **Protocol:** NFSv3 - 1 thread / **Write throughput (file sizes 1 GB):** 265 MiB/sec (2.2 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 310 MiB/sec (2.6 Gbps)
  - **Protocol:** NFSv3 - 8 threads / **Write throughput (file sizes 1 GB):** 385 MiB/sec (3.1 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 335 MiB/sec (2.8 Gbps)
  - **Protocol:** NFSv4 - 1 thread / **Write throughput (file sizes 1 GB):** 310 MiB/sec (2.6 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 295 MiB/sec (2.5 Gbps)
  - **Protocol:** NFSv4 - 8 threads / **Write throughput (file sizes 1 GB):** 385 MiB/sec (3.1 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 335 MiB/sec (2.8 Gbps)
  - **Protocol:** SMBV3 - 1 thread / **Write throughput (file sizes 1 GB):** 275 MiB/sec (2.4 Gbps) / **Cache hit read throughput:** 325 MiB/sec (2.7 Gbps) / **Cache miss read throughput:** 255 MiB/sec (2.1 Gbps)
  - **Protocol:** SMBV3 - 8 threads / **Write throughput (file sizes 1 GB):** 455 MiB/sec (3.8 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 335 MiB/sec (2.8 Gbps)

- ** Root disk: 80 GB, io1 SSD, 4,000 IOPS Cache disk: 4 x 2 TB NVME cache disks Minimum network performance: 10 Gbps CPU: 32 vCPU \| RAM: 244 GB NFS protocol recommended for Linux **
  - **Protocol:** NFSv3 - 1 thread / **Write throughput (file sizes 1 GB):** 300 MiB/sec (2.5 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 325 MiB/sec (2.7 Gbps)
  - **Protocol:** NFSv3 - 8 threads / **Write throughput (file sizes 1 GB):** 585 MiB/sec (4.9 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 580 MiB/sec (4.8 Gbps)
  - **Protocol:** NFSv4 - 1 thread / **Write throughput (file sizes 1 GB):** 355 MiB/sec (3.0 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 340 MiB/sec (2.9 Gbps)
  - **Protocol:** NFSv4 - 8 threads / **Write throughput (file sizes 1 GB):** 575 MiB/sec (4.8 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 575 MiB/sec (4.8 Gbps)
  - **Protocol:** SMBV3 - 1 thread / **Write throughput (file sizes 1 GB):** 230 MiB/sec (1.9 Gbps) / **Cache hit read throughput:** 325 MiB/sec (2.7 Gbps) / **Cache miss read throughput:** 245 MiB/sec (2.0 Gbps)
  - **Protocol:** SMBV3 - 8 threads / **Write throughput (file sizes 1 GB):** 585 MiB/sec (4.9 Gbps) / **Cache hit read throughput:** 590 MiB/sec (4.9 Gbps) / **Cache miss read throughput:** 580 MiB/sec (4.8 Gbps)



### File Gateway performance on Windows clients
<a name="performance-fgw-windows-clients"></a>



- ** Root disk: 80 GB, io1 SSD, 4,000 IOPS Cache disk: 512 GiB cache, io1, 1,500 provisioned IOPS Minimum network performance: 10 Gbps CPU: 16 vCPU \| RAM: 32 GB SMB protocol recommended for Windows **
  - **Protocol:** SMBV3 - 1 thread / **Write throughput (file sizes 1 GB):** 150 MiB/sec (1.3 Gbps) / **Cache hit read throughput:** 180 MiB/sec (1.5 Gbps) / **Cache miss read throughput:** 20 MiB/sec (0.2 Gbps)
  - **Protocol:** SMBV3 - 8 threads / **Write throughput (file sizes 1 GB):** 190 MiB/sec (1.6 Gbps) / **Cache hit read throughput:** 335 MiB/sec (2.8 Gbps) / **Cache miss read throughput:** 195 MiB/sec (1.6 Gbps)
  - **Protocol:** NFSv3 - 1 thread / **Write throughput (file sizes 1 GB):** 95 MiB/sec (0.8 Gbps) / **Cache hit read throughput:** 130 MiB/sec (1.1 Gbps) / **Cache miss read throughput:** 20 MiB/sec (0.2 Gbps)
  - **Protocol:** NFSv3 - 8 threads / **Write throughput (file sizes 1 GB):** 190 MiB/sec (1.6 Gbps) / **Cache hit read throughput:** 330 MiB/sec (2.8 Gbps) / **Cache miss read throughput:** 190 MiB/sec (1.6 Gbps)

- ** Storage Gateway Hardware Appliance Minimum network performance: 10 Gbps **
  - **Protocol:** SMBV3 - 1 thread  / **Write throughput (file sizes 1 GB):** 230 MiB/sec (1.9 Gbps) / **Cache hit read throughput:** 255 MiB/sec (2.1 Gbps) / **Cache miss read throughput:** 20 MiB/sec (0.2 Gbps)
  - **Protocol:** SMBV3 - 8 threads / **Write throughput (file sizes 1 GB):** 835 MiB/sec (7.0 Gbps) / **Cache hit read throughput:** 475 MiB/sec (4.0 Gbps) / **Cache miss read throughput:** 195 MiB/sec (1.6 Gbps)
  - **Protocol:** NFSv3 - 1 thread / **Write throughput (file sizes 1 GB):** 135 MiB/sec (1.1 Gbps) / **Cache hit read throughput:** 185 MiB/sec (1.6 Gbps) / **Cache miss read throughput:** 20 MiB/sec (0.2 Gbps)
  - **Protocol:** NFSv3 - 8 threads / **Write throughput (file sizes 1 GB):** 545 MiB/sec (4.6 Gbps) / **Cache hit read throughput:** 470 MiB/sec (4.0 Gbps) / **Cache miss read throughput:** 190 MiB/sec (1.6 Gbps)

- ** Root disk: 80 GB, io1 SSD, 4,000 IOPS Cache disk: 4 x 2 TB NVME cache disks Minimum network performance: 10 Gbps CPU: 32 vCPU \| RAM: 244 GB SMB protocol recommended for Windows **
  - **Protocol:** SMBV3 - 1 thread / **Write throughput (file sizes 1 GB):** 230 MiB/sec (1.9 Gbps) / **Cache hit read throughput:** 265 MiB/sec (2.2 Gbps) / **Cache miss read throughput:** 30 MiB/sec (0.3 Gbps)
  - **Protocol:** SMBV3 - 8 threads / **Write throughput (file sizes 1 GB):** 835 MiB/sec (7.0 Gbps) / **Cache hit read throughput:** 780 MiB/sec (6.5 Gbps) / **Cache miss read throughput:** 250 MiB/sec (2.1 Gbps)
  - **Protocol:** NFSv3 - 1 thread / **Write throughput (file sizes 1 GB):** 135 MiB/sec (1.1. Gbps) / **Cache hit read throughput:** 220 MiB/sec (1.8 Gbps) / **Cache miss read throughput:** 30 MiB/sec (0.3 Gbps)
  - **Protocol:** NFSv3 - 8 threads / **Write throughput (file sizes 1 GB):** 545 MiB/sec (4.6 Gbps) / **Cache hit read throughput:** 570 MiB/sec (4.8 Gbps) / **Cache miss read throughput:** 240 MiB/sec (2.0 Gbps)



**Note**  
Your performance might vary based on your host platform configuration and network bandwidth. Write throughput performance decreases with file size, with the highest achievable throughput for small files (less than 32MiB) being 16 files per second.

## Performance guidance for gateways with multiple file shares
<a name="performance-multiple-file-shares"></a>

Amazon S3 File Gateway supports attaching up to 50 file shares to a single Storage Gateway appliance. By adding multiple file shares per gateway, you can support more users and workloads while managing fewer gateways and virtual hardware resources. In addition to other factors, the number of file shares managed by a gateway can affect that gateway's performance. This section describes how gateway performance is expected to change depending on the number of attached file shares and recommends virtual hardware configurations to optimize performance for gateways that manage multiple shares.

In general, increasing the number of file shares managed by a single Storage Gateway can have the following consequences:
+ Increased time required to restart the gateway.
+ Increased utilization of virtual hardware resources such as vCPU and RAM.
+ Decreased performance for data and metadata operations if virtual hardware resources become saturated.

The following table lists recommended virtual hardware configurations for gateways that manage multiple file shares:


| File Shares Per Gateway | Recommended Gateway Capacity Setting | Recommended vCPU Cores | Recommended RAM | Recommended Root Disk Size | 
| --- | --- | --- | --- | --- | 
| 1-10 | Small | 4 (EC2 instance type **m4.xlarge** or greater) | 16 GiB | 80 GiB | 
| 10-20 | Medium | 8 (EC2 instance type **m4.2xlarge** or greater) | 32 GiB | 160 GiB | 
| 20\+ | Large | 16 (EC2 instance type **m4.4xlarge** or greater) | 64 GiB | 240 GiB | 

In addition to the virtual hardware configurations recommended above, we recommend the following best practices for configuring and maintaining Storage Gateway appliances that manage multiple file shares:
+ Consider that the relationship between the number of file shares and the demand placed on the gateway's virtual hardware is not necessarily linear. Some file shares might generate more throughput, and therefore more hardware demand than others. The recommendations in the preceding table are based on maximum hardware capacities and various file share throughput levels.
+ If you find that adding multiple file shares to a single gateway reduces performance, consider moving the most active file shares to other gateways. In particular, if a file share is used for a very-high-throughput application, consider creating a separate gateway for that file share.
+ We do not recommend configuring one gateway for multiple high-throughput applications and another for multiple low-throughput applications. Instead, try to spread high and low throughput file shares evenly across gateways to balance hardware saturation. To measure your file share throughput, use the `ReadBytes` and `WriteBytes` metrics. For more information, see [Understanding file share metrics](https://docs.aws.amazon.com/filegateway/latest/files3/monitoring-file-gateway.html#monitoring-file-gateway-resources).