-
Notifications
You must be signed in to change notification settings - Fork 1
Module core Future
Hinweis: Vage EintrΓ€ge ohne messbares Ziel, Interface-Spezifikation oder Teststrategie mit `` markieren.
- Central dependency injection (DI) context (
ConcernsContext) for adapter ownership and resolution (storage, index, query, auth, logger, tracer, metrics, cache) - Adapter lifecycle management: registration, validation, hot-swap, and graceful shutdown of adapters
- Runtime resilience controls around adapter dependencies (circuit breaker + fallback policy)
- Dynamic adapter reconfiguration and distributed cache integration without process restarts
- Unified observability wiring for logging, tracing, and metrics through the DI context
- Plugin-based adapter loading (no recompile needed) implemented via Issue #1706 (2026-07-28)
- Adapter plugin hardening and signing workflow delivered (2026-07-28)
-
AdapterRegistry::hotSwap()drains in-flight refs within β€ 100 ms (kHotSwapTimeoutMs{100}) (Implemented: 2026-07-28) -
ConcernsContext::resolve<T>()usesstd::shared_mutexreader-writer lock and returns owningstd::shared_ptrsnapshots for built-in adapters (Implemented: 2026-07-28)
-
[x]Adapter hot-swap must complete in β€ 100 ms and must not drop in-flight requests; callers hold a ref-counted handle (Implemented: 2026-07-28) -
[x]ConcernsContextmust be fully thread-safe; concurrent adapter resolution must not require a global lock (Implemented: 2026-07-28) -
[ ]Circuit breaker state transitions (closed β open β half-open) must be observable via metrics and loggable at DEBUG level -
[x]No adapter may be registered without passing a synchronousAdapterValidator::validate()check; invalid adapters are rejected at registration time (Implemented: 2026-07-28) -
[ ]DI context construction must complete in β€ 50 ms at server startup with up to 32 registered adapters -
[x]All adapter interfaces versioned with auint32_tAPI version; version mismatch at registration returns a structured error (Implemented: 2026-07-28) -
[ ]Distributed cache adapter must not be a hard dependency; core must function correctly when no cache adapter is registered
| Interface | Consumer | Notes |
|---|---|---|
ConcernsContext::resolve<T>() |
All modules | Returns shared adapter handle; thread-safe; ref-counted |
AdapterRegistry::registerAdapter(id, adapter, validator) |
Server startup / admin API | Validates before insertion |
AdapterRegistry::hotSwap(id, new_adapter) |
Admin API / config watcher | Drains in-flight refs before replacing |
CircuitBreaker::call(fn, fallback) |
Adapter call sites | Configurable failure threshold and reset timeout |
DistributedCache::get/set/invalidate(key) |
Query executor, analytics | Optional adapter; no-op stub when absent |
ObservabilityBus::emit(event) |
All adapters | Routes to logger/tracer/metrics based on event type |
- Plugin runtime loading and signature verification are delivered; next hardening block is richer trust policy enforcement (key management, signer rotation, and rejection telemetry).
- Preserve backwards-compatible concern interfaces while introducing adapter package signing and structured registration errors.
- Keep runtime swap and distributed cache improvements measurable via the test/performance constraints below.
Priority: High Target Version: v1.9.0
Harden runtime adapter switching for high-throughput production workloads.
// Runtime adapter swap β no restart required
context->replaceLogger(std::make_unique<SpdlogLoggerAdapter>(...));
context->replaceMetrics(std::make_unique<PrometheusMetricsAdapter>(...));Planned hardening work:
- Add swap-drain telemetry (duration, in-flight handles, error counts) per adapter type.
- Add rollback guardrails for failed replacement attempts under load.
- Add stress profile for repeated replace-cycles under mixed read/write traffic.
Benefits:
- Zero-downtime logging level changes
- Switch between tracing backends without restart
- Enable/disable metrics dynamically
Priority: High Target Version: v1.9.0
Expand distributed caching toward multi-region and failure-domain-aware operation.
Features:
- Cluster-wide cache invalidation (via Redis pub/sub PUBLISH on DEL/clear)
- Consistent hashing (FNV-1a hash ring with virtual nodes) for key routing
- TTL support via Redis PSETEX (millisecond precision)
- Pub/sub for cache invalidation messages (background subscriber thread)
- Graceful degradation when Redis is unavailable (no exceptions, returns nullopt/false)
Planned expansion:
- Add multi-region keyspace strategy and region-local invalidation buffering.
- Add partition tolerance mode with deterministic stale-read policies.
- Add operator-facing cache health SLOs and alert thresholds.
API:
auto redis_cache = RedisCache::create("redis://cluster:6379");
auto context = ConcernsContext::createCustom(
logger, tracer, metrics, std::move(redis_cache)
);Use Cases:
- Query result caching across nodes
- Session state management
- Distributed rate limiting state
Priority: Medium Target Version: v1.7.0
Automatic context propagation through call chains for better log correlation.
// Automatically include request_id in all logs
auto scoped_context = logger->withContext({
{"request_id", "req-123"},
{"user_id", "user-456"}
});
// All subsequent logs automatically include context
logger->info("Processing query");
// Output: [request_id=req-123, user_id=user-456] Processing queryBenefits:
- Easier log correlation
- Automatic structured logging
- Reduced boilerplate
Priority: Medium Target Version: v1.7.0
Centralized metrics aggregation across sharded nodes.
Features:
- Aggregate counters/histograms from all nodes
- Push to central Prometheus/Grafana
- Automatic shard labeling
- Query-based metric filtering
Priority: Low Target Version: v1.8.0
Machine learning-based cache eviction that adapts to workload patterns.
Approach:
- Monitor hit/miss patterns
- Automatically switch between LRU/LIRS/ARC
- Predict hot data based on access patterns
- Adjust cache size dynamically
Priority: Low Target Version: v1.8.0
Allow users to register custom cross-cutting concerns.
class ICustomConcern {
public:
virtual void onRequest(const Request& req) = 0;
virtual void onResponse(const Response& res) = 0;
};
context->registerConcern<ICustomConcern>(my_custom_concern);Priority: High Target Version: v1.9.0
Further reduce logging overhead for high-cardinality workloads.
Current: string_view hot path with thread-local format buffer Target: bounded queue backpressure and adaptive flush policy by latency target
Expected Improvement: 30-50% reduction in logging overhead
Priority: High Target Version: v1.9.0
Extend lock-free metrics pipeline for predictable p99 under burst load.
Planned work:
- Add bounded-memory histogram compaction mode.
- Add low-contention exporter fan-out for multi-sink metric backends.
- Add saturation metrics and adaptive flush interval.
Expected Improvement: 80% reduction in metric update latency
Priority: Medium Target Version: v1.7.0
Reuse span objects instead of allocating on every trace.
Current: Allocate new span for every operation Target: Object pool with 1000 pre-allocated spans
Expected Improvement: 60% reduction in tracing overhead
Priority: Medium Target Version: v1.7.0
Defer adapter creation until first use.
Benefits:
- Faster startup time
- Lower memory footprint for unused concerns
- Pay-for-what-you-use model
Priority: Low Target Version: v1.8.0
Batch multiple metric updates before sending to Prometheus.
Current: Export every metric update immediately Target: Buffer updates and export every 100ms
Expected Improvement: 90% reduction in network overhead
Priority: Medium Target Version: v1.7.0
Split concerns into standalone libraries for better modularity.
libthemis-logging.so (ILogger + adapters)
libthemis-tracing.so (ITracer + adapters)
libthemis-metrics.so (IMetrics + adapters)
libthemis-caching.so (ICache + implementations)
Benefits:
- Independent versioning
- Reduced binary size for minimal builds
- Easier testing and maintenance
Priority: Low Target Version: v1.8.0
Allow custom cache eviction strategies via plugin API.
Benefits:
- User-defined eviction policies
- A/B testing of strategies
- Domain-specific optimization
Priority: Low Target Version: v1.9.0
Reduce boilerplate in context creation.
// Current
auto context = ConcernsContext::createCustom(
std::make_unique<SpdlogLoggerAdapter>(),
std::make_unique<OpenTelemetryTracerAdapter>(),
std::make_unique<PrometheusMetricsAdapter>(),
std::make_unique<InMemoryCacheImpl>()
);
// Proposed
auto context = ConcernsContextBuilder()
.withLogger<SpdlogLogger>()
.withTracer<OtelTracer>()
.withMetrics<PrometheusMetrics>()
.withCache<InMemoryCache>()
.build();Priority: Medium Target Version: v1.7.0
Use Expected<T, Error> consistently across all concern interfaces.
Current: Mix of exceptions, optionals, and error codes
Target: Uniform Result<T> return type
Severity: Medium Signal: Duplicate compute after concurrent cache misses under burst traffic
Multiple threads simultaneously query cache miss, causing duplicate work.
Workaround: Use lock-based cache warming Fix: Implement request coalescing in cache layer
Planned Fix: backlog (pending scheduling)
Severity: Low
Signal: Long-running spans can accumulate if end() is not called
Long-running spans can accumulate if end() is not called.
Workaround: Use RAII span guards Fix: Add automatic span timeout and cleanup
Planned Fix: backlog (pending scheduling)
Severity: High Signal: High-cardinality labels (e.g., user IDs) can cause unbounded memory growth
High-cardinality labels (e.g., user IDs) cause unbounded memory growth.
Workaround: Limit label values via configuration Fix: Add automatic label cardinality limiting and warnings
Planned Fix: backlog (pending scheduling)
Severity: Low Signal: Environment variable combinations can incorrectly trigger production mode
Environment variable detection can incorrectly trigger production mode.
Workaround: Explicitly set THEMIS_PRODUCTION_MODE=0
Fix: More robust production detection logic
Planned Fix: backlog (pending scheduling)
Focus: Automatic performance tuning based on metrics
Use collected metrics to:
- Automatically tune cache sizes
- Adjust thread pool sizes
- Predict query hotspots
- Optimize index selection
Research Questions:
- Which metrics best correlate with performance?
- Can we use reinforcement learning for auto-tuning?
- How to avoid oscillation in adaptive systems?
Focus: Secure logging without PII exposure
Approaches:
- Automatic PII detection and redaction
- Differential privacy for aggregate metrics
- Encrypted logging with key rotation
- Secure multi-party computation for log analysis
Research Questions:
- How to balance debuggability with privacy?
- Can we detect PII with high accuracy?
- What's the performance cost of encrypted logging?
Focus: ML-based cache prediction
Use query patterns to:
- Pre-fetch likely future queries
- Identify cold data for eviction
- Predict query result sizes
- Optimize cache partitioning
Research Questions:
- Which ML models best predict cache behavior?
- Can we do online learning without overhead?
- How to handle concept drift in workloads?
Focus: Unified tracing across languages/platforms
Enable tracing from:
- C++ core engine
- Python client SDKs
- JavaScript web clients
- Mobile applications
Research Questions:
- How to propagate context across boundaries?
- Can we standardize trace formats?
- What's the overhead of polyglot tracing?
Breaking Changes: None expected (additive)
New APIs:
context->replaceLogger(new_logger);
context->replaceMetrics(new_metrics);Adoption Steps:
- Enable replacement telemetry in non-production environment.
- Run swap stress profile with representative production traffic.
- Promote with rollback guardrails enabled.
Breaking Changes: anticipated API shape changes
Old API:
metrics->incrementCounter("counter_name");
metrics->recordHistogram("histogram_name", value);New API:
metrics->counter("counter_name").increment();
metrics->histogram("histogram_name").record(value);Adoption Steps:
- Inventory all callsites using legacy metric methods.
- Prepare codemod/lint rule for builder-style calls.
- Roll out per module behind compatibility switch.
Breaking Changes: link configuration changes expected
Old CMake:
target_link_libraries(my_app themis-core)New CMake:
target_link_libraries(my_app
themis-logging
themis-tracing
themis-metrics
themis-caching
)Adoption Steps:
- Introduce module-level target mapping for granular concerns libraries.
- Validate binary size and startup deltas per build profile.
- Deprecate monolithic link target after migration window.
We welcome contributions in the following areas:
- Additional logger adapters (log4cpp, glog)
- More cache eviction strategies (FIFO, Random)
- Metrics exporter for other backends (InfluxDB, Datadog)
- Documentation improvements and examples
- Contextual logging framework
- Span pool for tracer optimization
- Configuration hot-reload
- Lock-free metrics implementation
- Distributed tracing correlation
- ML-based cache prediction
- Privacy-preserving logging
Contribution Guide: See CONTRIBUTING.md
Have ideas for core module improvements? Open an issue or discussion:
- π‘ Feature requests: GitHub Issues
- π¬ Design discussions: GitHub Discussions
- π Bug reports: GitHub Issues
Last Updated: 2026-05-31 Review Cadence: monthly backlog review
-
Unit tests (β₯ 90 % line coverage):
ConcernsContext::resolve<T>()under concurrent access (β₯ 16 threads);AdapterRegistryvalidation rejection paths;CircuitBreakerstate machine (closed β open β half-open β closed) - Integration tests: full server startup with all production adapters registered; hot-swap of logger and metrics adapters under load (1 000 req/s synthetic traffic); verify zero dropped requests during swap
- Fault injection tests: simulate adapter failures at rates 10 %, 50 %, 100 %; verify circuit breaker opens within the configured threshold (default: 5 consecutive failures) and closes after the reset timeout
- Distributed cache tests (Docker Compose Redis): cluster-wide cache invalidation propagates to all nodes within 500 ms; Redis failover handled gracefully with fallback to no-cache path
-
Property-based tests: randomised adapter registration/deregistration sequences;
ConcernsContextmust never deadlock or return a dangling handle -
CI coverage gate: β₯ 88 % line coverage enforced; race detector (
-fsanitize=thread) enabled in CI
-
ConcernsContext::resolve<T>()under 32-thread contention: β€ 1 Β΅s median, β€ 10 Β΅s p99 - Adapter hot-swap end-to-end (register new + drain + replace): β€ 100 ms
- Server startup with 32 adapters registered: DI context construction β€ 50 ms
- Circuit breaker
call()overhead (closed state, no failure): β€ 200 ns per invocation - Distributed cache
getround-trip latency (Redis localhost): β€ 1 ms p99 - ObservabilityBus
emit()overhead (fire-and-forget async path): β€ 500 ns per event
-
AdapterRegistryrejects adapters failingAdapterValidator::validate(); malformed or ABI-incompatible adapters never enter the live context - Adapter API version checked at registration; version mismatch produces a structured error and is written to audit log
-
ConcernsContextuses RAII ref-counted handles; no raw pointer sharing across module boundaries; dangling adapter access impossible by design - Circuit breaker prevents cascading failures: when an adapter is open, requests use the configured fallback (error/stub) immediately without incurring full timeout latency
- Distributed cache keys namespaced per tenant to prevent cross-tenant cache poisoning
- All adapter lifecycle events (register, hot-swap, deregister, circuit-open, circuit-close) written to immutable audit log with timestamp and actor identity
ThemisDB 1.9.0-beta Β· Home Β· Module-Index Β· GitHub Β· Issues
ThemisDB 1.9.0-beta Β· Home Β· Wiki-Index Β· Module-Index Β· FAQ Β· Quick-Reference Β· GitHub Β· Issues Β· Discussions Β· License
- Batch Operations
- Best Practices
- CRUD Tutorial
- Custom Document Ingestion
- Getting Started Tutorial
- Interactive Examples
- Schema Design
- Video Tutorials
- AQL Reference
- AQL Examples
- AQL Overview
- AQL Feature Roadmap
- AQL Geospatial Guide
- AQL LLM Migration Guide
- AQL API
- AQL Grammar (EBNF)
- AQL Root Overview
- AQL Examples (root)
- API Reference
- API Module README
- OpenAPI Overview
- Client SDK Overview
- SDK Overview
- Operations
- Operations Overview
- Operations Runbook
- Operations Handbook
- ThemisCtl Admin Guide
- Pipeline E2E SOPs
- Deploy Overview
- Docker Overview
- Docker Hub README
- Helm Overview
- Packaging Overview
- Operator Overview
- Security Policy
- Production Hardening Checklist
- Security Hardening Guide
- Encryption Key Management
- Access Control Framework
- Zero Trust Policy
- API Authentication & Authorization
- HSM Production Setup
- PKCS11 Integration
- DSGVO / SOC2 Checklist
- Access Model Runbooks
- Access Model Dashboard
- Maturity Automation Runbook
- Access Review Automation
- Access Model Dashboard
- Access Model Runbooks
- Rights Revocation
- Dr Checklists
- Dr Testing
- Incident Response Playbook
- Incident Response Testing
- GPU Oom Recovery
- Grammar Debugging
- Metrics Scrape Troubleshooting
- Model Swap Procedure
- Quota Tuning
- Subagent Deployment
- Logging Configuration
- Content Model
- Crypto & Keys
- Feature Flags Reference
- Modular Architecture Roadmap
- Modularization Guide
- Module Architecture Index
- PostgreSQL Wire Protocol
- Query Scheduling
- Raft Consensus Design
- Resource Pooling
- Source Directory Guide
- Unified Access Model
- E1 001 Layered Retrieval Design
- E1 002 Ann Abstraction Strategy
- E1 003 Tensor Summary Types
- E1 004 Lora Package Distinction
- E1 005 Model Switch Compatibility
- E1 006 Federated Tensor Summaries
- E2 001 Evaluation Framework Design
- E2 002 Hardware Profile Strategy
- E2 003 Query Planner Routing Model
- E2 004 Approximation Governance Rules
- E2 005 Cross Layer Fallback Confidence Policy
- E3 001 Distributed Tensor Design
- E3 002 Manifest Coordination Strategy
- E3 003 Recovery And Erasure Choice
- E3 004 Tensor Fabric Infrastructure
- Contributing
- Contributing (root)
- Code of Conduct
- Support
- Maintainers
- CTest Guide
- Build Quick Reference
- Developer Wiki Index
- Build / Test / CI
- Module Index
- Branching Strategy
- Disabled Stub Policy
- Docs PR Policy
- GA Promotion Sign Off
- Github Milestones Setup
- Maturity Claim Verification Checklist
- Maturity Evidence Registry
- Merge Gate Bot Config
- Merge Gate Status Live
- Phase 1 Closure Report
- Phase Closure Policy
- Phase Dependency Graph
- Phase3 Enforcement Runbook
- Plugin Submodule Rollback
- PR Version Targeting
- PR Version Targeting Backfill
- Production Ready 2026 Delivery Plan
- Query Module Status
- Readme
- Release Promotion Gate Policy
- Release Validation Checklist
- Security Module 5671 Evidence Summary
- Sharding P6 Residual Risk Acceptance
- Sourcecode Compliance Governance
- Updates Development Status Sign Off
- Wave C Implementation Complete
- Blob Storage
- Cuda
- Ethics Ai
- Exporters
- Huggingface
- Image Analysis
- Importers
- RPC
- Scraper
- Themisdb Ai Watermark Detector
- User Storage Encrypted
- Chimera Architecture
- Chimera Future
- Chimera Readme
- Chimera Roadmap
- Covina Fastapi Ingestion Architecture
- Covina Fastapi Ingestion Future
- Covina Fastapi Ingestion Roadmap
- Vcc Base Architecture
- Vcc Base Future
- Vcc Base Roadmap
- Vcc Clara Ingestion Architecture
- Vcc Clara Ingestion Future
- Vcc Clara Ingestion Roadmap
- Vcc Veritas Architecture
- Vcc Veritas Future
- Vcc Veritas Roadmap
- 01 Hello World
- 02 Todo App
- 03 Contact Manager
- 04 Inventory System
- 05 Time Series Monitor
- 06 Graph Social Network
- 07 Vector Search Documents
- 08 Dms Erp System
- 09 Iot Sensor Network
- 10 Drone Image Analysis
- 11 Blog Wiki
- 12 Expense Tracker
- 13 Recipe Manager
- 14 Ecommerce Catalog
- 15 Event Management
- 16 Kanban Board
- 17 Crm
- 18 Realtime Chat
- 19 Recommendation Engine
- 20 Smart Home
- 21 Coding Platform
- 22 AQL Diagram Tool
- 23 Traveling Salesman
- 24 Moral Philosophy Debates
- API Versioning
- Distributed Sharding
- Feedback Plugins
- Geo
- Gnn
- Image Analysis
- Legal Lora Training
- LLM
- Lora Sync
- Migration
- Nlp
- Performance
- Railway
- Replication
- Rope Visualization
- Sample Product Config
- Security
- Client SDK Overview
- Quickstart
- Sdk Enhancements
- Sdk Implementation Summary
- Test Suite Readme
- Go
- Java
- Javascript
- Php
- Python
- Ruby
- Rust
- Typescript
- 01 Grundlegende Operationen
- 02 AQL Queries
- 03 Graph Daten
- 04 Multimodell Anwendung
- 01 Quickstart Guide
- 02 AQL Referenz Kurzuebersicht
- 03 Datenmodellierung Guide
- 04 Uebungsaufgaben
- 05 Best Practices Guide
- Training Documents
- Training Overview
- 01 Einfuehrung Und Uebersicht
- 02 Datenmodelle Und Architektur
- 03 AQL Abfragesprache
- 04 Installation Und Setup
- 05 Anwendungsbeispiele
- Training Presentations
- Dependencies Readme
- Processmonitor Readme
- Themis.admintools.shared Readme
- Themis.aqlquerybuilder Readme
- Themis.aqlquerybuilder Roadmap
- Themis.auditlogviewer Readme
- Themis.auditlogviewer Roadmap
- Themis.classificationdashboard Readme
- Themis.classificationdashboard Roadmap
- Themis.compliancereports Readme
- Themis.compliancereports Roadmap
- Themis.gisviewer.controlpanel Readme
- Themis.gisviewer.controlpanel Roadmap
- Themis.impactanalysisviewer Readme
- Themis.impactanalysisviewer Roadmap
- Themis.ingestiontool Readme
- Themis.ingestiontool Roadmap
- Themis.keyrotationdashboard Readme
- Themis.keyrotationdashboard Roadmap
- Themis.piimanager Readme
- Themis.piimanager Roadmap
- Themis.retentionmanager Readme
- Themis.retentionmanager Roadmap
- Themis.sagaverifier Readme
- Themis.sagaverifier Roadmap
- Themis.usbadmintool Readme
- Themis.usbadmintool Roadmap
- CI Readme
- CI Roadmap
- Compiler Diagnostics Readme
- Compiler Diagnostics Roadmap
- Completion Readme
- Copilot Ollama Router Readme
- Copilot Ollama Router Roadmap
- Gnn Readme
- Gnn Roadmap
- Rope Visualizer Readme
- Rope Visualizer Roadmap
- Tco Calculator Readme
- Tco Calculator Roadmap
- Tests Readme
- Tests Roadmap
- Themis Config Wx Readme
- Themis Docs Builder Readme
- Wikipedia Ingestion Readme