Migration Guide: Legacy Environment Variables to New Configuration System
This guide helps you migrate from the legacy XLIO environment variable configuration to the new structured configuration system.
Migration Overview
Why Migrate?
The new configuration system provides: - Type Safety: Compile-time and runtime type checking - Validation: Schema-driven parameter validation - Structure: Hierarchical organization of related parameters - Flexibility: Multiple configuration sources with priority ordering - Documentation: Built-in parameter descriptions and constraints
Migration Strategy
-
Phase 1: Enable new system alongside legacy (backward compatible)
-
Phase 2: Convert critical parameters to new format
-
Phase 3: Migrate remaining parameters and deprecate legacy
-
Phase 4: Full migration to new system
Backward Compatibility
The new configuration system is fully backward compatible: - Existing environment variables continue to work - Migration can be done gradually
Quick Migration
Step 1: Enable New Configuration System
export XLIO_USE_NEW_CONFIG=1
Step 2: Convert Your Current Settings
Use this mapping table to convert your current environment variables:
Core Settings
|
Legacy Variable |
New Configuration Path |
Type |
Example |
|---|---|---|---|
|
|
|
integer |
4294967296 |
|
|
|
boolean |
true/false |
|
|
|
boolean |
true/false |
Network Protocol Settings
|
Legacy Variable |
New Configuration Path |
Type |
Example |
|---|---|---|---|
|
|
|
boolean |
true/false |
|
|
|
boolean |
true/false |
|
|
|
boolean |
true/false |
|
|
|
integer |
1460 |
Performance Settings
|
Legacy Variable |
New Configuration Path |
Type |
Example |
|---|---|---|---|
|
|
|
string |
"ring_per_interface" |
|
|
|
integer |
200000 |
|
|
|
integer |
10 |
Hardware Features
|
Legacy Variable |
New Configuration Path |
Type |
Example |
|---|---|---|---|
|
|
|
string |
"disable" |
|
|
|
boolean |
true/false |
|
|
|
boolean |
true/false |
Monitoring and Logging
|
Legacy Variable |
New Configuration Path |
Type |
Example |
|---|---|---|---|
|
|
|
string |
"info" |
|
|
|
string |
"/var/log/xlio.log" |
|
|
|
integer |
1 |
|
|
|
boolean |
true/false |
|
|
|
string |
"/tmp/stats.log" |
|
|
|
string |
"/tmp/xlio" |
Application-Specific Settings
|
Legacy Variable |
New Configuration Path |
Type |
Example |
|---|---|---|---|
|
|
|
integer |
Worker count |
|
|
|
boolean |
true/false |
Practical Migration Examples
Example 1: Basic TCP Configuration
Before (Legacy):
export XLIO_TCP_NODELAY=1 export XLIO_TCP_QUICKACK=1 export XLIO_LOG_LEVEL=3 export XLIO_LOG_FILE="/var/log/xlio.log"
After (New System):
export XLIO_USE_NEW_CONFIG=1 Using JSON file (/etc/libxlio_config.json):
{ "network": { "protocols": { "tcp": { "nodelay": { "enable": true }, "quickack": true } } }, "monitor": { "log": { "level": "info", "file_path": "/var/log/xlio.log" } } }
Or using Inline config:
export XLIO_INLINE_CONFIG="network.protocols.tcp.nodelay.enable=true, network.protocols.tcp.quickack=true, monitor.log.level=info, monitor.log.file_path=/var/log/xlio.log"
Example 2: Performance Tuning
Before (Legacy):
export XLIO_RING_ALLOCATION_LOGIC=1 export XLIO_RING_TX_NUM=32 export XLIO_TX_BUFS=100000 export XLIO_CQ_DRAIN_INTERVAL=5
After (New System):
export XLIO_USE_NEW_CONFIG=1
Using JSON file (/etc/libxlio_config.json):
{
"performance": {
"rings": {
"tx": {
"allocation_logic": "per_ip_address",
"max_count": 32
}
},
"buffers": {
"tx": {
"global_array_size": 100000
}
},
"completion_queue": {
"rx_drain_rate_nsec": 500000000
}
}
}
Or using Inline config:
export XLIO_INLINE_CONFIG="performance.rings.allocation_logic=ring_per_ip, performance.rings.tx.max_count=32, performance.buffers.tx.global_array_size=100000, performance.cq.rx_drain_rate=5"
Example 3: Nginx Optimization
Before (Legacy):
export XLIO_NGINX_WORKERS_NUM=8 export XLIO_DISTRIBUTE_CQ=1 export XLIO_TCP_NODELAY=1
After (New System):
export XLIO_USE_NEW_CONFIG=1
Using JSON file (/etc/libxlio_config.json):
{
"applications": {
"nginx": {
"workers_num": 8,
"distribute_cq": true
}
},
"network": {
"protocols": {
"tcp": {
"nodelay": {
"enable": true
}
}
}
}
}
Or using Inline config:
export XLIO_INLINE_CONFIG="applications.nginx.workers_num=8, applications.nginx.distribute_cq=true, network.protocols.tcp.nodelay.enable=true"
Migration Automation
JSON Generator Script
run this script when your deprecated environment variables are set:
#!/usr/bin/env python3 import osfrom functools import reduce import jsonimport mappings # available in the repo at:src/core/config/mappings.py def migrate_to_json(): config = {} for key, env_var in mappings.config_mapping: if os.getenv(env_var): reduce(lambda d, k: d.setdefault(k, {}), keys[:-1], config)[keys[-1]] = os.getenv(env_var) return config if __name__ == "__main__": config = migrate_to_json() if config: print(json.dumps(config, indent=2)) else: print("No legacy configuration found to migrate")
Migration Validation
Verify Configuration Loading
# Enable debug logging to see configuration loading export XLIO_INLINE_CONFIG="monitor.log.level=debug, monitor.log.details=3" # Run application and check logs ./your_application 2>&1 | grep -E "(Config|Parameter|Loading)"
Compare Legacy vs New Behavior
# Test with legacy configuration unset XLIO_USE_NEW_CONFIG export XLIO_TCP_NODELAY=1 ./test_app # Test with new configuration (using /etc/libxlio_config.json by default)# /etc/libxlio_config.json:{ "network": { "protocols": { "tcp": { "nodelay": { "enable": true } } } }} export XLIO_USE_NEW_CONFIG=1 export XLIO_INLINE_CONFIG="network.protocols.tcp.nodelay.enable=true" ./test_app# Test with new configuration (using specific path)# /tmp/nodelay_conf.json:{ "network": { "protocols": { "tcp": { "nodelay": { "enable": true } } } }} export XLIO_USE_NEW_CONFIG=1 export XLIO_CONFIG_FILE=/tmp/nodelay_conf.json ./test_app # Test with new Inline configuration export XLIO_USE_NEW_CONFIG=1 export XLIO_INLINE_CONFIG="network.protocols.tcp.nodelay.enable=true" ./test_app
Troubleshooting Migration
Common Issues
|
Issue |
Cause |
Solution |
|---|---|---|
|
Config not loading |
|
Ensure |
|
Parameter ignored |
Wrong parameter name |
Check Configuration Reference |
|
JSON syntax error |
Invalid JSON format |
Use |
Debug Configuration Loading
# Maximum debug information export XLIO_INLINE_CONFIG="monitor.log.level=trace, monitor.log.details=3" # Check what parameters are actually loaded ./your_application 2>&1 | grep -E "(Parameter|Config|Loaded)" | head -20
Validation Tools
# Validate JSON syntax
python3 -m json.tool /etc/libxlio_config.json
Best Practices
-
Test Migration: Always test in development environment first
-
Gradual Migration: Migrate critical parameters first, then less critical ones
-
Document Changes: Keep track of what parameters were migrated
-
Validate Behavior: Ensure application behavior remains consistent
-
Monitor Performance: Watch for any performance regressions during migration
Support
-
Configuration Reference - Complete parameter documentation
-
Quick Start Guide - Common configuration examples
-
Schema File:
src/core/config/descriptor_providers/xlio_config_schema.json -
Legacy Mappings:
src/core/config/mappings.py
This migration guide covers the transition from legacy XLIO environment variables to the new configuration system. For specific parameter details, see the Configuration Reference.
Last updated: