All Products
Search
Document Center

Platform For AI:FeatureDB overview

Last Updated:Apr 01, 2026

FeatureDB is a distributed KV database for online feature storage in PAI-FeatureStore. It delivers millisecond-latency reads and writes for search, recommendation, and advertising workloads.

What is FeatureDB

FeatureDB stores features in KV and KKV formats with native Array and Map support. Unlike serialized string storage, structured storage improves read, write, and inference performance. FeatureDB handles offline features, real-time features, and behavior sequences within a single system.

FeatureDB shards data within each feature view and adjusts shard count based on your Estimated Order of Magnitude:

Data volumeShard count
Less than 10 million (default)5
10 million–100 million10
More than 100 million20

Replicas are supported for data stability. Shard count scales up as performance needs grow.

image

Activate FeatureDB

Activate FeatureDB when creating a FeatureDB data store by following the interface prompts.

Capabilities

FeatureDB provides:

  • Read and write KV and KKV features

  • Read and write MaxCompute complex types (Array and Map)

  • Pull all feature data in a feature view

  • Millisecond polling for real-time feature updates

  • Second-level TTL (time-to-live) with automatic expired data cleanup

  • Pay-as-you-go billing based on actual operations

Advantages

Lower costs

Reduces storage expenses, particularly for smaller feature sets.

High-frequency updates

Real-time statistical features update every few seconds across multiple EasyRec Processor instances.

Native complex types

Search and advertising workloads commonly use Array, Map, behavior sequences, and SideInfo. String serialization degrades performance at scale. FeatureDB stores these types natively and synchronizes MaxCompute 2.0 complex data, enabling high-performance reads without deserialization overhead.

Elastic scaling

Increase shards per feature view to scale read and write throughput for larger deployments.

Comprehensive monitoring

Monitor read/write QPS, RT, data update latency, and storage at feature view granularity. This eliminates blind spots when integrating third-party data sources.

Low latency

With VPC direct connection configured and your online service deployed in a recommended zone, single-key reads achieve an average latency of 0.89 ms and TP99 of 1.45 ms (260-column feature table, 17.7M rows, tested with FeatureStore Go SDK on a 4-core/8 GiB machine). See Performance benchmarks for full results.

How it works

The FeatureStore storage service has three components: Feature Service (access layer), MSMQ (DataHub), and FeatureDB.

image

Write path: Write real-time features to FeatureDB via FeatureStore Java SDK or Flink Connector. Data also synchronizes to your MaxCompute table for feature export and model training.

Read path: Read features via FeatureStore Java/Go SDK, or use EasyRec Processor to pull all features into local cache for higher throughput. Real-time features are available within milliseconds of being written.

Set up VPC direct connection

FeatureDB uses PrivateLink to provide VPC (Virtual Private Cloud) direct connection. After configuration, access FeatureDB from your VPC via FeatureStore SDK through a private connection, improving throughput and reducing latency.

Method 1: No existing FeatureDB data store

  1. On the Store tab, click Create Source.

  2. Under VPC Direct Connection Configurations, set VPC, Zone and vSwitch, and Security Group Name.

For details, see Online data store: FeatureDB.

Method 2: Existing FeatureDB data source

  1. On the Store tab, click feature_db.

  2. Click VPC Direct Connection Configurations.

  3. Specify VPC, Zone and vSwitch, and Security Group Name, then click OK.

Configuration notes

  • VPC is immutable after initial configuration. Set it to the VPC where your online service using FeatureStore resides.

  • Zone and vSwitch: Select a vSwitch in the zone where your online service instance runs. Select vSwitches in at least two zones for high availability.

  • After confirmation, configurations are immutable except for adding vSwitches in other zones.

  • Deploy your service in a recommended zone to minimize network latency:

