Skip to content

HeliosDB SDK Architecture

HeliosDB SDK Architecture

Multi-Language Client SDK Design Document

Version: 1.0.0 Date: November 24, 2025 Status: Production Ready


Executive Summary

This document describes the architecture and design of HeliosDB’s official client SDKs for Python, JavaScript/TypeScript, Java, Go, and .NET. All SDKs follow a consistent design pattern while respecting language-specific idioms and best practices.

Key Features

  • Connection Pooling - Efficient connection management with configurable pool sizes
  • Async/Await Support - Non-blocking I/O for high performance
  • Type Safety - Strong typing with compile-time checks
  • Error Handling - Comprehensive exception hierarchy
  • Transaction Support - ACID transactions with configurable isolation levels
  • Query Streaming - Handle large result sets efficiently
  • Protocol Support - PostgreSQL, Cassandra CQL, MongoDB wire protocols
  • Monitoring - Built-in query metrics and connection statistics

1. Architecture Overview

1.1 Layered Architecture

┌─────────────────────────────────────────────────────────────┐
│ Application Code │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ SDK Public API │
│ - Client: Main entry point │
│ - Connection: Connection management │
│ - Transaction: ACID transaction support │
│ - Cursor: Query execution and result iteration │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Connection Pool Layer │
│ - Pool management │
│ - Connection lifecycle │
│ - Health checks │
│ - Statistics tracking │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Protocol Layer │
│ - PostgreSQL wire protocol │
│ - Cassandra CQL protocol │
│ - MongoDB wire protocol │
│ - gRPC/REST adapters │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Network Layer │
│ - TLS/SSL encryption │
│ - TCP connection management │
│ - Retry logic │
│ - Timeout handling │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ HeliosDB Server │
└─────────────────────────────────────────────────────────────┘

1.2 Core Components

Client

  • Main entry point for SDK
  • Manages connection pool lifecycle
  • Provides high-level query methods
  • Factory for transactions and cursors

Connection Pool

  • Maintains pool of database connections
  • Handles connection acquisition/release
  • Performs health checks
  • Tracks pool statistics

Connection

  • Represents single database connection
  • Executes queries and commands
  • Manages connection state
  • Tracks connection statistics

Transaction

  • ACID transaction support
  • Configurable isolation levels
  • Savepoint management
  • Auto-commit/rollback

Cursor

  • Query execution
  • Result set iteration
  • Streaming large results
  • Positioned updates

2. SDK Implementation Matrix

2.1 Feature Parity

FeaturePythonJavaScriptJavaGo.NETPriority
Core
Connection poolingCritical
Async/awaitCritical
Parameterized queriesCritical
TransactionsCritical
Prepared statementsHigh
Batch operationsHigh
Protocols
PostgreSQLCritical
Cassandra CQLHigh
MongoDBMedium
gRPCHigh
RESTMedium
Advanced
Streaming resultsHigh
Connection health checksHigh
Query metricsMedium
Retry logicHigh
TLS/SSLCritical
Type safetyHigh

Implemented | ⚠ Partial | ❌ Not implemented

2.2 Package Distribution

SDKPackage RegistryPackage NameVersion
PythonPyPIheliosdb1.0.0
JavaScriptNPM@heliosdb/client1.0.0
JavaMaven Centralcom.heliosdb:heliosdb-jdbc1.0.0
GoGitHubgithub.com/heliosdb/heliosdb-gov1.0.0
.NETNuGetHeliosDB.Client1.0.0

3. Connection Management

3.1 Connection Pool Architecture

Connection Pool
├── Min Connections: 10 (configurable)
├── Max Connections: 100 (configurable)
├── Idle Timeout: 30s
├── Connection Lifetime: 3600s
├── Health Check Interval: 60s
└── Acquisition Timeout: 10s

3.2 Connection Lifecycle

┌──────────┐
│ Create │ ← Pool initialization
└────┬─────┘
┌──────────┐
│ Idle │ ← Waiting for acquisition
└────┬─────┘
┌──────────┐
│ Active │ ← Executing queries
└────┬─────┘
┌──────────┐
│ Release │ ← Return to pool
└────┬─────┘
┌──────────┐
│ Close │ ← Pool shutdown or max lifetime
└──────────┘

3.3 Connection Pool Configuration

# Python
config = ConnectionConfig(
min_pool_size=10,
max_pool_size=100,
pool_recycle_seconds=3600,
pool_pre_ping=True,
connect_timeout=timedelta(seconds=10),
)
// JavaScript/TypeScript
const config: ConnectionConfig = {
minPoolSize: 10,
maxPoolSize: 100,
connectTimeoutMs: 10000,
applicationName: 'my-app',
};
// Java
ConnectionConfig config = ConnectionConfig.builder()
.minPoolSize(10)
.maxPoolSize(100)
.connectTimeout(Duration.ofSeconds(10))
.applicationName("my-app")
.build();
// Go
config := heliosdb.Config{
MinPoolSize: 10,
MaxPoolSize: 100,
ConnectTimeout: 10 * time.Second,
ApplicationName: "my-app",
}
.NET
var config = new ConnectionConfig {
MinPoolSize = 10,
MaxPoolSize = 100,
ConnectTimeout = TimeSpan.FromSeconds(10),
ApplicationName = "my-app"
};

4. Error Handling

4.1 Exception Hierarchy

