mirror of
https://github.com/taylanbakircioglu/haproxy-openmanager.git
synced 2026-09-17 08:05:09 +00:00
23257b02cf
A user running the API on a 2-core/4GB host reported slow-feeling API responses (Issue #35 follow-up). Review of the hot paths found no pathological defect; the dominant factors are the single uvicorn worker (one core serves all requests) and the constant agent-poll baseline (4 requests per agent every 30s). Two zero-risk improvements: - backend/Dockerfile: CMD now honors UVICORN_WORKERS, falling back to WEB_CONCURRENCY and then 1. Flagless uvicorn natively honors WEB_CONCURRENCY, so the fallback keeps any deployment that relied on it byte-for-byte compatible; with the final default of 1 worker uvicorn runs in-process exactly as before. >1 enables the multiprocess supervisor so multi-core hosts can use all cores. Background tasks are already multi-replica safe (FOR UPDATE SKIP LOCKED / advisory locks), as exercised by the k8s HPA deployment (2-10 replicas). `exec` keeps uvicorn as PID 1 (clean SIGTERM, verified ~1s docker stop with 2 workers). docker-compose.yml passes UVICORN_WORKERS through as empty-when-unset so a user-set WEB_CONCURRENCY is never overridden; .env.template documents it. - routers/agent.py heartbeat (by-name endpoint): the agent's status/version/upgrade_status were read with three separate single-column SELECTs against the same row; now one SELECT. Identical values and None semantics (single consistent snapshot instead of three reads); saves two round-trips per heartbeat per agent every 30s. The legacy by-id heartbeat endpoint is untouched; the heartbeat API contract is unchanged for agents of every version. - README: new "Performance Tuning" section (worker/replica scaling, and how to use the X-Response-Time header plus "Slow request detected" logs to pinpoint slow endpoints). Verification: full backend suite in docker green (1063 passed, 151 skipped; also re-run by the runtime image build); worker-count expansion matrix (unset->1, UVICORN_WORKERS=2->2, WEB_CONCURRENCY=3->3, both->UVICORN_WORKERS, empty->fallback) all correct; default run confirmed single-process with uvicorn as PID 1 and healthy API; UVICORN_WORKERS=2 confirmed parent + 2 workers, healthy API, clean shutdown; live heartbeats verified for register + existing-agent paths AND degraded agents (no stats socket / haproxy stopped / garbage stats CSV / unknown backend in server_statuses): all return 200, agent row updates correctly, zero backend errors. No schema, API, or agent changes.
59 lines
1.5 KiB
JSON
59 lines
1.5 KiB
JSON
{
|
|
"name": "haproxy-openmanager-frontend",
|
|
"version": "1.8.6",
|
|
"description": "HAProxy Load Balancer Management UI",
|
|
"license": "AGPL-3.0-or-later",
|
|
"dependencies": {
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"react-router-dom": "^6.8.0",
|
|
"axios": "^1.16.0",
|
|
"antd": "^5.2.0",
|
|
"@ant-design/icons": "^5.0.0",
|
|
"recharts": "^2.5.0",
|
|
"moment": "^2.29.0",
|
|
"react18-json-view": "^0.2.9",
|
|
"monaco-editor": "^0.36.0",
|
|
"@monaco-editor/react": "^4.6.0",
|
|
"react-ace": "^10.1.0",
|
|
"ace-builds": "^1.23.4",
|
|
"react-window": "^1.8.10",
|
|
"qrcode.react": "^4.0.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/react": "^18.0.0",
|
|
"@types/react-dom": "^18.0.0",
|
|
"react-scripts": "5.0.1",
|
|
"typescript": "^4.9.0",
|
|
"@testing-library/react": "^13.4.0",
|
|
"@testing-library/jest-dom": "^5.16.4",
|
|
"@testing-library/user-event": "^14.4.3",
|
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.0"
|
|
},
|
|
"scripts": {
|
|
"start": "react-scripts start",
|
|
"build": "react-scripts build",
|
|
"test": "react-scripts test",
|
|
"eject": "react-scripts eject"
|
|
},
|
|
|
|
"eslintConfig": {
|
|
"extends": [
|
|
"react-app",
|
|
"react-app/jest"
|
|
]
|
|
},
|
|
"browserslist": {
|
|
"production": [
|
|
">0.2%",
|
|
"not dead",
|
|
"not op_mini all"
|
|
],
|
|
"development": [
|
|
"last 1 chrome version",
|
|
"last 1 firefox version",
|
|
"last 1 safari version"
|
|
]
|
|
},
|
|
"proxy": "http://backend:8000"
|
|
} |