Skip to content

guides_enterprise_build

GitHub Actions edited this page Jan 2, 2026 · 1 revision

category: "πŸ”¨ Build/Deployment" version: "v1.3.0" status: "βœ…" date: "22.12.2025"

πŸ”¨ Enterprise Scalability - Build & Deployment Guide

Guide for building and deploying ThemisDB at enterprise scale.

πŸ“‹ Inhaltsverzeichnis


πŸ“‹ Übersicht

Build and deployment guidance for enterprise environments with special focus on scalability features.

Stand: 22. Dezember 2025
Version: 1.3.0
Kategorie: πŸ”¨ Build/Deployment


✨ Features

  • 🏒 Enterprise Features - Sharding, Replication, Distributed Transactions
  • πŸ”’ Security - mTLS, RBAC, encryption at rest
  • πŸ“Š Scalability - Horizontal scaling with Raft consensus
  • ⚑ Performance - Multi-shard query optimization

πŸš€ Quick Start


Status

βœ… Implementation: 100% Complete
⚠️ Build: Requires VS Developer Command Prompt


Quick Start

Option 1: Visual Studio Developer Command Prompt (Empfohlen)

REM 1. Γ–ffne "x64 Native Tools Command Prompt for VS 2022"
REM    Start Menu β†’ Visual Studio 2022 β†’ x64 Native Tools Command Prompt

REM 2. Navigate to project
cd C:\VCC\themis

REM 3. Build mit Enterprise Features
.\scripts\build_enterprise.cmd

REM 4. Tests ausfΓΌhren
build-msvc-ninja-debug\themis_tests.exe --gtest_filter="*Enterprise*" --gtest_brief=1

Option 2: PowerShell mit VS-Umgebung

# 1. VS-Umgebung laden
& "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat"

# 2. Build
cd C:\VCC\themis
cmake --build build-msvc-ninja-debug --target themis_tests

# 3. Tests
.\build-msvc-ninja-debug\themis_tests.exe --gtest_filter="*Enterprise*"

Option 3: CMake GUI

  1. Γ–ffne CMake GUI
  2. Source: C:\VCC\themis
  3. Build: C:\VCC\themis\build-msvc-ninja-debug
  4. Configure β†’ Generate
  5. Open Project in Visual Studio
  6. Build β†’ Build Solution

Problem: Standard Library Headers nicht gefunden

Symptom:

fatal error C1083: Datei (Include) kann nicht geΓΆffnet werden: "atomic"
fatal error C1083: Datei (Include) kann nicht geΓΆffnet werden: "string"

Ursache:

MSVC benΓΆtigt spezielle Umgebungsvariablen fΓΌr C++ Standard Library Includes:

  • INCLUDE - C++ Header Pfade
  • LIB - Library Pfade
  • PATH - Compiler Pfade

LΓΆsung:

A) Verwende VS Developer Command Prompt:

REM Start Menu suchen nach:
"x64 Native Tools Command Prompt for VS 2022"

B) Oder lade Umgebung in PowerShell:

