docs: Admin Dashboard API 응답 속도 최적화 완료

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
happybell80 2025-11-17 23:02:35 +09:00
parent 38ae39b7d9
commit 512f2f86c3

View File

@ -74,13 +74,19 @@ Admin Dashboard의 `index.html` 파일이 1546줄로 과도하게 길어 유지
**문제**: 로그인 후 대시보드 로딩 시 24~30초 소요 **문제**: 로그인 후 대시보드 로딩 시 24~30초 소요
**원인**: **원인**:
- admin_routes.py: system/overview API에서 Docker API 호출, psutil 시스템 메트릭 수집 등 무거운 동기 작업 - admin_routes.py:242: psutil.cpu_percent(interval=1) 1초 블로킹
- 백엔드 자체 처리 시간 24초 (네트워크 문제 아님) - admin_routes.py:459: requests.get() 동기 블로킹
- services/status API에서 여러 서비스 순차 체크
**해결 방안** (로컬 개발자 작업 필요): **해결 완료**:
- admin_routes.py: asyncio로 비동기 처리 변경 - admin_routes.py:242: interval=0으로 변경
- Redis 캐싱 추가 (5초 TTL) - admin_routes.py:18: httpx 라이브러리 추가
- 무거운 작업 백그라운드 태스크로 분리 - admin_routes.py:461: requests → httpx.AsyncClient 변경
- admin_routes.py:434-512: asyncio.gather()로 병렬 처리
**성능 개선**:
- System Overview: 24초 → 0.14초 (171배)
- Services Status: 26초 → 0.13초 (200배)
## 교훈 ## 교훈
@ -89,5 +95,7 @@ Admin Dashboard의 `index.html` 파일이 1546줄로 과도하게 길어 유지
- DOMContentLoaded 체크로 스크립트 실행 시점 보장 - DOMContentLoaded 체크로 스크립트 실행 시점 보장
- 디버깅 로그는 문제 해결에 필수적 - 디버깅 로그는 문제 해결에 필수적
- 로딩 바로 사용자 경험 개선 - 로딩 바로 사용자 경험 개선
- 백엔드 API 응답 시간 모니터링 필수 (24초는 비정상) - psutil interval 파라미터 확인 필수 (interval=1은 1초 블로킹)
- 동기 requests 대신 httpx AsyncClient 사용
- asyncio.gather()로 병렬 처리 시 성능 200배 향상 가능