Complete reference for all 30+ runtime parameters — system mode profiles, cache tuning, DB pool settings, usage log batching, and price source configuration.
Application parameters control the runtime behavior of The Trinity Beast system. All parameters are stored in the application_parameters table in Aurora (the authoritative source) and cached in ElastiCache as the app:config hash for fast reads.
application_parameter_interval_minutes (default: every 5 minutes).--force-new-deployment) to take effect. See the table below.⚠️ Restart Required vs Hot-Reloadable
| 🔄 Hot-Reloadable (no restart) | 🔁 Restart Required |
|---|---|
cache_ttl_seconds, config_poll_interval_secondsqps, burst, log_levelsqs_batch_size, sqs_flush_ms, sqs_buffer_size, sqs_timeout_msdb_max_open_conns, db_max_idle_conns, db_conn_max_lifetime_minutes, db_conn_max_idle_time_minutesadmin_api_key, demo_api_keyprewarm_assets_list, prewarm_interval_minutes, prewarm_delay_mscoinbase_prewarm_assets, gemini_prewarm_assets, kraken_prewarm_assetsgateio_prewarm_assets, bybit_prewarm_assets, okx_prewarm_assetsprice_source_* (all price source params)usage_log_* (all batch/flush params)adaptive_* (all governor params)payment_grace_period_days, usage_warning_green_pct, usage_warning_yellow_pct, usage_warning_red_pctcache_max_retries
|
http_read_timeout_secondshttp_write_timeout_secondshttp_idle_timeout_secondshttp_read_header_timeout_secondshttp_max_header_bytesudp_read_buffer_bytesudp_write_buffer_bytesudp_reader_goroutinesudp_max_concurrent_lpoudp_max_concurrent_lrsudp_workers_per_socketudp_batch_sizeudp_pre_serialize_responsescache_pool_sizecache_min_idle_connscache_dial_timeout_mscache_read_timeout_mscache_write_timeout_ms
|
Why? Hot-reloadable parameters update the Config struct in memory and are read on every request. Restart-required parameters are consumed once when the HTTP server, UDP listeners, or ElastiCache client are created at startup — Go does not allow reconfiguring these after creation.
-- Aurora: authoritative source
SELECT key, value FROM application_parameters;
-- ElastiCache: fast cache (app:config hash)
HGETALL app:config
-- Update a parameter (takes effect within one poll cycle)
INSERT INTO application_parameters (key, value)
VALUES ('cache_ttl_seconds', '30')
ON CONFLICT (key) DO UPDATE SET value = '30';
The /admin/system-mode?mode=<profile_name> endpoint applies a predefined profile from the application_parameter_profiles table in Aurora. Profiles can be added or modified via SQL without code deploys. There are currently 10 profiles covering production, demo, debug, and stress testing across all protocol/topology combinations.
Note: System mode also updates the demo API key's rate_limit_qps and burst_limit in the api_keys table and invalidates the demo key cache. QPS and Burst values shown below are applied to the demo API key.
Key tuning rules applied across all profiles:
db_max_idle always equals db_max_open — prevents connection churn under load (p99 fix: 1,266ms → 8.9ms)cache_min_idle ≈ 33% of cache_pool_size — optimal pre-warm ratiocache_pool_size is always a multiple of 3 — one pool per containerdb_max_open=180 — headroom for LRS report queries alongside LPO writes| Parameter | demo | debug | fresh-price |
|---|---|---|---|
| Purpose | Live demos | Troubleshooting | Production |
qps | 3 | 3 | 1,000 |
burst | 3 | 3 | 1,000 |
log_level | info | debug | error |
cache_ttl | 30 | 60 | 13 |
config_poll | 90 | 30 | 300 |
sqs_batch_size | 10 | 10 | 10 |
sqs_flush_ms | 500 | 500 | 100 |
sqs_buffer_size | 10,000 | 10,000 | 50,000 |
sqs_timeout_ms | 5,000 | 5,000 | 3,000 |
db_max_open | 30 | 30 | 150 |
db_max_idle | 30 | 30 | 150 |
db_conn_lifetime_min | 10 | 10 | 10 |
db_conn_idle_min | 5 | 5 | 5 |
cache_pool_size | 150 | 150 | 600 |
cache_min_idle | 51 | 51 | 201 |
cache_max_retries | 3 | 3 | 1 |
cache_dial_ms | 3,000 | 3,000 | 500 |
cache_read_ms | 3,000 | 3,000 | 500 |
cache_write_ms | 3,000 | 3,000 | 500 |
| Parameter | stress | tcp-direct | tcp-alb | udp-direct | udp-nlb |
|---|---|---|---|---|---|
| Topology | Baseline | 1 node | 3 nodes | 1 node | 3 nodes |
qps | 100K | 100K | 100K | 100K | 100K |
burst | 100K | 100K | 100K | 100K | 100K |
log_level | error | error | error | error | error |
cache_ttl | 300 | 300 | 300 | 300 | 300 |
sqs_batch_size | 10 | 10 | 10 | 10 | 10 |
sqs_flush_ms | 50 | 50 | 50 | 50 | 50 |
sqs_buffer_size | 100,000 | 100,000 | 100,000 | 100,000 | 100,000 |
sqs_timeout_ms | 3,000 | 3,000 | 3,000 | 3,000 | 3,000 |
db_max_open | 150 | 150 | 150 | 150 | 150 |
db_max_idle | 150 | 150 | 150 | 150 | 150 |
db_conn_idle_min | 10 | 10 | 10 | 10 | 10 |
cache_pool_size | 2,997 | 2,997 | 1,998 | 2,997 | 1,998 |
cache_min_idle | 999 | 999 | 666 | 999 | 666 |
| Parameter | combined-direct | combined-alb |
|---|---|---|
| Topology | 1 node, LPO + LRS | 3 nodes, LPO + LRS |
qps | 100K | 100K |
burst | 100K | 100K |
log_level | error | error |
cache_ttl | 300 | 300 |
sqs_batch_size | 10 | 10 |
sqs_flush_ms | 50 | 50 |
sqs_buffer_size | 100,000 | 100,000 |
sqs_timeout_ms | 3,000 | 3,000 |
db_max_open | 180 | 180 |
db_max_idle | 180 | 180 |
db_conn_idle_min | 10 | 10 |
cache_pool_size | 2,997 | 1,998 |
cache_min_idle | 999 | 666 |
Values highlighted in color differ from the baseline stress profile. UDP profiles use smaller batches and longer flush intervals to free CPU for packet processing.
| Parameter | lrs-direct | lrs-alb |
|---|---|---|
| Topology | 1 node, LRS only | 3 nodes, LRS only |
qps | 100K | 100K |
burst | 100K | 100K |
log_level | error | error |
cache_ttl | 300 | 300 |
sqs_batch_size | 10 | 10 |
sqs_flush_ms | 50 | 50 |
sqs_buffer_size | 100,000 | 100,000 |
sqs_timeout_ms | 3,000 | 3,000 |
db_max_open | 180 | 180 |
db_max_idle | 180 | 180 |
db_conn_idle_min | 10 | 10 |
cache_pool_size | 2,997 | 1,998 |
cache_min_idle | 999 | 666 |
cache_read_ms | 1,000 | 1,000 |
LRS profiles use db_max_open=180 for read-heavy report queries and cache_read_ms=1,000 because reports fetch more data per ElastiCache call than single price lookups. Write volume is low (report_usage_logs only), so flush intervals are relaxed.
| Parameter | combined-direct | combined-alb |
|---|---|---|
| Topology | 1 node, LPO + LRS | 3 nodes, LPO + LRS |
qps | 100K | 100K |
burst | 100K | 100K |
log_level | error | error |
cache_ttl | 300 | 300 |
sqs_batch_size | 10 | 10 |
sqs_flush_ms | 50 | 50 |
sqs_buffer_size | 100,000 | 100,000 |
sqs_timeout_ms | 3,000 | 3,000 |
db_max_open | 180 | 180 |
db_max_idle | 180 | 180 |
db_conn_idle_min | 10 | 10 |
cache_pool_size | 2,997 | 1,998 |
cache_min_idle | 999 | 666 |
Combined profiles use db_max_open=180 to give LRS report queries headroom alongside LPO batch writes. This is the production configuration (APP_REPORT_SERVER).
| Parameter | r17-lb-all | r17-tcp-direct | r17-udp-direct | r17-all-direct |
|---|---|---|---|---|
| Phase | 1: Load Balancers | 2: TCP Direct | 3: UDP Direct | 4: All Direct |
| Protocols | All 4 via ALB+NLB | TCP-LPO only | UDP-LPO only | All 4 direct |
db_max_open | 150 | 150 | 150 | 180 |
sqs_batch_size | 10 | 10 | 10 | 10 |
sqs_flush_ms | 50 | 50 | 50 | 50 |
sqs_buffer_size | 100,000 | 100,000 | 100,000 | 100,000 |
sqs_timeout_ms | 3,000 | 3,000 | 3,000 | 3,000 |
cache_pool_size | 1,998 | 2,997 | 2,997 | 2,997 |
cache_read_ms | 1,000 | 500 | 500 | 1,000 |
udp_reader_goroutines | 8 | 8 | 8 | 8 |
udp_read_buffer_mb | 32 | 32 | 32 | 32 |
udp_workers_per_socket | 128 | 128 | 128 | 128 |
udp_batch_size | 32 | 32 | 32 | 32 |
udp_pre_serialize | true | true | true | true |
Run 17 profiles include v8 UDP tuning columns. All phases use SO_REUSEPORT (8 sockets), recvmmsg batch reads (32 datagrams/syscall), 32 MB socket buffers, and pre-serialized response cache. Phase 3 (UDP direct) uses minimal batch/flush settings to maximize CPU for packet processing — this is the 200K+ UDP chase.
All 33 application parameters recognized by the system. Parameters marked with mode columns are updated by the /admin/system-mode endpoint.
| Parameter Key | Type | Default | Demo | Perf | Debug | Description |
|---|---|---|---|---|---|---|
admin_api_key |
string | "" |
— | — | — | Admin API key for X-Admin-Key header authentication SECRET |
application_parameter_interval_minutes |
int | 5 |
— | — | — | How often (minutes) to reload all parameters from Aurora |
cache_ttl_seconds |
int | 60 |
30 | 9 | 60 | How long a cached price is considered fresh (seconds) |
cacheRetentionDays |
int | 93 |
— | — | — | Days to retain cached data in ElastiCache |
config_poll_interval_seconds |
int | 60 |
90 | 300 | 30 | How often (seconds) to poll for config interval changes |
db_conn_max_idle_time_minutes |
int | 1 |
1 | 5 | 1 | Max time a DB connection can sit idle before being closed |
db_conn_max_lifetime_minutes |
int | 5 |
5 | 10 | 5 | Max lifetime of a DB connection before recycling |
db_max_idle_conns |
int | 30 |
15 | 90 | 15 | Max idle connections in the Aurora connection pool |
db_max_open_conns |
int | 50 |
30 | 180 | 30 | Max open connections to Aurora |
debug_messages |
string | "false" |
— | — | — | DEPRECATED — use log_level=debug instead DEPRECATED |
default_query_limit |
int | 1000 |
— | — | — | Default pagination limit for queries |
demo_api_key |
string | "" |
— | — | — | The public demo API key value (e.g., demo-public-2026-03-01-abc123) |
demo_usage_row_cap |
int | 30 |
— | — | — | Max rows returned for demo usage detail and report-usage detail reports |
demo_summary_row_cap |
int | 300 |
— | — | — | Max rows aggregated for demo usage summary and report-usage summary reports |
usage_warning_threshold_pct |
int | 90 |
— | — | — | Deprecated — replaced by graduated thresholds below. Kept for backward compatibility. |
usage_warning_green_pct |
int | 85 |
— | — | — | When monthly usage reaches this percentage, responses include usage_warning: "green" and status shows ✅🟡. First tier of graduated warnings. |
usage_warning_yellow_pct |
int | 90 |
— | — | — | When monthly usage reaches this percentage, responses include usage_warning: "yellow" and status shows ✅⚠️. Second tier — caution. |
usage_warning_red_pct |
int | 95 |
— | — | — | When monthly usage reaches this percentage, responses include usage_warning: "red" and status shows ✅🔴. Third tier — critical, near limit. |
kraken_prewarm_assets |
string | "nano,sc,lsk,...,flow" |
— | — | — | Kraken WebSocket feed assets (24). See WebSocket Feed Asset Lists section. |
gateio_prewarm_assets |
string | "bnb,trx,...,ftm" |
— | — | — | Gate.io WebSocket feed assets (24). See WebSocket Feed Asset Lists section. |
bybit_prewarm_assets |
string | "ton,wld,...,gala" |
— | — | — | Bybit WebSocket feed assets (24). See WebSocket Feed Asset Lists section. |
okx_prewarm_assets |
string | "kas,tia,...,floki" |
— | — | — | OKX WebSocket feed assets (24). See WebSocket Feed Asset Lists section. |
kraken_prewarm_interval_minutes |
int | 3 |
— | — | — | How often to run Kraken batch prewarm |
kraken_prewarm_offset_seconds |
int | 15 |
— | — | — | Offset from main prewarm to stagger Kraken prewarm |
log_level |
string | "info" |
info | error | debug | Logging level: debug, info, error |
max_cache_size |
int | 10000 |
— | — | — | Maximum entries in the local price cache |
minimum_to_wait |
float | 1.0 |
— | — | — | Minimum wait time (seconds) between requests for rate limiting |
prewarm_assets_list |
string | "btc,eth,sol,doge,xrp,link,dot,ltc,avax,uni,aave" |
— | — | — | Comma-separated list of assets to prewarm via WebSocket and REST |
prewarm_delay_ms |
int | 600 |
— | — | — | Delay between individual asset prewarm requests (ms) |
prewarm_interval_minutes |
int | 10 |
— | — | — | How often to run the main prewarm cycle |
price_source_fallback_on_error |
bool | true |
— | — | — | Whether to try next source on error |
price_source_health_window_sec |
int | 300 |
— | — | — | Time window for source health tracking |
price_source_min_success_rate |
float | 0.85 |
— | — | — | Minimum success rate to consider a source healthy |
price_source_order |
string | "coinbase,kraken,gemini" |
— | — | — | REST fallback source priority order |
price_source_prefer_low_latency |
bool | true |
— | — | — | Whether to prefer lower-latency sources |
price_source_timeouts_ms |
string | {'coinbase':150,'kraken':120,'gemini':200} |
— | — | — | Per-source REST timeout in milliseconds |
price_source_weights |
string | {'coinbase':0.50,'kraken':0.35,'gemini':0.15} |
— | — | — | Source selection weights for weighted routing |
seconds_to_wait |
float | 15.0 |
— | — | — | Seconds to wait before retrying a failed source |
stripe_key |
string | "" |
— | — | — | Stripe API key for payment processing SECRET |
sqs_batch_size |
int | 10 |
10 | 10 | 10 | Messages per SQS SendMessageBatch call (range: 1–10) |
sqs_flush_ms |
int | 100 |
500 | 50 | 500 | SQS producer flush interval in milliseconds |
sqs_buffer_size |
int | 50000 |
10,000 | 100,000 | 10,000 | SQS producer channel buffer capacity |
sqs_timeout_ms |
int | 3000 |
5,000 | 3,000 | 5,000 | Per-batch SQS API call timeout in milliseconds |
udp_workers_per_socket |
int | 128 |
— | — | — | Worker goroutines per UDP socket. v8: configurable (was hardcoded at 128) |
udp_batch_size |
int | 32 |
— | — | — | Datagrams per recvmmsg batch read. 0 disables batching (v7 fallback) |
udp_pre_serialize_responses |
bool | true |
— | — | — | Pre-serialized response cache for UDP cache hits |
Controls log verbosity and diagnostic output. The log_level parameter is the primary control; debug_messages is deprecated but still honored for backward compatibility.
| Parameter | Type | Default | Description |
|---|---|---|---|
log_level |
string | "info" |
Logging level: debug, info, error. Applied immediately via callback — no restart needed. |
debug_messages |
string | "false" |
DEPRECATED. When set to "true", forces log level to debug. Use log_level=debug instead. DEPRECATED |
Controls cache freshness, retention, size limits, and the prewarm cycles that keep the cache warm for popular assets. The main prewarm cycle covers top assets via WebSocket and REST; the Kraken prewarm handles exchange-exclusive assets separately.
| Parameter | Type | Default | Description |
|---|---|---|---|
cache_ttl_seconds |
int | 60 |
How long a cached price is considered fresh (seconds). Lower values mean fresher prices but more REST fallback calls. |
cacheRetentionDays |
int | 93 |
Days to retain cached data in ElastiCache. Entries older than this are eligible for eviction. |
max_cache_size |
int | 10000 |
Maximum entries in the local in-memory price cache (sync.Map). Prevents unbounded memory growth. |
prewarm_assets_list |
string | "btc,eth,sol,...,bat" |
Legacy combined list of assets for the REST prewarm cycle. 24 assets (Coinbase + Gemini lists combined). |
prewarm_interval_minutes |
int | 10 |
How often (minutes) to run the REST prewarm cycle for assets in prewarm_assets_list. |
prewarm_delay_ms |
int | 600 |
Delay (ms) between individual asset prewarm requests. Prevents thundering herd on external APIs. |
Each exchange has its own dedicated asset list. Assets must not overlap between exchanges. All lists are configurable via application parameters — no hardcoding. Changes take effect on the next parameter reload, but require a container restart for the WebSocket connections to re-subscribe.
| Parameter | Exchange | Default (24 assets) | WebSocket Endpoint |
|---|---|---|---|
coinbase_prewarm_assets |
Coinbase | btc,eth,sol,doge,xrp,link,dot,ltc,avax,uni,pepe,xlm,rndr,jasmy,icp,eos,egld,zec,enj,ankr,lrc,skl,coti,rlc |
wss://advanced-trade-ws.coinbase.com |
gemini_prewarm_assets |
Gemini | aave,ada,matic,atom,near,arb,mkr,crv,grt,fil,shib,bat,mana,sand,axs,chz,storj,amp,ren,uma,bond,ctsi,rly,rad |
wss://ws.gemini.com |
kraken_prewarm_assets |
Kraken | nano,sc,lsk,kava,bico,rari,ocean,cfg,cqt,algo,fet,flow,mina,glmr,movr,ksm,astr,phala,nodl,para,kilt,aca,teer,lit |
wss://ws.kraken.com/v2 |
gateio_prewarm_assets |
Gate.io | bnb,trx,apt,inj,op,sui,vet,hbar,ftm,celr,dent,hot,one,reef,win,tfuel,stmx,troy,vite,oax,pundix,ach,bel,chess |
wss://api.gateio.ws/ws/v4/ |
bybit_prewarm_assets |
Bybit | ton,wld,ape,blur,imx,ens,ldo,snx,comp,1inch,sushi,gala,magic,rdnt,hook,id,edu,cyber,arkm,ntrn,mav,sei,woo,agld |
wss://stream.bybit.com/v5/public/spot |
okx_prewarm_assets |
OKX | kas,tia,jup,strk,pyth,w,zro,pendle,ondo,render,wif,floki,people,mask,looks,high,rss3,perp,badger,alcx,fxs,tribe,alpha,dodo |
wss://ws.okx.com:8443/ws/v5/public |
150 assets, 6 exchanges, zero overlap. Each exchange subscribes to 25 unique assets via its own persistent WebSocket connection. Prices are pushed in real-time (sub-second) directly into the in-process sync.Map — zero network calls on the hot path. The source exchange is tracked in every response and usage log via the source field (e.g., coinbase-ws, binance-ws, okx-ws).
Controls the Go database/sql connection pool settings for Aurora Serverless v2. Changes are applied immediately via database.ApplyPoolSettings() after each parameter reload.
| Parameter | Type | Default | Description |
|---|---|---|---|
db_max_open_conns |
int | 50 |
Max open connections to Aurora. Higher values support more concurrent queries but consume more ACUs. |
db_max_idle_conns |
int | 30 |
Max idle connections kept warm in the pool. Should be less than or equal to db_max_open_conns. |
db_conn_max_lifetime_minutes |
int | 5 |
Max lifetime of a DB connection before it is closed and recycled. Prevents stale connections. |
db_conn_max_idle_time_minutes |
int | 1 |
Max time a DB connection can sit idle before being closed. Frees resources during low traffic. |
Usage logs are now sent to SQS via a channel-buffered producer, consumed by the trinity-beast-queued-writer Lambda, and batch-inserted into Aurora. No more direct Aurora writes from the hot path.
| Parameter | Type | Default | Description |
|---|---|---|---|
sqs_batch_size |
int | 10 |
Messages per SQS SendMessageBatch call (range: 1–10) |
sqs_flush_ms |
int | 100 |
SQS producer flush interval in milliseconds |
sqs_buffer_size |
int | 50000 |
SQS producer channel buffer capacity |
sqs_timeout_ms |
int | 3000 |
Per-batch SQS API call timeout in milliseconds |
Controls the REST fallback price source behavior — priority order, per-source timeouts, weighted routing, health tracking, and error handling. These only apply when all WebSocket feeds are stale and the system falls back to REST.
| Parameter | Type | Default | Description |
|---|---|---|---|
price_source_order |
string | "coinbase,kraken,gemini" |
REST fallback source priority order. Sources are tried in this order when fallback is needed. |
price_source_weights |
string | {'coinbase':0.50,'kraken':0.35,'gemini':0.15} |
Source selection weights for weighted routing. Weights should sum to 1.0. |
price_source_timeouts_ms |
string | {'coinbase':150,'kraken':120,'gemini':200} |
Per-source REST timeout in milliseconds. Requests exceeding this timeout are cancelled. |
price_source_fallback_on_error |
bool | true |
Whether to try the next source in price_source_order when the current source returns an error. |
price_source_health_window_sec |
int | 300 |
Time window (seconds) over which source health metrics are tracked. Older data is discarded. |
price_source_min_success_rate |
float | 0.85 |
Minimum success rate (0.0–1.0) to consider a source healthy. Sources below this threshold may be deprioritized. |
price_source_prefer_low_latency |
bool | true |
Whether to prefer lower-latency sources when multiple healthy sources are available. |
Controls rate limiting behavior, the demo API key, and default query pagination.
| Parameter | Type | Default | Description |
|---|---|---|---|
demo_api_key |
string | "" |
The public demo API key value. When set, the system resolves the key's UUID from ElastiCache or Aurora for fast lookups. |
demo_usage_row_cap |
int | 30 |
Max rows returned for demo usage detail and report-usage detail reports. Adjustable at runtime for specific demos. |
demo_summary_row_cap |
int | 300 |
Max rows aggregated for demo usage summary and report-usage summary reports. Adjustable at runtime for specific demos. |
usage_warning_threshold_pct |
int | 90 |
Deprecated — replaced by graduated thresholds below. Kept for backward compatibility. |
usage_warning_green_pct |
int | 85 |
At or above this usage percentage, responses include usage_warning: "green" and status shows ✅🟡. First tier of graduated warnings. |
usage_warning_yellow_pct |
int | 90 |
At or above this usage percentage, responses include usage_warning: "yellow" and status shows ✅⚠️. Second tier — caution. |
usage_warning_red_pct |
int | 95 |
At or above this usage percentage, responses include usage_warning: "red" and status shows ✅🔴. Third tier — critical, near limit. |
minimum_to_wait |
float | 1.0 |
Minimum wait time (seconds) between requests for rate limiting. |
seconds_to_wait |
float | 15.0 |
Seconds to wait before retrying a failed source. |
default_query_limit |
int | 1000 |
Default pagination limit for queries when no explicit limit is provided. |
Core system parameters that control polling intervals, authentication, and external service integration.
| Parameter | Type | Default | Description |
|---|---|---|---|
application_parameter_interval_minutes |
int | 5 |
How often (minutes) to reload all parameters from Aurora. This is the master polling interval for the parameter loader. |
config_poll_interval_seconds |
int | 60 |
How often (seconds) to poll for config interval changes. This is a faster inner loop that checks if the main interval has changed. |
admin_api_key |
string | "" |
Admin API key for X-Admin-Key header authentication. Applied immediately via callback to update the admin auth middleware. SECRET |
stripe_key |
string | "" |
Stripe API key for payment processing. SECRET |
v8 introduced six new parameters controlling the UDP hot path. These parameters are restart-required — they configure socket options and goroutine counts at startup.
v8 UDP Architecture: Each protocol (LPO on port 2679, LRS on port 2680) opens udp_reader_goroutines SO_REUSEPORT sockets. The kernel distributes incoming packets across sockets by source IP hash. Each socket has its own reader goroutine that uses recvmmsg to pull up to udp_batch_size datagrams per syscall, dispatching them to udp_workers_per_socket worker goroutines. For cache hits, udp_pre_serialize_responses skips the response build step entirely — the pre-built JSON payload is written directly to the socket.
| Parameter Key | Type | Default | Description |
|---|---|---|---|
udp_reader_goroutines |
int | 8 |
Number of SO_REUSEPORT sockets per UDP protocol. Each socket gets its own kernel receive queue. v7 was 3, v8 bumped to 8 after the manual parser freed CPU headroom. Total workers = readers × workers_per_socket. |
udp_read_buffer_bytes |
int | 33554432 |
Per-socket kernel receive buffer (SO_RCVBUF). v8 default: 32 MB (was 8 MB). Absorbs burst spikes before the kernel drops packets. Set via conn.SetReadBuffer(). |
udp_write_buffer_bytes |
int | 33554432 |
Per-socket kernel send buffer (SO_SNDBUF). v8 default: 32 MB (was 8 MB). Prevents write backpressure under high response rates. |
udp_workers_per_socket |
int | 128 |
Worker goroutines per socket. Each worker processes one packet at a time (parse → validate → cache lookup → response). 128 is optimal for dual-protocol without OOM risk. Tested at 256 — caused OOM under combined TCP+UDP load. |
udp_batch_size |
int | 32 |
Max datagrams per recvmmsg batch read. At 75K RPS with batch=32, reduces read syscalls from 75K/s to ~2.3K/s per socket. Set to 0 or 1 to disable batching and use the v7 single-read path. |
udp_pre_serialize_responses |
bool | true |
Enable pre-serialized response cache for hot assets. When a price is cached in sync.Map, the JSON response payload is pre-built once. Subsequent cache hits skip all strconv.AppendFloat / AppendInt formatting — just memcpy the pre-built bytes + append per-request fields (api_key, usage, ip). ~2x faster than v7 zero-copy for cache hits. |
Stress Report Cache (v8): For stress-tier API keys, LRS report results are cached in ElastiCache under stress:report:{type}:{api_key} with a 2-hour TTL. This turns the LRS hot path from a multi-key pipeline query (176ms avg) into a single GET (sub-ms). Seeded automatically on first query or via /admin/seed-stress-report?api_key=<key>. Production tiers always run the real query pipeline.