Adds the scripts used to size the connection pool and validate fleet polling under load: burst arrival and mixed workload drivers, pool and resource samplers, a UI probe, host seed/drop SQL, and a gevent Dockerfile. Hosts are addressed by compose service name (api:5001) rather than a local path, so the harness runs against any stack rather than one machine. loadtest_token.py mints a scoped collector token named LOADTEST and prints the secret once, then revokes only that token by name so a real collector token is never touched. envkeyfallback is false, so the harness needs a genuine managed token rather than an env key.
23 lines
857 B
Python
23 lines
857 B
Python
"""Force SQLAlchemy pool sizing for a pool-comparison run.
|
|
|
|
WHY this exists: shopdb/config.py does not read pool size from the environment,
|
|
so a test container cannot be pointed at a different pool without a code change.
|
|
This patches Config.SQLALCHEMY_ENGINE_OPTIONS at import time, before create_app
|
|
builds the engine, purely so a bigger pool can be MEASURED before deciding
|
|
whether to make it permanent.
|
|
|
|
Not for production use. Mounted into a throwaway container as sitecustomize.py,
|
|
which Python imports automatically at startup.
|
|
"""
|
|
import os
|
|
|
|
from shopdb.config import Config
|
|
|
|
_size = int(os.environ.get('FORCE_POOL_SIZE', '5'))
|
|
_overflow = int(os.environ.get('FORCE_MAX_OVERFLOW', '10'))
|
|
|
|
_options = dict(Config.SQLALCHEMY_ENGINE_OPTIONS)
|
|
_options['pool_size'] = _size
|
|
_options['max_overflow'] = _overflow
|
|
Config.SQLALCHEMY_ENGINE_OPTIONS = _options
|