FeatureDB is a database service provided by the FeatureStore (PAI-FeatureStore) platform under Alibaba Cloud PAI. It serves as the online store for FeatureStore, offering high-performance online feature storage and optimized read/write operations for services such as search, recommendation, and advertising. This topic introduces FeatureDB and describes its features and benefits.
What is FeatureDB
FeatureDB is a high-performance distributed storage database provided by FeatureStore. It supports KV and KKV data formats and enables structured storage of arrays as the Array type and key-value pairs as the Map type. Storing data in Array and Map types delivers higher performance for subsequent read/write operations and inference services. FeatureDB fully supports production, update, and consumption pipelines for both offline and real-time features, including user behavior sequence features.
How to activate
Activate FeatureDB when creating a new FeatureDB data source by following the on-screen instructions. For details, see Create an online data source: FeatureDB.
Product features
FeatureDB implements the following capabilities and optimizations tailored to FeatureStore’s feature data reading characteristics:
-
Supports reading and writing KV and KKV type features.
-
Supports reading and writing MaxCompute complex-type features (Array, Map).
-
Supports pulling all feature data under a FeatureView in full.
-
Supports millisecond-level polling to update real-time feature data.
-
Supports second-level TTL to automatically clean up expired data.
-
Uses pay-as-you-go billing based on actual read and write data volume.
FeatureDB shards FeatureView data across multiple partitions. Adjust the number of shards to meet read/write performance requirements for different scenarios. Replicas are also supported to ensure data stability and safety. The number of shards is set based on the Estimated Data Scale you select:
-
Below tens of millions (default): 5 shards.
-
Between tens of millions and hundreds of millions: 10 shards.
-
Above hundreds of millions: 20 shards.
In the Create Feature View dialog box, select the appropriate scale from the Estimated Data Scale drop-down list.
Benefits
-
High cost-effectiveness
Customers with smaller-scale feature storage can reduce costs using FeatureDB.
-
Meets high-frequency update requirements
When using real-time statistical features, you must update real-time features to multiple EasyRec Processor (model inference service) instances every few seconds. This demands high-frequency updates, which FeatureDB supports.
-
Supports complex-type features
In search and advertising scenarios, Array and Map type features, long user behavior sequences, and their SideInfo are widely used. Storing complex-type features as strings requires serialization into Map type during use, which degrades performance.
FeatureDB supports storing complex-type data natively and enables synchronization of MaxCompute 2.0 complex-type data into FeatureDB for high-performance reads.
-
Supports elastic scale-out
Large-scale customers can flexibly increase shard count per feature view to improve read/write performance.
-
Eliminates monitoring blind spots
Integrating third-party data sources makes end-to-end data pipeline monitoring difficult, especially for real-time features. FeatureDB monitors key performance metrics—including read/write QPS, RT, data update latency, and storage usage—at the granularity of each view.
Product capabilities
High-speed VPC connectivity
FeatureDB provides high-speed VPC connectivity through PrivateLink. After successful configuration, FeatureStore uses PrivateLink to connect your VPC to the FeatureDB service. You can then access FeatureDB over a private connection from within your VPC using the FeatureStore SDK, improving data read/write performance and reducing access latency.
Configure high-speed VPC connectivity as follows:
-
Method 1: If you have not created a FeatureDB data source, click Manage Data Source . On the Manage Data Source page, click Create Data Source . When creating a FeatureDB data source, fill in the VPC Direct Connection Configurations section with your VPC and Zone and vSwitch. For detailed steps, see Create an online data source: FeatureDB.
-
Method 2: If you have already created a FeatureDB data source, click Manage Data Source . On the Manage Data Source page, click the existing feature_db data source to go to its product page. Click VPC Direct Connection Configurations, enter your VPC and Zone and vSwitch, then click Confirm.
Notes
-
Once set, the VPC cannot be changed. Confirm that the configured VPC matches the one used by your FeatureStore online service.
-
Deploy your service in the recommended zone to avoid cross-zone network latency and maximize access performance.
Area
Region
Recommended Zone
Asia-Pacific
China (Hangzhou)
Zone G
China (Shanghai)
Zone L
China (Beijing)
Zone F
China (Shenzhen)
Zone F
Hong Kong (China)
Zone B
Singapore
Zone C
Indonesia (Jakarta)
Zone B
Europe and Americas
Germany (Frankfurt)
Zone A
US (Silicon Valley)
Zone B
-
Zone and vSwitch: Ensure you select vSwitches in the same zone as your online service instances. For high availability and stability, select vSwitches in at least two zones—preferably the zone where your online service runs and the recommended zone listed above.
-
After successful configuration, you can only add vSwitches from other zones. You cannot modify or delete existing configurations.
Write features
For offline features, use the FeatureStore Python SDK with DataWorks to run daily scheduled tasks that sync data from MaxCompute to FeatureDB.
By default, real-time feature writes perform full-row updates. If the written data includes only partial fields, missing fields are set to empty. To update only specified fields and merge them into existing data, configure as follows:
-
When writing via Java SDK: Specify the InsertMode as InsertMode.PartialFieldWrite.
for (int i = 0; i < 100;i++) { featureView.writeFeatures(writeData, InsertMode.PartialFieldWrite); } -
When writing via Flink Connector: Set the parameter insert_mode to partial_field_write.
Read features
Use the FeatureStore SDK (Go/Java) or EasyRec Processor to read features.
The FeatureStore SDK (Go/Java) supports KV point-in-time joins for offline and real-time features. Specify the feature’s JoinID (primary key) and feature name to complete a KV query and retrieve target feature data in milliseconds. The SDK also supports KKV queries for behavior sequence features. Specify a UserID to retrieve assembled sequence feature results.
EasyRec Processor integrates the FeatureStore C++ SDK, enabling full ingestion of FeatureDB feature data into memory and millisecond-level polling to update real-time features in memory for higher read performance.
Monitoring metrics
If you use FeatureDB as an online store, after creating a feature view, click Data Monitoring next to the target view to view metrics such as read/write QPS and RT. (Note: Writes from offline feature view data sync do not appear in these metrics.)
Real-time feature pipeline
FeatureStore’s storage service consists of three components: Feature Service (access layer), message queue (DataHub), and FeatureDB.
For real-time features, you can call the Feature Service via the FeatureStore Java SDK or Flink Connector to write feature data into FeatureDB. Data written through Feature Service is also synced to your MaxCompute table for real-time feature sample export and further model training.
You can read feature data stored in FeatureDB using the FeatureStore Java/Go SDKs or pull all features into local cache via EasyRec Processor for higher read performance. Real-time features deliver the latest feature information within milliseconds.
Real-time feature data lifecycle settings
When creating a real-time feature view, set the data lifecycle for the FeatureDB table using Feature Lifecycle . Rows expire and are automatically cleaned up within seconds after reaching their lifecycle duration.
Data time-to-live (TTL) currently supports two configuration methods:
-
Method 1: Do not specify an Event Time field. In this case, lifetime starts from the data write time, and rows are automatically cleaned up upon expiration.
-
Method 2: Select a feature field as the Event Time field (unit: milliseconds). Let event_time be the value of the Event Time field, time_now be the current time, and time_ttl = time_now - ttl be the threshold event_time for expiration. FeatureDB handles written data as follows:
-
If using PartialFieldWrite mode for partial-field updates, lifetime is calculated from the actual write time.
-
If event_time > time_now + 15 min: Data is not written. (This prevents timestamp discrepancies between systems by allowing a 15-minute buffer.)
-
If time_ttl < event_time <= time_now + 15 min: Data is written normally. Lifetime starts from event_time, and the row is automatically cleaned up upon expiration.
-
If 0 < event_time < time_ttl: Data is written but immediately cleaned up. Note: event_time is in milliseconds. If your Event Time field uses seconds, data falls into this case and fails to persist.
-
If event_time <= 0: Lifetime is calculated from the actual write time.
-
If the value is invalid (cannot be converted to an integer): Data is not written.
-
The Event Time field is registered but no value is provided for the Event Time field: data is written normally, and its lifetime is calculated based on the actual write time.
-
If no Event Time field is registered: Data is written normally, and lifetime is calculated from the actual write time.
-
Additionally, FeatureDB uses the event_time value as the row’s timestamp (ts). To update data for a given key, the new Event Time value must be greater than or equal to the previous value. If the new event_time is less than the original, the key’s data will not be updated.
-
Performance Testing
The following shows example stress test results for reading FeatureDB data using the FeatureStore Go SDK in a VPC environment. Test data comes from user-side tables in a recommendation scenario, with 17,689,586 total rows. Tests ran on a 4-core, 8 GiB machine. Results are for reference only.
-
With VPC Network High-Speed Connectivity configured and online service deployed in the recommended zone:
Number of feature fields (columns)
Number of keys read (rows)
Average latency
TP95
TP99
260
1
0.89 ms
1.20 ms
1.45 ms
260
10
1.17 ms
1.52 ms
1.87 ms
260
50
1.91 ms
2.56 ms
2.92 ms
260
100
2.87 ms
3.58 ms
3.93 ms
260
200
4.43 ms
5.25 ms
5.80 ms
-
With VPC Network High-Speed Connectivity configured but online service deployed in a non-recommended zone:
Number of feature fields (columns)
Number of keys read (rows)
Average latency
TP95
TP99
260
1
2.54 ms
2.86 ms
3.15 ms
260
10
2.75 ms
3.12 ms
3.56 ms
260
50
3.95 ms
4.75 ms
5.19 ms
260
100
4.82 ms
5.66 ms
6.21 ms
260
200
6.84 ms
7.75 ms
8.25 ms
-
Without VPC Network High-Speed Connectivity configured:
Number of feature fields (columns)
Number of keys read (rows)
Average latency
TP95
TP99
260
1
3.62 ms
3.83 ms
4.27 ms
260
10
3.82 ms
4.11 ms
4.61 ms
260
50
4.54 ms
5.19 ms
5.60 ms
260
100
5.40 ms
6.13 ms
6.56 ms
260
200
7.15 ms
7.93 ms
8.47 ms
Billing
For details, see FeatureStore billing.