333 lines
7.3 KiB
Markdown
Executable File
333 lines
7.3 KiB
Markdown
Executable File
# Tests de Benchmarks Individuels
|
|
|
|
Ce fichier contient les commandes pour tester chaque benchmark individuellement et voir exactement ce qu'ils retournent.
|
|
|
|
## Prérequis
|
|
|
|
Vérifier les outils installés :
|
|
```bash
|
|
which sysbench fio iperf3 dmidecode lscpu free jq lsblk
|
|
```
|
|
|
|
Installer les outils manquants (Debian/Ubuntu) :
|
|
```bash
|
|
sudo apt-get update
|
|
sudo apt-get install sysbench fio iperf3 dmidecode lshw util-linux coreutils jq
|
|
```
|
|
|
|
---
|
|
|
|
## 1. Test CPU avec sysbench
|
|
|
|
### Mode court (10000 primes)
|
|
```bash
|
|
sysbench cpu --cpu-max-prime=10000 --threads=$(nproc) run
|
|
```
|
|
|
|
### Mode normal (20000 primes)
|
|
```bash
|
|
sysbench cpu --cpu-max-prime=20000 --threads=$(nproc) run
|
|
```
|
|
|
|
### Récupérer uniquement les events/sec
|
|
```bash
|
|
sysbench cpu --cpu-max-prime=10000 --threads=$(nproc) run 2>&1 | grep 'events per second'
|
|
```
|
|
|
|
**Ce qu'on cherche** : La ligne `events per second: XXXX.XX`
|
|
|
|
---
|
|
|
|
## 2. Test Mémoire avec sysbench
|
|
|
|
### Mode court (512M)
|
|
```bash
|
|
sysbench memory --memory-block-size=1M --memory-total-size=512M run
|
|
```
|
|
|
|
### Mode normal (1G)
|
|
```bash
|
|
sysbench memory --memory-block-size=1M --memory-total-size=1G run
|
|
```
|
|
|
|
### Récupérer le throughput
|
|
```bash
|
|
sysbench memory --memory-block-size=1M --memory-total-size=512M run 2>&1 | grep 'MiB/sec'
|
|
```
|
|
|
|
**Ce qu'on cherche** : Le throughput en MiB/sec
|
|
|
|
---
|
|
|
|
## 3. Test Disque avec fio
|
|
|
|
### Test lecture séquentielle
|
|
```bash
|
|
fio --name=seqread --ioengine=libaio --rw=read --bs=1M --size=1G --numjobs=1 --direct=1 --filename=/tmp/fio-test-file
|
|
```
|
|
|
|
### Test écriture séquentielle
|
|
```bash
|
|
fio --name=seqwrite --ioengine=libaio --rw=write --bs=1M --size=1G --numjobs=1 --direct=1 --filename=/tmp/fio-test-file
|
|
```
|
|
|
|
### Test lecture/écriture aléatoire (IOPS)
|
|
```bash
|
|
fio --name=randrw --ioengine=libaio --rw=randrw --bs=4k --size=100M --numjobs=1 --direct=1 --filename=/tmp/fio-test-file
|
|
```
|
|
|
|
### Récupérer les résultats en JSON
|
|
```bash
|
|
fio --name=test --ioengine=libaio --rw=randrw --bs=4k --size=100M --numjobs=1 --direct=1 --filename=/tmp/fio-test-file --output-format=json
|
|
```
|
|
|
|
**Ce qu'on cherche** :
|
|
- `READ: bw=XXXMiB/s` (throughput lecture)
|
|
- `WRITE: bw=XXXMiB/s` (throughput écriture)
|
|
- `IOPS=XXXX` (operations/sec)
|
|
|
|
### Nettoyage
|
|
```bash
|
|
rm -f /tmp/fio-test-file
|
|
```
|
|
|
|
---
|
|
|
|
## 4. Test Réseau avec iperf3
|
|
|
|
### Sur le serveur (10.0.0.50) - Lancer le serveur iperf3
|
|
```bash
|
|
iperf3 -s
|
|
```
|
|
|
|
### Sur le client - Test upload
|
|
```bash
|
|
iperf3 -c 10.0.0.50 -t 5
|
|
```
|
|
|
|
### Sur le client - Test download
|
|
```bash
|
|
iperf3 -c 10.0.0.50 -t 5 -R
|
|
```
|
|
|
|
### Récupérer les résultats en JSON
|
|
```bash
|
|
iperf3 -c 10.0.0.50 -t 5 -J
|
|
```
|
|
|
|
**Ce qu'on cherche** :
|
|
- `bits_per_second` (vitesse en bits/sec)
|
|
- Convertir en Mbps : `bits_per_second / 1000000`
|
|
|
|
---
|
|
|
|
## 5. Collecte d'infos Hardware
|
|
|
|
### CPU avec lscpu
|
|
```bash
|
|
lscpu
|
|
```
|
|
|
|
Extraction des infos importantes :
|
|
```bash
|
|
echo "Vendor: $(lscpu | grep 'Vendor ID' | awk '{print $3}')"
|
|
echo "Model: $(lscpu | grep 'Model name' | sed 's/Model name: *//')"
|
|
echo "Cores: $(lscpu | grep '^CPU(s):' | awk '{print $2}')"
|
|
echo "Threads: $(nproc)"
|
|
echo "Base Freq: $(lscpu | grep 'CPU MHz' | awk '{print $3}')"
|
|
echo "Max Freq: $(lscpu | grep 'CPU max MHz' | awk '{print $4}')"
|
|
```
|
|
|
|
### RAM avec free
|
|
```bash
|
|
free -m
|
|
```
|
|
|
|
Total RAM :
|
|
```bash
|
|
free -m | grep '^Mem:' | awk '{print $2}'
|
|
```
|
|
|
|
### RAM détaillée avec dmidecode (nécessite sudo)
|
|
```bash
|
|
sudo dmidecode -t memory
|
|
```
|
|
|
|
Infos RAM structurées :
|
|
```bash
|
|
sudo dmidecode -t memory | grep -E 'Size|Type:|Speed:|Manufacturer'
|
|
```
|
|
|
|
### GPU avec lspci
|
|
```bash
|
|
lspci | grep -i vga
|
|
lspci | grep -i 3d
|
|
```
|
|
|
|
### GPU NVIDIA avec nvidia-smi (si carte NVIDIA)
|
|
```bash
|
|
nvidia-smi --query-gpu=gpu_name,memory.total --format=csv,noheader
|
|
```
|
|
|
|
### Carte mère avec dmidecode
|
|
```bash
|
|
sudo dmidecode -t baseboard | grep -E 'Manufacturer|Product Name'
|
|
```
|
|
|
|
### OS
|
|
```bash
|
|
cat /etc/os-release
|
|
uname -r # kernel version
|
|
uname -m # architecture
|
|
```
|
|
|
|
### Disques
|
|
```bash
|
|
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
|
|
```
|
|
|
|
Avec détails :
|
|
```bash
|
|
lsblk -J # JSON format
|
|
```
|
|
|
|
### Réseau
|
|
```bash
|
|
ip link show
|
|
```
|
|
|
|
Interfaces actives :
|
|
```bash
|
|
ip -br link show | grep UP
|
|
```
|
|
|
|
---
|
|
|
|
## 6. Test du Script bench.sh (si tu veux)
|
|
|
|
### Dry-run (voir ce qui serait collecté sans envoyer)
|
|
Tu peux commenter la ligne de curl dans le script et juste faire un `echo "$payload"` pour voir le JSON généré.
|
|
|
|
Ou créer un script de test :
|
|
```bash
|
|
# Dans le script bench.sh, remplacer la ligne 455-459 par :
|
|
echo "=== PAYLOAD JSON ==="
|
|
echo "$payload" | jq .
|
|
echo "=== END PAYLOAD ==="
|
|
```
|
|
|
|
---
|
|
|
|
## Format JSON attendu par le backend
|
|
|
|
Le backend attend un JSON comme ceci :
|
|
|
|
```json
|
|
{
|
|
"device_identifier": "hostname",
|
|
"bench_script_version": "1.0.0",
|
|
"hardware": {
|
|
"cpu": {
|
|
"vendor": "GenuineIntel",
|
|
"model": "Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz",
|
|
"microarchitecture": "Coffee Lake",
|
|
"cores": 8,
|
|
"threads": 8,
|
|
"base_freq_ghz": 3.6,
|
|
"max_freq_ghz": 4.9,
|
|
"cache_l1_kb": 512,
|
|
"cache_l2_kb": 2048,
|
|
"cache_l3_kb": 12288,
|
|
"flags": ["avx", "avx2", "sse4_1", "sse4_2"],
|
|
"tdp_w": 95
|
|
},
|
|
"ram": {
|
|
"total_mb": 16384,
|
|
"slots_total": 4,
|
|
"slots_used": 2,
|
|
"ecc": false,
|
|
"layout": [
|
|
{"slot": "DIMM1", "size_mb": 8192, "type": "DDR4", "speed_mhz": 3200, "manufacturer": "Corsair"},
|
|
{"slot": "DIMM2", "size_mb": 8192, "type": "DDR4", "speed_mhz": 3200, "manufacturer": "Corsair"}
|
|
]
|
|
},
|
|
"gpu": {
|
|
"vendor": "NVIDIA",
|
|
"model": "GeForce RTX 3070",
|
|
"vram_mb": 8192,
|
|
"driver_version": "525.105.17",
|
|
"cuda_version": "12.0"
|
|
},
|
|
"motherboard": {
|
|
"manufacturer": "ASUS",
|
|
"model": "ROG STRIX Z390-E GAMING",
|
|
"bios_version": "2417",
|
|
"bios_date": "08/14/2020"
|
|
},
|
|
"storage": [
|
|
{"device": "nvme0n1", "model": "Samsung SSD 970 EVO Plus", "size_gb": 500, "type": "nvme"},
|
|
{"device": "sda", "model": "WD Blue 1TB", "size_gb": 1000, "type": "sata"}
|
|
],
|
|
"network": [
|
|
{"name": "eth0", "speed_mbps": 1000, "type": "ethernet"},
|
|
{"name": "wlan0", "speed_mbps": 866, "type": "wifi"}
|
|
],
|
|
"os": {
|
|
"name": "ubuntu",
|
|
"version": "22.04",
|
|
"kernel_version": "5.15.0-91-generic",
|
|
"architecture": "x86_64"
|
|
}
|
|
},
|
|
"results": {
|
|
"cpu": {
|
|
"events_per_sec": 5234.89,
|
|
"duration_s": 10.0,
|
|
"score": 52.35
|
|
},
|
|
"memory": {
|
|
"throughput_mib_s": 15234.5,
|
|
"score": 76.17
|
|
},
|
|
"disk": {
|
|
"read_mb_s": 3500.0,
|
|
"write_mb_s": 3000.0,
|
|
"iops_read": 450000,
|
|
"iops_write": 400000,
|
|
"latency_ms": 0.05,
|
|
"score": 85.0
|
|
},
|
|
"network": {
|
|
"upload_mbps": 940.5,
|
|
"download_mbps": 950.2,
|
|
"ping_ms": 0.5,
|
|
"jitter_ms": 0.1,
|
|
"packet_loss_percent": 0.0,
|
|
"score": 95.0
|
|
},
|
|
"gpu": null,
|
|
"global_score": 77.13
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Notes
|
|
|
|
- Tous les champs optionnels peuvent être `null` ou omis
|
|
- Le backend acceptera un JSON partiel tant que les champs obligatoires sont présents :
|
|
- `device_identifier` (string)
|
|
- `bench_script_version` (string)
|
|
- `hardware` (objet, peut être minimaliste)
|
|
- `results.global_score` (float 0-100)
|
|
|
|
---
|
|
|
|
## Prochaine étape
|
|
|
|
Une fois que tu auras testé les benchmarks individuellement, copie-colle les résultats ici et on pourra :
|
|
1. Adapter le parsing dans le script bench.sh
|
|
2. S'assurer que les regex/awk extraient les bonnes valeurs
|
|
3. Tester le JSON généré
|