docs: Ajouter journal de session 2026-04-12 - RAM + Beszel
This commit is contained in:
@@ -0,0 +1,209 @@
|
||||
# Journal de Session - 12 Avril 2026
|
||||
|
||||
## Objet: Optimisation RAM FolzoCorp + Installation Beszel
|
||||
|
||||
---
|
||||
|
||||
## 1. Problème Initial
|
||||
|
||||
**Symptôme**: RAM FolzoCorp à 30GB utilisée, jamais libérée
|
||||
|
||||
**Inventaire RAM (avant)**:
|
||||
| Process | RSS | % |
|
||||
|---------|-----|---|
|
||||
| ComfyUI | 15.2 GB | 48.7% |
|
||||
| kreuzberg | 1 GB | 3.1% |
|
||||
| effi-stt | 13 MB | 0.04% |
|
||||
|
||||
---
|
||||
|
||||
## 2. Solutions Implémentées
|
||||
|
||||
### A. effi-stt - Déchargement Whisper après inactivité
|
||||
|
||||
**Fichier**: `effi-stt/main.py`
|
||||
|
||||
**Modifications**:
|
||||
- Ajout d'un timer d'inactivité (défaut: 300s)
|
||||
- Le modèle Whisper est chargé à la première requête
|
||||
- Après 300s d'inactivité, le modèle est déchargé
|
||||
- `gc.collect()` libéré la mémoire
|
||||
|
||||
**Nouveaux endpoints**:
|
||||
- `POST /unload` - déchargement manuel
|
||||
- `POST /reload` - rechargement manuel
|
||||
- `GET /stats` - statistiques (model_loaded, last_request_age)
|
||||
|
||||
**Variables d'environnement**:
|
||||
- `INACTIVITY_TIMEOUT=300` (secondes)
|
||||
|
||||
**Commit**: `f69dda5`
|
||||
|
||||
---
|
||||
|
||||
### B. ComfyUI - Déchargement VRAM après inactivité
|
||||
|
||||
**Fichier**: `scripts/comfyui-unload-monitor.py`
|
||||
|
||||
**Fonctionnement**:
|
||||
- Script Python qui vérifie l'usage VRAM toutes les 60s
|
||||
- Après 300s d'inactivité avec VRAM utilisée:
|
||||
- Exécute le workflow `UnloadAllModelsNode`
|
||||
- Appelle `gc.collect()` + `torch.cuda.empty_cache()`
|
||||
|
||||
**Options**:
|
||||
```bash
|
||||
--interval 60 # Intervalle de vérification
|
||||
--timeout 300 # Timeout d'inactivité
|
||||
--debug # Mode debug
|
||||
```
|
||||
|
||||
**Commit**: `f69dda5`
|
||||
|
||||
---
|
||||
|
||||
### C. Kreuzberg - Restart après inactivité
|
||||
|
||||
**Fichier**: `scripts/kreuzberg-memory-manager.py`
|
||||
|
||||
**Fonctionnement**:
|
||||
- Vérifie la mémoire container toutes les 60s
|
||||
- Si > 2GB pendant > 10min d'inactivité:
|
||||
- Redémarre le container kreuzberg
|
||||
|
||||
**Note**: Kreuzberg est un binaire Rust pré-compilé, donc un restart container est nécessaire pour libérer la mémoire.
|
||||
|
||||
**Commit**: `f69dda5`
|
||||
|
||||
---
|
||||
|
||||
### D. Installation Beszel Monitoring
|
||||
|
||||
**Architecture**:
|
||||
```
|
||||
NAS Synology (192.168.1.25) - Hub Beszel (port 8090)
|
||||
├── Agent FolzoCorp (192.168.1.11) - GPU AMD RX 7800 XT
|
||||
└── Agent EffiServer (192.168.1.27) - Intel J5040
|
||||
```
|
||||
|
||||
**Emplacements**:
|
||||
| Système | Emplacement |
|
||||
|---------|-------------|
|
||||
| Synology NAS | `/volume1/docker/beszel` |
|
||||
| FolzoCorp | `/home/folzo/Documents/OpenCode/Projets/Effi/beszel` |
|
||||
| EffiServer | `/home/effi/effi/beszel` |
|
||||
|
||||
**Fichiers de configuration**:
|
||||
- `beszel/docker-compose-hub.yml` - Hub Synology
|
||||
- `beszel/docker-compose-agent-folzocorp.yml` - Agent FolzoCorp
|
||||
- `beszel/docker-compose-agent-effiserver.yml` - Agent EffiServer
|
||||
|
||||
**Monitoring GPU**:
|
||||
- FolzoCorp: `amd_sysfs` collector (AMD RX 7800 XT)
|
||||
- EffiServer: `SKIP_GPU=true` (pas de GPU)
|
||||
|
||||
**Commits**: `8b1338f`, `5b677d8`, `8b6f967`
|
||||
|
||||
---
|
||||
|
||||
### E. Client API Beszel pour Effi
|
||||
|
||||
**Fichier**: `scripts/beszel_client.py`
|
||||
|
||||
**Fonctionnement**:
|
||||
- Permet à Effi d'interroger l'API Beszel
|
||||
- Récupère les métriques CPU, RAM, VRAM, GPU
|
||||
|
||||
**Utilisation**:
|
||||
```bash
|
||||
export BESZEL_URL=http://192.168.1.25:8090
|
||||
export BESZEL_USER=admin
|
||||
export BESZEL_PASSWORD=xxx
|
||||
|
||||
python3 scripts/beszel_client.py --list-systems
|
||||
python3 scripts/beszel_client.py --system folzocorp --check stats
|
||||
python3 scripts/beszel_client.py --system folzocorp --check alerts
|
||||
```
|
||||
|
||||
**Commit**: `8b1338f`
|
||||
|
||||
---
|
||||
|
||||
## 3. État Actuel RAM (après modifications)
|
||||
|
||||
**-date**: 12 Avril 2026, 09:55
|
||||
|
||||
```
|
||||
Mem: 31Gi used / 29Gi
|
||||
Swap: 8Gi used / 8Gi (100%)
|
||||
|
||||
Container RAM:
|
||||
- ComfyUI: 15.19 GiB (48.61%) ← Principal consommateur
|
||||
- kreuzberg: 982.8 MiB (3.07%)
|
||||
- beszel-agent: 5.4 MiB (0.02%)
|
||||
```
|
||||
|
||||
**Note**: Les scripts de déchargement ne sont pas encore lancés. ComfyUI occupe toujours 15GB.
|
||||
|
||||
---
|
||||
|
||||
## 4. Prochaines Étapes
|
||||
|
||||
### A. Lancer les monitors mémoire
|
||||
|
||||
```bash
|
||||
# Sur FolzoCorp
|
||||
nohup python3 scripts/comfyui-unload-monitor.py > /var/log/comfyui-unload.log 2>&1 &
|
||||
nohup python3 scripts/kreuzberg-memory-manager.py > /var/log/kreuzberg-mem.log 2>&1 &
|
||||
```
|
||||
|
||||
### B. Redémarrer effi-stt avec les nouvelles variables
|
||||
|
||||
```bash
|
||||
cd effi-stt
|
||||
docker compose down
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
### C. Vérifier la baisse de RAM après inactivity timeout
|
||||
|
||||
---
|
||||
|
||||
## 5. Commandes Utiles
|
||||
|
||||
### Vérifier RAM
|
||||
```bash
|
||||
free -h
|
||||
docker stats --no-stream
|
||||
```
|
||||
|
||||
### Logs monitors
|
||||
```bash
|
||||
tail -f /var/log/comfyui-unload.log
|
||||
tail -f /var/log/kreuzberg-mem.log
|
||||
```
|
||||
|
||||
### Statut Beszel
|
||||
```bash
|
||||
curl http://192.168.1.25:8090/api/systems -H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Liens
|
||||
|
||||
- [Beszel GitHub](https://github.com/henrygd/beszel)
|
||||
- [Documentation Beszel](https://beszel.dev)
|
||||
- [AMD GPU Monitoring](https://beszel.dev/guide/gpu#amd)
|
||||
- [REST API](https://beszel.dev/guide/rest-api)
|
||||
|
||||
---
|
||||
|
||||
## 7. Résumé Commits Gitea
|
||||
|
||||
| Commit | Description |
|
||||
|--------|-------------|
|
||||
| `f69dda5` | feat(memory): Déchargement automatique mémoire |
|
||||
| `8b1338f` | feat(beszel): Installation Beszel infrastructure |
|
||||
| `5b677d8` | fix(beszel): Mise à jour chemins installation |
|
||||
| `8b6f967` | fix(beszel): Retrait group_add pour Fedora |
|
||||
Reference in New Issue
Block a user