HeliosDBError (Base)
├── ConnectionError
│ ├── PoolExhaustedError
│ └── ConnectionTimeoutError
├── QueryError
│ ├── SyntaxError
│ └── ConstraintViolationError
├── TransactionError
│ ├── DeadlockError
│ └── SerializationError
├── TimeoutError
├── AuthenticationError
└── ProtocolError

4.2 Retry Strategy

Exponential Backoff Formula:
delay = min(max_delay, base_delay * (exponential_base ^ attempt))
Default Configuration:
- base_delay: 1 second
- max_delay: 60 seconds
- exponential_base: 2
- max_attempts: 3
- jitter: enabled

4.3 Error Handling Examples

# Python
from heliosdb import HeliosDBClient, QueryError, RetryableError
async with HeliosDBClient() as client:
try:
result = await client.query("SELECT * FROM users")
except QueryError as e:
print(f"Query failed: {e.message}")
print(f"Query: {e.query}")
except RetryableError as e:
print(f"Retryable error: {e.retry_after_seconds}s")
// JavaScript/TypeScript
import { HeliosDBClient, QueryError, RetryableError } from '@heliosdb/client';
const client = new HeliosDBClient();
try {
const result = await client.query('SELECT * FROM users');
} catch (error) {
if (error instanceof QueryError) {
console.log(`Query failed: ${error.message}`);
} else if (error instanceof RetryableError) {
console.log(`Retry after: ${error.retryAfterMs}ms`);
}
}

5. Transaction Management

5.1 Isolation Levels

LevelPhenomena PreventedUse Case
READ UNCOMMITTEDNoneAnalytics, bulk operations
READ COMMITTEDDirty readsDefault, most applications
REPEATABLE READDirty reads, non-repeatable readsReports, consistent views
SERIALIZABLEAll phenomenaFinancial transactions

5.2 Transaction Examples

# Python
async with client.transaction(isolation_level=IsolationLevel.SERIALIZABLE) as txn:
await txn.execute("UPDATE accounts SET balance = balance - $1 WHERE id = $2", [100, 1])
await txn.execute("UPDATE accounts SET balance = balance + $1 WHERE id = $2", [100, 2])
# Auto-commit on success, auto-rollback on exception
// JavaScript/TypeScript
const txn = client.transaction({ isolationLevel: IsolationLevel.Serializable });
await txn.begin();
try {
await txn.execute('UPDATE accounts SET balance = balance - $1 WHERE id = $2', [100, 1]);
await txn.execute('UPDATE accounts SET balance = balance + $1 WHERE id = $2', [100, 2]);
await txn.commit();
} catch (error) {
await txn.rollback();
throw error;
}

6. Performance Optimization

6.1 Query Optimization

  • Prepared Statements: Cache query plans
  • Batch Operations: Group multiple operations
  • Connection Pooling: Reuse connections
  • Streaming: Handle large result sets
  • Compression: Reduce network bandwidth

6.2 Performance Metrics

# Get connection statistics
stats = client.pool.get_stats()
print(f"Active connections: {stats.active_connections}")
print(f"Pool hits: {stats.pool_hits}")
print(f"Pool misses: {stats.pool_misses}")
# Get query metrics
result = await client.query("SELECT * FROM users")
print(f"Execution time: {result.execution_time_ms}ms")
print(f"Rows returned: {result.rowcount}")

6.3 Benchmark Results

OperationPythonJavaScriptJavaGo.NET
Simple query15K qps12K qps25K qps30K qps22K qps
Batch insert50K rows/s40K rows/s100K rows/s120K rows/s90K rows/s
Streaming500 MB/s450 MB/s800 MB/s1000 MB/s750 MB/s
Pool connections1000800200030001800

7. Security

7.1 TLS/SSL Configuration

# Python
config = ConnectionConfig(
ssl_mode=SSLMode.VERIFY_FULL,
ssl_ca_cert="/path/to/ca.crt",
ssl_client_cert="/path/to/client.crt",
ssl_client_key="/path/to/client.key",
)

7.2 Authentication Methods

  • Password: Username/password authentication
  • TLS Certificates: Client certificate authentication
  • API Keys: Token-based authentication
  • OAuth 2.0: Enterprise SSO integration

8. Testing Strategy

8.1 Test Coverage

Test TypeCoverage TargetStatus
Unit tests90%+
Integration tests80%+
Performance testsKey operations
Protocol testsAll protocols
Security testsAuthentication, TLS

8.2 Test Infrastructure

  • Automated CI/CD pipeline
  • Docker-based test environments
  • Cross-platform testing
  • Protocol compliance testing
  • Performance regression testing

9. Documentation

9.1 Documentation Types

  • API Reference: Auto-generated from source code
  • Quickstart Guides: Getting started tutorials
  • Examples: Comprehensive usage examples
  • Migration Guides: Upgrading between versions
  • Best Practices: Performance and security guidelines

9.2 Documentation Status

SDKAPI DocsExamplesQuickstartMigration Guide
Python
JavaScript
Java
Go
.NET

10. Roadmap

10.1 Version 1.1 (Q1 2026)

  • Query caching
  • Connection multiplexing
  • Advanced retry strategies
  • Circuit breaker pattern
  • Distributed tracing

10.2 Version 1.2 (Q2 2026)

  • GraphQL support
  • WebSocket streaming
  • Reactive extensions
  • Advanced monitoring
  • Performance profiling

11. Support and Community


Document Version: 1.0.0 Last Updated: November 24, 2025 Authors: HeliosDB SDK Team Review Status: Approved for Production