AreaRegionRecommended zone
Asia PacificChina (Hangzhou)Zone G
Asia PacificChina (Shanghai)Zone L
Asia PacificChina (Beijing)Zone F
Asia PacificChina (Shenzhen)Zone F
Asia PacificChina (Hong Kong)Zone B
Asia PacificSingaporeZone C
Europe and AmericasGermany (Frankfurt)Zone A
Europe and AmericasUnited States (Silicon Valley)Zone B

Write data

Offline features: Use FeatureStore Python SDK to run scheduled tasks through DataWorks, synchronizing data from MaxCompute to FeatureDB.

For real-time features, write feature data directly using Java SDK.

       // Initialize configuration with region, credentials, and project
       Configuration configuration = new Configuration("cn-beijing",
                Constants.accessId, Constants.accessKey,"fs_demo_featuredb" );

        // Set FeatureDB credentials
        configuration.setUsername(Constants.username);
        configuration.setPassword(Constants.password);

        // For public network access, set domain (omit for VPC)
        //configuration.setDomain(Constants.host);

        ApiClient client = new ApiClient(configuration);

        // For public network, set usePublicAddress = true (omit for VPC)
        // FeatureStoreClient featureStoreClient = new FeatureStoreClient(client, Constants.usePublicAddress);
        FeatureStoreClient featureStoreClient = new FeatureStoreClient(client );

        // Get project and feature view
        Project project = featureStoreClient.getProject("fs_demo_featuredb");
        if (null == project) {
            throw  new RuntimeException("project not found");
        }

        FeatureView featureView = project.getFeatureView("user_test_2");
        if (null == featureView) {
            throw  new RuntimeException("featureview not found");
        }

        // Prepare sample data
        List<Map<String, Object>> writeData = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            Map<String, Object> data = new HashMap<>();
            data.put("user_id", i);
            data.put("string_field", String.format("test_%d", i));
            data.put("int32_field", i);
            data.put("int64_field", Long.valueOf(i));
            data.put("float_field", Float.valueOf(i));
            data.put("double_field", Double.valueOf(i));
            data.put("boolean_field", i % 2 == 0);
            writeData.add(data);
        }

        // Write data in batches
        for (int i = 0; i < 100;i++) {
            featureView.writeFeatures(writeData);
        }

        // Flush all writes (call once after all writes complete)
        featureView.writeFlush();

Real-time features: Write directly using the Java SDK.

// Initialize configuration with region, credentials, and project
Configuration configuration = new Configuration("cn-beijing",
         Constants.accessId, Constants.accessKey, "fs_demo_featuredb");

// Set FeatureDB credentials
configuration.setUsername(Constants.username);
configuration.setPassword(Constants.password);

// For public network access, set domain (omit for VPC)
//configuration.setDomain(Constants.host);

ApiClient client = new ApiClient(configuration);

// For public network, set usePublicAddress = true (omit for VPC)
// FeatureStoreClient featureStoreClient = new FeatureStoreClient(client, Constants.usePublicAddress);
FeatureStoreClient featureStoreClient = new FeatureStoreClient(client);

// Get project and feature view
Project project = featureStoreClient.getProject("fs_demo_featuredb");
if (null == project) {
    throw new RuntimeException("project not found");
}

FeatureView featureView = project.getFeatureView("user_test_2");
if (null == featureView) {
    throw new RuntimeException("featureview not found");
}

// Prepare sample data
List<Map<String, Object>> writeData = new ArrayList<>();
for (int i = 0; i < 10; i++) {
    Map<String, Object> data = new HashMap<>();
    data.put("user_id", i);
    data.put("string_field", String.format("test_%d", i));
    data.put("int32_field", i);
    data.put("int64_field", Long.valueOf(i));
    data.put("float_field", Float.valueOf(i));
    data.put("double_field", Double.valueOf(i));
    data.put("boolean_field", i % 2 == 0);
    writeData.add(data);
}

// Write data in batches
for (int i = 0; i < 100; i++) {
    featureView.writeFeatures(writeData);
}

