orchestrata_ultimate.kernel.performance._common
Reference › orchestrata_ultimate › kernel › performance › _common
Shared primitives of the performance package: the module logger, the named default constants for caches, pools, batching, backpressure, clustering and autoscaling, and the _utc_now time helper. It imports nothing from the project. cluster, manager, metrics, resources and scaling take their defaults from here.
At a glance
| Source | src/orchestrata_ultimate/kernel/performance/_common.py |
| Lines of code | 70 |
| Classes | 0 |
| Functions | 1 |
| Imports (internal) | none |
| Imported by | orchestrata_ultimate.kernel.performance, orchestrata_ultimate.kernel.performance.cluster, orchestrata_ultimate.kernel.performance.manager, orchestrata_ultimate.kernel.performance.metrics, orchestrata_ultimate.kernel.performance.resources, orchestrata_ultimate.kernel.performance.scaling |
| Tests that import it | none |
Class diagram
No classes; see Functions.
Dependency diagram
API
Functions
| Function | Signature | Summary |
|---|---|---|
_utc_now |
_utc_now() -> datetime |
Get current UTC time with timezone info. |
Source
# mypy: ignore-errors
"""Shared performance primitives: logger, constants, time helper."""
import logging
from datetime import UTC, datetime
from typing import TypeVar
_logger = logging.getLogger(__name__)
T = TypeVar("T")
LATENCY_TRACKER_MAX_SAMPLES = 10000
CACHE_DEFAULT_MAX_SIZE = 1000
CACHE_DEFAULT_TTL_SECONDS = 300.0
CONNECTION_POOL_DEFAULT_MAX_SIZE = 10
CONNECTION_POOL_DEFAULT_MAX_IDLE_SECONDS = 300.0
BATCH_PROCESSOR_DEFAULT_MAX_SIZE = 100
BATCH_PROCESSOR_DEFAULT_MAX_WAIT_MS = 10.0
BACKPRESSURE_WARNING_THRESHOLD = 0.7
BACKPRESSURE_CRITICAL_THRESHOLD = 0.9
BACKPRESSURE_SHEDDING_THRESHOLD = 0.95
CONSISTENT_HASH_DEFAULT_REPLICAS = 100
CLUSTER_DEFAULT_HEARTBEAT_INTERVAL_SECONDS = 5.0
AUTOSCALER_DEFAULT_MAX_INSTANCES = 10
AUTOSCALER_DEFAULT_SCALE_UP_THRESHOLD = 0.8
AUTOSCALER_DEFAULT_SCALE_DOWN_THRESHOLD = 0.3
AUTOSCALER_DEFAULT_COOLDOWN_SECONDS = 300.0
AUTOSCALER_DECISIONS_HISTORY_SIZE = 100
AUTOSCALER_RECENT_DECISIONS_DEFAULT_COUNT = 10
def _utc_now() -> datetime:
"""Get current UTC time with timezone info."""
return datetime.now(UTC)