

# Feature Store storage configurations
<a name="feature-store-storage-configurations"></a>

Amazon SageMaker Feature Store consists of an online store and an offline store. The online store enables real-time lookup of features for inference, while the offline store contains historical data for model training and batch inference. When creating a feature group, you have the option of enabling either the online store, offline store, or both. When you enable both, they sync to avoid discrepancies between training and serving data. For more information about the online and offline stores and other Feature Store concepts, see [Feature Store concepts](feature-store-concepts.md).

The following topics discuss online store storage types and offline store table formats. 

**Topics**
+ [Online store](feature-store-storage-configurations-online-store.md)
+ [Offline store](feature-store-storage-configurations-offline-store.md)
+ [Throughput modes](feature-store-throughput-mode.md)

# Online store
<a name="feature-store-storage-configurations-online-store"></a>

The online store is a low-latency, high-availability data store that provides real-time lookup of features. It is typically used for machine learning (ML) model serving. You can chose between the standard online store (`Standard`) or an in-memory tier online store (`InMemory`), at the point when you create a feature group. In this way, you can select the storage type that best matches the read and write patterns for a particular application, while considering performance and cost. For more details about pricing, see [Amazon SageMaker Pricing](https://aws.amazon.com/sagemaker/pricing/).

The online store contains the following `StorageType` options. For more information about the online store contents, see [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OnlineStoreConfig.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OnlineStoreConfig.html). 

## Standard tier storage type
<a name="feature-store-storage-configurations-online-store-standard-tier"></a>

The `Standard` tier is a managed low-latency data store for online store feature groups. It provides fast data retrieval for ML model service for your applications. `Standard` is the default storage type.

## In-memory tier storage type
<a name="feature-store-storage-configurations-online-store-in-memory-tier"></a>

The `InMemory` tier is a managed data store for online store feature groups that supports very low-latency retrieval. It provides large-scale real-time data retrieval for ML model serving used for high throughput applications. The `InMemory` tier is powered by Amazon ElastiCache (Redis OSS). For more information, see [What is Amazon ElastiCache (Redis OSS)?](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/WhatIs.html).

The online store `InMemory` tier supports collection types, namely list, set, and vector. For more information about the `InMemory` collection types, see [Collection types](feature-store-collection-types.md).

Feature Store provides low latency read and writes to the online store. The application latency is primarily made up of two primary components: infrastructure or network latency and Feature Store API latency. Reduction of network latency helps with getting the lowest latency reads and writes to Feature Store. You can reduce the network latency to Feature Store by deploying AWS PrivateLink to Feature Store Runtime endpoint. With AWS PrivateLink, you can privately access all Feature Store Runtime API operations from your Amazon Virtual Private Cloud (VPC) in a scalable manner by using interface VPC endpoints. An AWS PrivateLink deployment with the `privateDNSEnabled` option set as true:
+ It keeps all Feature Store read/write traffic within your VPC.
+ It keeps traffic in the same AZ as the client that originated it when using Feature Store. This avoids the “hops” between AZs reducing the network latency.

Follow the steps in [Access an AWS service using an interface VPC endpoint](https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html) to setup AWS PrivateLink to Feature Store. The service name for Feature Store Runtime in AWS PrivateLink is `com.amazonaws.region.sagemaker.featurestore-runtime`.

The `InMemory` tier online store scales automatically based about storage usage and requests. The automated scaling can take a few minutes to adapt to a new usage pattern if it changes rapidly. During automated scaling:
+ Write operations to the feature group may receive throttling errors. You should retry your requests a few minutes later.
+ Read operations to the feature group may receive throttling errors. Standard retry strategies are suitable in this case.
+ Read operations may see elevated latency.

The default `InMemory` tier feature group maximum size is 50 GiB.

Note that the `InMemory` tier currently supports online feature groups only, not online\$1offline feature groups, so there is not replication between online and offline stores for the `InMemory` tier. Also, the `InMemory` tier does not currently support customer managed KMS keys.

# Offline store
<a name="feature-store-storage-configurations-offline-store"></a>

The offline store is used for historical data when sub-second retrieval is not needed. It is typically used for data exploration, model training, and batch inference. 

When you enable both the online and offline stores for your feature group, both stores sync to avoid discrepancies between training and serving data. Please note that an online store feature group with the `InMemory` storage type enabled does not currently support a corresponding feature group in the offline store (no online to offline replication). For more information about ML model serving in Amazon SageMaker Feature Store, see [Online store](feature-store-storage-configurations-online-store.md).

The offline store contains the following `TableFormat` options. For information about the offline store contents, see [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OfflineStoreConfig.html](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OfflineStoreConfig.html) in the Amazon SageMaker API Reference.

## Glue table format
<a name="feature-store-storage-configurations-offline-store-glue-table-format"></a>

The `Glue` format (default) is a standard Hive type table format for AWS Glue. With AWS Glue, you can discover, prepare, move, and integrate data from multiple sources. It also includes additional productivity and data ops tooling for authoring, running jobs, and implementing business workflows. For more information about AWS Glue, see [What is AWS Glue?](https://docs.aws.amazon.com/glue/latest/dg/what-is-glue.html).

## Iceberg table format
<a name="feature-store-storage-configurations-offline-store-iceberg-table-format"></a>

The `Iceberg` format (recommended) is an open table format for very large analytic tables. With `Iceberg`, you can compact the small data files into fewer large files in the partition, resulting in significantly faster queries. This compaction operation is concurrent and does not affect ongoing read and write operations on the feature group. For more information about optimizing Iceberg tables, see the [Amazon Athena](https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg-data-optimization.html) and [AWS Lake Formation](https://docs.aws.amazon.com/lake-formation/latest/dg/data-compaction.html) user guides.

`Iceberg` manages large collections of files as tables and supports modern analytical data lake operations. If you choose the `Iceberg` option when creating new feature groups, Amazon SageMaker Feature Store creates the `Iceberg` tables using Parquet file format, and registers the tables with the AWS Glue Data Catalog. For more information about `Iceberg` table formats, see [Using Apache Iceberg tables](https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg.html). 

**Important**  
Note that for feature groups in `Iceberg` table format, you must specify `String` as the feature type for the event time. If you specify any other type, you can't create the feature group successfully.

# Throughput modes
<a name="feature-store-throughput-mode"></a>

Amazon SageMaker Feature Store provides two pricing models to choose from: on-demand (`On-demand`) and provisioned (`Provisioned`) throughput modes. `On-demand` works best for less predictable traffic, while `Provisioned` works best for consistent and predictable traffic. 

You have the option to switch between `On-demand` and `Provisioned` throughput modes for a given feature group, to accommodate periods in which application traffic patterns are changing or less predictable. You can only update your feature group throughput mode to `On-demand` once in a 24 hour period. The throughput mode can be updated programmatically using the [UpdateFeatureGroup](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateFeatureGroup.html) API or through the console UI. For more information about using the console, see [Using Amazon SageMaker Feature Store in the console](feature-store-use-with-studio.md).

You can use the `Provisioned` throughput mode with offline-only feature groups or feature groups with the `Standard` storage type. For other storage configurations, the `On-demand` throughput mode is used. For information about the online and offline storage configurations, see [Online store](feature-store-storage-configurations-online-store.md) and [Offline store](feature-store-storage-configurations-offline-store.md), respectively.

For more details about pricing, see [Amazon SageMaker Pricing](https://aws.amazon.com/sagemaker/pricing/).

**Topics**
+ [On-demand throughput mode](#feature-store-throughput-mode-on-demand)
+ [Provisioned throughput mode](#feature-store-throughput-mode-provisioned)
+ [Throughput mode metrics](#feature-store-throughput-mode-metrics)
+ [Throughput mode limits](#feature-store-throughput-mode-limits)

## On-demand throughput mode
<a name="feature-store-throughput-mode-on-demand"></a>

The `On-demand` (default) throughput mode works best when you are using feature groups with unknown workload, unpredictable application traffic, and you cannot forecast the capacity requirements.

The `On-demand` mode charges you for the reads and writes that your application performs on your feature groups. You do not need to specify how much read and write throughput you expect your application to perform because Feature Store instantly accommodates your workloads as they ramp up or down. You pay only for what you use, which is measured in `ReadRequestsUnits` and `WriteRequestsUnits`.

You can enable the `On-demand` throughput mode using the [CreateFeatureGroup](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateFeatureGroup.html) or [UpdateFeatureGroup](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateFeatureGroup.html) APIs or through the console UI. For more information about using the console UI, see [Using Amazon SageMaker Feature Store in the console](feature-store-use-with-studio.md).

**Important**  
You can only update your feature group throughput mode to `On-demand` once in a 24 hour period.

## Provisioned throughput mode
<a name="feature-store-throughput-mode-provisioned"></a>

The `Provisioned` throughput mode works best when you are using feature groups with predictable workloads and you can forecast the capacity requirements to control costs. This can make it more cost effective for certain workloads where you can anticipate throughput requirements in advance.

When you set a feature group to `Provisioned` mode, you specify capacity units which are the maximum amount of capacity that an application can consume from a feature group. If your application exceeds this `Provisioned` throughput capacity, it is subject to request throttling.

The following includes information about the read and write capacity units. 
+ Retrieving a single record of up to 4 KB using the `GetRecord` API will consume *at least* 1 RCU (read capacity unit). Retrieving larger payloads may take more. The total number of read capacity units required depends on the item size, including a small per record metadata added by the Feature Store service. 
+ A single write request with a payload of 1 KB using the `PutRecord` API will consume *at least* 1 WCU (write capacity unit), with fractional payloads rounded up to nearest KB. It may consume more depending on the event time, deletion status of the record, and time to live (TTL) status. For more information about TTL, see [Time to live (TTL) duration for records](feature-store-time-to-live.md).

**Important**  
When setting your capacity units please consider the following:  
You will be charged for the read and write capacities you provision for your feature group, even if you do not fully utilize the `Provisioned` capacity.
If you set a read or write capacity too low, your requests may experience throttling.
In some cases, records may consume an extra capacity unit due to record level metadata that is added by the Feature Store service to enable various features. 
Retrieving only a subset of features using `GetRecord` or `BatchGetRecord` APIs will still consume RCU corresponding to the entire record. 
For write capacity, you should provision 2x the recent peak capacity to avoid throttling when performing backfills or bulk ingestion that may result in a large number of historical record writes. This is because writing historical records consumes additional write capacity.
Feature Store does not currently support auto scaling for `Provisioned` mode. 

You can enable the `On-demand` throughput mode using the [CreateFeatureGroup](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateFeatureGroup.html) or [UpdateFeatureGroup](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateFeatureGroup.html) APIs or through the console UI. For more information about using the console UI, see [Using Amazon SageMaker Feature Store in the console](feature-store-use-with-studio.md).

The following describes how you can increase or decrease the RCU and WCU throughput for your feature groups when `Provisioned` mode is enabled. 

**Increasing provisioned throughput**

You can increase RCU or WCU as often as needed using the [UpdateFeatureGroup](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateFeatureGroup.html) API or the console UI. 

**Decreasing provisioned throughput**

You can decrease RCU and WCU (or both) for feature groups using [UpdateFeatureGroup](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateFeatureGroup.html) API or the console UI. 

There is a default quota on the number of `Provisioned` capacity decreases you can perform on your feature group per day. A day is defined according to Universal Time Coordinated (UTC). On a given day, you can start by performing up to four decreases within one hour as long as you have not performed any other decreases yet during that day. Subsequently, you can perform one additional decrease per hour as long as there were no decreases in the preceding hour. This effectively brings the maximum number of decreases in a day to 27 times (4 decreases in the first hour, and 1 decrease for each of the subsequent 1-hour windows in a day).

## Throughput mode metrics
<a name="feature-store-throughput-mode-metrics"></a>

A feature group in `On-demand` mode will emit `ConsumedReadRequestsUnits` and `ConsumedWriteRequestsUnits` metrics. A feature group in `Provisioned` mode will emit `ConsumedReadCapacityUnits` and `ConsumedWriteCapacityUnits` metrics. For more information about Feature Store metrics, see [Amazon SageMaker Feature Store metrics](monitoring-cloudwatch.md#cloudwatch-metrics-feature-store).

## Throughput mode limits
<a name="feature-store-throughput-mode-limits"></a>

Each AWS account has default service quotas or limits that are applied to help ensure availability and manage billing risks. For information about the default quotas and limits, see [Quotas, naming rules and data types](feature-store-quotas.md).

In some cases, these limits may be lower than what is stated in the documentation. If you need higher limits, you can submit a request for an increase. It's a good idea to do so before reaching current limits to avoid interruptions to your work. For information about service quotas and how to request a quota increase, see [AWS service quotas](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html).