# vcvars64.bat ausfΓΌhren
cmd /c "`"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat`" && set" | ForEach-Object {
    if ($_ -match "^(.*?)=(.*)$") {
        [Environment]::SetEnvironmentVariable($matches[1], $matches[2])
    }
}

C) Oder verwende CMake in Visual Studio:

  • File β†’ Open β†’ CMake β†’ C:\VCC\themis\CMakeLists.txt
  • Build β†’ Build All

Implementierte Features

1. Token Bucket Rate Limiter

// include/server/rate_limiter_v2.h
// src/server/rate_limiter_v2.cpp
TokenBucketRateLimiter limiter(config);
if (limiter.tryAcquire(1, Priority::NORMAL)) {
    // Process request
}

2. Per-Client Rate Limiter

PerClientRateLimiter limiter(config);
if (limiter.allowRequest(client_id, 1, Priority::NORMAL)) {
    // Process request
}

3. Load Shedder

// include/server/load_shedder.h
// src/server/load_shedder.cpp
LoadShedder shedder(config);
shedder.updateLoad(cpu, memory, queue_depth);
if (shedder.shouldReject(priority)) {
    return HTTP 503;
}

4. HTTP Client Pool

// include/utils/http_client_pool.h
// src/utils/http_client_pool.cpp
HTTPClientPool pool(config);
auto future = pool.post("https://api.example.com", body);
auto response = future.get();

5. Batch CRUD Endpoint

POST /entities/batch
{
  "operations": [
    {"op": "put", "key": "users:u1", "blob": "{...}"},
    {"op": "delete", "key": "orders:o123"}
  ]
}

Verifikation ohne Build

Auch ohne erfolgreichen Build kΓΆnnen Sie die Implementierung verifizieren:

1. Code Review

# PrΓΌfe implementierte Headers
Get-Content C:\VCC\themis\include\server\rate_limiter_v2.h | Select-String "class Token"
Get-Content C:\VCC\themis\include\server\load_shedder.h | Select-String "class Load"
Get-Content C:\VCC\themis\include\utils\http_client_pool.h | Select-String "class Beast"

# PrΓΌfe Implementierungen
Get-Content C:\VCC\themis\src\server\rate_limiter_v2.cpp | Measure-Object -Line
Get-Content C:\VCC\themis\src\server\load_shedder.cpp | Measure-Object -Line
Get-Content C:\VCC\themis\src\utils\http_client_pool.cpp | Measure-Object -Line

# PrΓΌfe Tests
Get-Content C:\VCC\themis\tests\test_enterprise_scalability.cpp | Select-String "TEST\("

2. Datei-Statistiken

Get-ChildItem C:\VCC\themis\include\server\*rate_limiter*.h, C:\VCC\themis\include\server\load_shedder.h, C:\VCC\themis\include\utils\http_client_pool.h | 
    Select-Object Name, Length, LastWriteTime

3. CMake-Konfiguration prΓΌfen

# PrΓΌfe ob Features in CMakeLists.txt aktiviert sind
Get-Content C:\VCC\themis\CMakeLists.txt | Select-String "load_shedder|http_client_pool"

Dokumentation

User Guides:

  • docs/ENTERPRISE_SCALABILITY.md - Feature-Übersicht mit Beispielen
  • docs/HTTP_CLIENT_POOL_COMPLETE.md - HTTP Client Pool Details
  • docs/performance/ENTERPRISE_SCALABILITY_STRATEGY.md - Architektur & Strategie

Implementation Details:

  • docs/ENTERPRISE_IMPLEMENTATION_STATUS.md - Status & Roadmap

Code:

include/
  server/
    rate_limiter_v2.h          (~160 LOC)
    load_shedder.h              (~60 LOC)
  utils/
    http_client_pool.h         (~120 LOC)

src/
  server/
    rate_limiter_v2.cpp        (~200 LOC)
    load_shedder.cpp            (~60 LOC)
  utils/
    http_client_pool.cpp       (~320 LOC)

tests/
  test_enterprise_scalability.cpp (~450 LOC)

Total: ~1,370 Lines of Code


Alternative: Docker Build

Falls VS-Umgebung Probleme macht, verwende Docker:

# Dockerfile.enterprise
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022

# Install VS Build Tools
RUN choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"

WORKDIR /themis
COPY . .

# Build
RUN cmd /c "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat && cmake --build build-msvc-ninja-debug --target themis_tests"

# Test
RUN build-msvc-ninja-debug\themis_tests.exe --gtest_filter="*Enterprise*"

Build:

docker build -f Dockerfile.enterprise -t themis-enterprise .

CI/CD Integration

GitHub Actions:

name: Enterprise Features Build

on: [push, pull_request]

jobs:
  build-enterprise:
    runs-on: windows-latest
    
    steps:
    - uses: actions/checkout@v2
    
    - name: Setup VS Environment
      uses: microsoft/setup-msbuild@v1
    
    - name: Build
      run: |
        call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
        cmake --build build-msvc-ninja-debug --target themis_tests
      shell: cmd
    
    - name: Test
      run: |
        build-msvc-ninja-debug\themis_tests.exe --gtest_filter="*Enterprise*" --gtest_output=xml:test-results.xml
    
    - name: Upload Results
      uses: actions/upload-artifact@v2
      with:
        name: test-results
        path: test-results.xml

Performance Testing

k6 Load Test:

// tests/load/enterprise_load_test.js
import http from 'k6/http';
import { check, sleep } from 'k6';

export let options = {
  stages: [
    { duration: '2m', target: 100 },   // Normal load
    { duration: '5m', target: 100 },
    { duration: '2m', target: 200 },   // Peak load
    { duration: '5m', target: 200 },
    { duration: '2m', target: 1000 },  // Stress test
    { duration: '3m', target: 1000 },
    { duration: '2m', target: 0 },     // Ramp down
  ],
  thresholds: {
    http_req_duration: ['p(95)<500'],   // 95% unter 500ms
    http_req_failed: ['rate<0.01'],     // <1% Fehlerrate
  },
};

export default function () {
  // Test Batch Endpoint
  const payload = JSON.stringify({
    operations: Array.from({length: 100}, (_, i) => ({
      op: 'put',
      key: `test:${i}`,
      blob: JSON.stringify({value: i})
    }))
  });
  
  const response = http.post(
    'http://localhost:18765/entities/batch',
    payload,
    { headers: { 'Content-Type': 'application/json' } }
  );
  
  check(response, {
    'status is 200': (r) => r.status === 200,
    'batch succeeded': (r) => JSON.parse(r.body).succeeded > 0,
  });
  
  sleep(0.1);
}

Run:

k6 run tests/load/enterprise_load_test.js

Production Deployment Checklist

  • Build in VS Developer Command Prompt erfolgreich
  • Alle Enterprise Tests bestanden (19 Tests)
  • Load Test mit k6 durchgefΓΌhrt (>50k req/s)
  • Rate Limiting konfiguriert (capacity, refill_rate)
  • Load Shedding aktiviert (thresholds)
  • HTTP Client Pool konfiguriert (max_connections)
  • Monitoring aktiviert (/metrics endpoint)
  • Dokumentation aktualisiert
  • Performance Targets erreicht (siehe Strategy Doc)

Support & Troubleshooting

HΓ€ufige Probleme:

1. "atomic" nicht gefunden

  • LΓΆsung: VS Developer Command Prompt verwenden

2. Tests hΓ€ngen bei HTTP Requests

  • LΓΆsung: Network-Tests ΓΌberspringen wenn httpbin.org nicht erreichbar
  • Tests haben automatisches Skip bei Timeout

3. SSL/TLS Fehler

  • LΓΆsung: OpenSSL Zertifikate installieren
  • vcpkg install openssl

4. Linker Fehler

  • LΓΆsung: Alle Dependencies neu installieren
  • vcpkg install boost-beast openssl

NΓ€chste Schritte

  1. Build in korrekter Umgebung durchfΓΌhren:

    REM x64 Native Tools Command Prompt
    cd C:\VCC\themis
    .\scripts\build_enterprise.cmd
  2. Tests ausfΓΌhren:

    build-msvc-ninja-debug\themis_tests.exe --gtest_filter="*Enterprise*"
  3. Load Testing:

    k6 run tests/load/enterprise_load_test.js
  4. Integration in HTTP Server:

    • Rate Limiter Middleware hinzufΓΌgen
    • Load Shedder in Request Pipeline
    • HTTP Client Pool fΓΌr Embedding APIs
  5. Monitoring Setup:

    • Prometheus /metrics endpoint
    • Grafana Dashboard
    • Alerting Rules

Status: βœ… Implementation Complete - Ready for VS Environment Build
Last Updated: 2025-11-30
Version: 1.0

ThemisDB Wiki

🏠 Overview

πŸš€ Getting Started

πŸ“– Tutorials

πŸ“— User Guide

βš™οΈ Operations & Security

πŸ“Ÿ Ops Runbooks

πŸ—οΈ Architecture

πŸ“ ADRs

πŸ”§ Contributing

πŸ“‹ Governance

πŸ” Audit

🧩 Plugins

πŸ”Œ Adapters

πŸ’‘ Examples

πŸ“¦ Client SDKs

πŸŽ“ Training

πŸ› οΈ Tools

πŸ€– Developer LLM Wiki

Clone this wiki locally