// Flush all writes (call once after all writes complete)
featureView.writeFlush();

By default, each write overwrites the entire row—unwritten fields are cleared. To update only specific fields while preserving others, use partial field write mode:

  • Java SDK: Pass InsertMode.PartialFieldWrite to writeFeatures.

    for (int i = 0; i < 100; i++) {
        featureView.writeFeatures(writeData, InsertMode.PartialFieldWrite);
    }
  • Flink Connector: Set insert_mode to partial_field_write.

Read data

Read features using FeatureStore SDK (Go or Java) or EasyRec Processor.

ClientQuery typeDetails
FeatureStore Go/Java SDKKV point queriesSpecify JoinID (primary key) and feature name. Returns results in milliseconds.
FeatureStore Go/Java SDKKKV queries (behavior sequences)Specify UserID to retrieve assembled behavior sequences.
EasyRec ProcessorFull feature pullIntegrates FeatureStore C++ SDK. Pulls all features from FeatureDB into local memory with millisecond polling for real-time updates. Achieves higher read throughput than per-key queries.

Monitor metrics

After creating a feature view with FeatureDB as the online data source, click Data Monitoring on the right side of the target view to see read/write QPS and RT per feature view.

image

Manage feature lifecycle

Specify Feature Lifecycle when creating a real-time feature view. Rows that reach the lifecycle threshold expire and are automatically deleted within seconds.

image

Survival time is calculated using one of two methods:

Method 1: No Event Time field

Survival time starts from the actual data write time.

Method 2: Event Time field enabled (unit: milliseconds)

Let event_time be the Event Time value, time_now be the current time, and time_ttl = time_now - TTL be the expiration threshold.

ConditionBehavior
event_time > time_now + 15 minData is not written. The 15-minute buffer prevents timestamp skew between systems.
time_ttl < event_time <= time_now + 15 minWritten normally. Survival time starts from event_time; data expires after the lifecycle period.
0 < event_time < time_ttlWritten, but expires immediately after write.
event_time <= 0Survival time starts from actual write time.
Invalid value (cannot convert to integer)Data is not written.
Event Time field registered, but no value passedWritten normally. Survival time starts from actual write time.
No Event Time fieldWritten normally. Survival time starts from actual write time.

Additional rules:

  • In PartialFieldWrite mode, survival time always uses the actual write time, regardless of event_time.

  • event_time becomes the row timestamp (ts) in FeatureDB. To update an existing key, the new event_time must equal or exceed the previous value—otherwise the update is dropped.

  • Event Time unit is milliseconds. If your field stores seconds, writes will fail silently.

Performance benchmarks

The following results use FeatureStore Go SDK to read a feature table with 17,689,586 rows of user-side recommendation data and 260 feature columns. Test machine: 4 cores, 8 GiB memory. Results are for reference only.

VPC direct connection, recommended zone

Keys readAverage latencyTP95TP99
10.89 ms1.20 ms1.45 ms
101.17 ms1.52 ms1.87 ms
501.91 ms2.56 ms2.92 ms
1002.87 ms3.58 ms3.93 ms
2004.43 ms5.25 ms5.80 ms

VPC direct connection, non-recommended zone

Keys readAverage latencyTP95TP99
12.54 ms2.86 ms3.15 ms
102.75 ms3.12 ms3.56 ms
503.95 ms4.75 ms5.19 ms
1004.82 ms5.66 ms6.21 ms
2006.84 ms7.75 ms8.25 ms

No VPC direct connection

Keys readAverage latencyTP95TP99
13.62 ms3.83 ms4.27 ms
103.82 ms4.11 ms4.61 ms
504.54 ms5.19 ms5.60 ms
1005.40 ms6.13 ms6.56 ms
2007.15 ms7.93 ms8.47 ms

Billing

For billing details, see Billing of FeatureStore. FeatureDB uses pay-as-you-go pricing based on actual operations.