Prepare per-SSD dashboard throughput IOPS and busy-time telemetry
This commit is contained in:
1 parent
cd1700d2b6
commit
32daa5547f
7 files changed
+147
-1
No files matched your search
+51
-1
@@ -5,11 +5,58 @@ import time
|
|||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
PROC = Path(os.environ.get('DECK_HOST_PROC', '/proc'))
|
PROC = Path(os.environ.get('DECK_HOST_PROC', '/proc'))
|
||||||
DATA_DISK = Path(os.environ.get('DECK_HOST_DATA_DISK', '/var/lib/deck'))
|
DATA_DISK = Path(os.environ.get('DECK_HOST_DATA_DISK', '/var/lib/deck'))
|
||||||
_network_previous = None
|
_network_previous = None
|
||||||
|
SYS = Path(os.environ.get('DECK_HOST_SYS', '/sys'))
|
||||||
|
_disk_previous = None
|
||||||
|
|
||||||
|
|
||||||
|
def disk_sample():
|
||||||
|
"""Whole physical SSDs only: no partition/mapper double counting."""
|
||||||
|
devices = {}
|
||||||
|
for line in read(PROC/'diskstats').splitlines():
|
||||||
|
parts = line.split()
|
||||||
|
if len(parts) < 14:
|
||||||
|
continue
|
||||||
|
name = parts[2]
|
||||||
|
if not re.fullmatch(r'(?:nvme\d+n\d+|sd[a-z]+)', name):
|
||||||
|
continue
|
||||||
|
device = SYS/'class/block'/name
|
||||||
|
if (device/'partition').exists() or read(device/'queue/rotational') != '0':
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
stats = [int(x) for x in parts[3:14]]
|
||||||
|
if any(x < 0 for x in stats):
|
||||||
|
continue
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
devices[name] = dict(name=name, model=read(device/'device/model')[:128] or name,
|
||||||
|
counters=[stats[0], stats[2], stats[4], stats[6], stats[9]],
|
||||||
|
in_flight=stats[8])
|
||||||
|
return devices
|
||||||
|
|
||||||
|
|
||||||
|
def disk_rates(current, previous, now):
|
||||||
|
rows = []
|
||||||
|
elapsed = now-previous[0] if previous else 0
|
||||||
|
for name, device in sorted(current.items()):
|
||||||
|
row = {k: device[k] for k in ('name', 'model', 'in_flight')}
|
||||||
|
row.update(read_bytes_per_second=None, write_bytes_per_second=None,
|
||||||
|
read_iops=None, write_iops=None, busy_percent=None)
|
||||||
|
old = previous[1].get(name) if previous else None
|
||||||
|
if elapsed > 0 and old:
|
||||||
|
delta = [a-b for a,b in zip(device['counters'], old['counters'])]
|
||||||
|
if all(x >= 0 for x in delta):
|
||||||
|
row.update(read_bytes_per_second=round(delta[1]*512/elapsed, 1),
|
||||||
|
write_bytes_per_second=round(delta[3]*512/elapsed, 1),
|
||||||
|
read_iops=round(delta[0]/elapsed, 1), write_iops=round(delta[2]/elapsed, 1),
|
||||||
|
busy_percent=round(min(100, delta[4]/(elapsed*10)), 1))
|
||||||
|
rows.append(row)
|
||||||
|
return rows
|
||||||
|
|
||||||
|
|
||||||
def read(path):
|
def read(path):
|
||||||
@@ -32,7 +79,7 @@ def ticks():
|
|||||||
|
|
||||||
|
|
||||||
def collect():
|
def collect():
|
||||||
global _network_previous
|
global _network_previous, _disk_previous
|
||||||
errors = []
|
errors = []
|
||||||
cpu = {'name': None, 'percent': None, 'temperature_c': None}
|
cpu = {'name': None, 'percent': None, 'temperature_c': None}
|
||||||
try:
|
try:
|
||||||
@@ -81,6 +128,9 @@ def collect():
|
|||||||
disk=shutil.disk_usage(DATA_DISK)
|
disk=shutil.disk_usage(DATA_DISK)
|
||||||
disk_data=dict(total=disk.total,used=disk.used,free=disk.free)
|
disk_data=dict(total=disk.total,used=disk.used,free=disk.free)
|
||||||
except OSError:disk_data={}
|
except OSError:disk_data={}
|
||||||
|
disk_now=time.monotonic();disk_current=disk_sample()
|
||||||
|
disk_data['io']=disk_rates(disk_current, _disk_previous, disk_now)
|
||||||
|
_disk_previous=(disk_now, disk_current)
|
||||||
rx=tx=interfaces=0
|
rx=tx=interfaces=0
|
||||||
# A bind-mounted /proc/net is a self/net symlink and would show the
|
# A bind-mounted /proc/net is a self/net symlink and would show the
|
||||||
# container namespace. PID 1 in the host proc mount has the host network.
|
# container namespace. PID 1 in the host proc mount has the host network.
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ root.innerHTML=`<div class="dashboard-root"><div class="top"><div><div class="ki
|
|||||||
<article class="card span3"><div class="label">Modell</div><div class="value" id="model">–</div><div class="sub" id="modelSub">–</div></article>
|
<article class="card span3"><div class="label">Modell</div><div class="value" id="model">–</div><div class="sub" id="modelSub">–</div></article>
|
||||||
<article class="card span3"><div class="label">CPU</div><div class="value" id="cpu">–</div><div class="bar"><div class="fill" id="cpuBar"></div></div><div class="sub" id="load">–</div></article>
|
<article class="card span3"><div class="label">CPU</div><div class="value" id="cpu">–</div><div class="bar"><div class="fill" id="cpuBar"></div></div><div class="sub" id="load">–</div></article>
|
||||||
<article class="card span3"><div class="label">System-RAM</div><div class="value" id="ram">–</div><div class="bar"><div class="fill" id="ramBar"></div></div><div class="sub" id="ramSub">–</div></article>
|
<article class="card span3"><div class="label">System-RAM</div><div class="value" id="ram">–</div><div class="bar"><div class="fill" id="ramBar"></div></div><div class="sub" id="ramSub">–</div></article>
|
||||||
|
<article class="card span12"><div class="label">SSD · Lesen und Schreiben</div><div id="ssdIO" class="metrics">Messung wird geladen …</div><div class="sub">Host-I/O · Aktivzeit ist keine Prozentangabe der maximalen SSD-Geschwindigkeit.</div></article>
|
||||||
<div id="gpuCards" class="span12 grid"></div>
|
<div id="gpuCards" class="span12 grid"></div>
|
||||||
<div class="section-title">Inferenz · Live</div>
|
<div class="section-title">Inferenz · Live</div>
|
||||||
<article class="card span3"><div class="label">Generierung</div><div class="value" id="generationRate">–</div><div class="sub" id="generationSub">Token pro Sekunde</div></article>
|
<article class="card span3"><div class="label">Generierung</div><div class="value" id="generationRate">–</div><div class="sub" id="generationSub">Token pro Sekunde</div></article>
|
||||||
@@ -218,6 +219,9 @@ async function refreshSummary(){
|
|||||||
$('activeChats').textContent=q.active_chats??'–';$('routerUptime').textContent=dur(rt.uptime_seconds);
|
$('activeChats').textContent=q.active_chats??'–';$('routerUptime').textContent=dur(rt.uptime_seconds);
|
||||||
$('switching').textContent=rt.switching||'nein';
|
$('switching').textContent=rt.switching||'nein';
|
||||||
const disk=c.disk_data||{};$('dataDisk').textContent=pct(disk.total?100*disk.used/disk.total:null);
|
const disk=c.disk_data||{};$('dataDisk').textContent=pct(disk.total?100*disk.used/disk.total:null);
|
||||||
|
const ioRate=n=>n==null?'–':`${(Number(n)/1048576).toLocaleString('de-DE',{maximumFractionDigits:1})} MiB/s`;
|
||||||
|
const iops=n=>n==null?'–':Number(n).toLocaleString('de-DE',{maximumFractionDigits:1});
|
||||||
|
$('ssdIO').innerHTML=(disk.io||[]).map(s=>`<div class="metric"><b>${esc(s.model)} · ${esc(s.name)}</b><span>Lesen ${esc(ioRate(s.read_bytes_per_second))} · Schreiben ${esc(ioRate(s.write_bytes_per_second))}</span><span>IOPS L/S: ${esc(iops(s.read_iops))} / ${esc(iops(s.write_iops))} · Aktivzeit ${esc(pct(s.busy_percent))} · laufende I/Os ${esc(s.in_flight)}</span></div>`).join('')||'<div class="sub">Keine SSD-I/O-Messwerte verfügbar.</div>';
|
||||||
$('processes').innerHTML=(d.gpu_processes||[]).map(p=>`<tr><td>${esc((d.gpus||[]).find(g=>g.uuid===p.gpu_uuid)?.index)}</td><td>${esc(p.name)}</td><td>${esc(p.pid)}</td><td>${esc(p.memory_mib)} MiB</td></tr>`).join('')||'<tr><td colspan="4">Keine Compute-Prozesse gemeldet</td></tr>';
|
$('processes').innerHTML=(d.gpu_processes||[]).map(p=>`<tr><td>${esc((d.gpus||[]).find(g=>g.uuid===p.gpu_uuid)?.index)}</td><td>${esc(p.name)}</td><td>${esc(p.pid)}</td><td>${esc(p.memory_mib)} MiB</td></tr>`).join('')||'<tr><td colspan="4">Keine Compute-Prozesse gemeldet</td></tr>';
|
||||||
const runtime=[['Modell-Datei',lr.model_file],['PID',lr.pid],['Kontext',lr.context_size?Number(lr.context_size).toLocaleString('de-DE'):'–'],['Batch / µBatch',`${lr.batch_size??'–'} / ${lr.ubatch_size??'–'}`],['Parallel',lr.parallel],['Threads',`${lr.threads??'–'} / ${lr.threads_batch??'–'}`],['Geräte',lr.device],['Tensor-Split',lr.tensor_split],['KV-Cache',`${lr.cache_k??'–'} / ${lr.cache_v??'–'}`],['Flash Attention',lr.flash_attention==null?'–':lr.flash_attention?'an':'aus'],['Prompt-Cache',lr.prompt_cache==null?'–':lr.prompt_cache?'an':'aus'],['MTP Draft',lr.mtp_draft_tokens]];
|
const runtime=[['Modell-Datei',lr.model_file],['PID',lr.pid],['Kontext',lr.context_size?Number(lr.context_size).toLocaleString('de-DE'):'–'],['Batch / µBatch',`${lr.batch_size??'–'} / ${lr.ubatch_size??'–'}`],['Parallel',lr.parallel],['Threads',`${lr.threads??'–'} / ${lr.threads_batch??'–'}`],['Geräte',lr.device],['Tensor-Split',lr.tensor_split],['KV-Cache',`${lr.cache_k??'–'} / ${lr.cache_v??'–'}`],['Flash Attention',lr.flash_attention==null?'–':lr.flash_attention?'an':'aus'],['Prompt-Cache',lr.prompt_cache==null?'–':lr.prompt_cache?'an':'aus'],['MTP Draft',lr.mtp_draft_tokens]];
|
||||||
$('runtime').innerHTML=runtime.map(([k,v])=>metric(v,k)).join('');
|
$('runtime').innerHTML=runtime.map(([k,v])=>metric(v,k)).join('');
|
||||||
|
|||||||
@@ -59,3 +59,4 @@ Vorherige Backupprüfung: [Befund und Grenzen](maintenance/2026-10-14-documentat
|
|||||||
| [WireGuard DHCP startup race — 2026-10-13](experiments/wireguard-boot-fix-2026-10-13/README.md) | 1 |
|
| [WireGuard DHCP startup race — 2026-10-13](experiments/wireguard-boot-fix-2026-10-13/README.md) | 1 |
|
||||||
| [WireGuard configuration replacement verification](experiments/wireguard-config-replacement-2026-10-13/README.md) | 1 |
|
| [WireGuard configuration replacement verification](experiments/wireguard-config-replacement-2026-10-13/README.md) | 1 |
|
||||||
|
|
||||||
|
Neu ergänzt: [SSD-I/O-Dashboard, vorbereitet und live vermessen](experiments/ssd-dashboard-2026-10-14/README.md).
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# SSD-I/O im Dashboard — 14. Oktober 2026
|
||||||
|
|
||||||
|
Vorbereitetes App-Update, noch nicht aktiviert. Image:
|
||||||
|
`athena-deck-standalone:ssd-io-20261014`, Basis
|
||||||
|
`athena-deck-standalone:strata-0.1.44.1-20261014`. Der separate Build kopiert
|
||||||
|
collect_hardware.py, dashboard-ui.js und die bereits geprüfte Backupkorrektur.
|
||||||
|
Aktivierung benötigt einen regulären Deck-Neustart; laufende Coding-Aufgaben
|
||||||
|
werden nicht unterbrochen. Freigabe offen. Keine Profil-/Token-/Mountänderung.
|
||||||
|
|
||||||
|
Die neue Karte unter CPU/System-RAM und vor GPUs zeigt je ganzer physischer SSD:
|
||||||
|
Gerätename/Modell, Lesen/Schreiben in MiB/s, Lese-/Schreib-IOPS, Aktivzeit und
|
||||||
|
aktuell laufende I/Os. Linux /proc/diskstats-Deltas, 512 Bytes pro gezähltem
|
||||||
|
Sektor; /sys liefert nur Modellname und Rotationskennzeichen. Keine Seriennummern,
|
||||||
|
SMART-Zugangsdaten oder Dateiinhalte. Keine neuen Pakete, Schreibtests oder Benchmarks.
|
||||||
|
Partitionen, Mapper und rotierende Laufwerke ausgeschlossen, damit keine
|
||||||
|
Doppelzählung entsteht. Null-/Reset-/Neu-Geräte-Messungen werden als unbekannt
|
||||||
|
statt als erfundene Nullraten angezeigt. Aktivzeit ist keine Prozentangabe der
|
||||||
|
maximal erreichbaren SSD-Bandbreite; NVMe-Parallelität begrenzt ihre Aussagekraft.
|
||||||
|
Alle Hostprozesse zählen, nicht nur Strata. Keine getrennte Disk-Historie ergänzt.
|
||||||
|
|
||||||
|
Im derzeitigen lokalen Hardwarecollector wird der letzte Messstand im Prozess
|
||||||
|
gehalten. Bei einem jedes Mal neu gestarteten SSH-Collector ist zunächst kein
|
||||||
|
vorheriger Stand verfügbar; Raten bleiben dann unbekannt. Native Standardbetrieb
|
||||||
|
und Athenas lokale Messung nutzen den fortlaufenden Collector.
|
||||||
|
|
||||||
|
Zehn Tests bestanden: test_disk_io, test_dashboard_data, test_dashboard_history.
|
||||||
|
JavaScript-Syntaxprüfung bestanden. Isolierte echte Probe im laufenden Container:
|
||||||
|
Samsung SSD 980 PRO 1TB/nvme0n1 etwa 262799284 B/s Lesen, 3636.7 Lese-IOPS,
|
||||||
|
15.0 Prozent Aktivzeit; WD Blue SN580 1TB/nvme1n1 etwa 238624332 B/s Lesen,
|
||||||
|
1820.6 Lese-IOPS, 15.6 Prozent Aktivzeit. Momentaufnahme während Backupprüfung,
|
||||||
|
kein SSD-Leistungsbenchmark. Kein Deck-Prozess dabei verändert.
|
||||||
|
|
||||||
|
Daten gehen über das bestehende cpu.disk_data-Objekt in /api/v1/dashboard;
|
||||||
|
keine neuen API-Berechtigungen oder Endpunkte. Der normale Installer führt
|
||||||
|
collect_hardware.py/dashboard-ui.js/backup.py bereits explizit im App-Rezept.
|
||||||
|
Native Debian-Installation benötigt lesbare procfs/sysfs. Beim heutigen
|
||||||
|
Containerbetrieb /host/proc readonly und sichtbare Host-Sysfs-Geräte erhalten.
|
||||||
|
Restore aus aktuellem Git stellt die Anzeige wieder bereit; weder Messstände
|
||||||
|
noch laufende I/Os sind dauerhafter Sicherungszustand. Frischer Restore offen.
|
||||||
|
|
||||||
|
Quelle: https://docs.kernel.org/admin-guide/iostats.html
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"tests": 10,
|
||||||
|
"tests_passed": true,
|
||||||
|
"javascript_syntax": "passed",
|
||||||
|
"image": "athena-deck-standalone:ssd-io-20261014",
|
||||||
|
"activated": false,
|
||||||
|
"restart_authorization": "pending",
|
||||||
|
"devices": [
|
||||||
|
"Samsung SSD 980 PRO 1TB",
|
||||||
|
"WD Blue SN580 1TB"
|
||||||
|
],
|
||||||
|
"live_probe": true
|
||||||
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
# Dokumentationsabgleich und Backup-/Restore-Trockenprüfung — 14. Oktober 2026
|
# Dokumentationsabgleich und Backup-/Restore-Trockenprüfung — 14. Oktober 2026
|
||||||
|
|
||||||
|
**Später am selben Tag behoben:** [Qwen-Voice-Backupkorrektur](../2026-10-14-qwen-voice-backup-fix/README.md).
|
||||||
|
Neue Generation 20261014-181754 vollständig verifiziert. Der folgende Fehlerbefund
|
||||||
|
ist der historische Stand vor der Reparatur.
|
||||||
|
|
||||||
## Ergebnis
|
## Ergebnis
|
||||||
|
|
||||||
59 lokale Tests bestanden, 85 Python-Dateien des Backup-/Deploymentpfads syntaktisch
|
59 lokale Tests bestanden, 85 Python-Dateien des Backup-/Deploymentpfads syntaktisch
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import tempfile,unittest
|
||||||
|
from pathlib import Path
|
||||||
|
from unittest.mock import patch
|
||||||
|
import collect_hardware as h
|
||||||
|
|
||||||
|
class DiskIOTests(unittest.TestCase):
|
||||||
|
def test_only_whole_ssds_and_linux_512_byte_sectors(self):
|
||||||
|
with tempfile.TemporaryDirectory() as d:
|
||||||
|
root=Path(d);proc=root/'proc';sys=root/'sys';proc.mkdir()
|
||||||
|
for name,rot in [('nvme0n1','0'),('sda','0'),('sdb','1'),('nvme0n1p1','0'),('dm-0','0')]:
|
||||||
|
dev=sys/'class/block'/name;(dev/'queue').mkdir(parents=True);(dev/'queue/rotational').write_text(rot)
|
||||||
|
(dev/'device').mkdir();(dev/'device/model').write_text('SSD test')
|
||||||
|
(sys/'class/block/nvme0n1p1/partition').write_text('1')
|
||||||
|
(proc/'diskstats').write_text('\n'.join('259 0 '+name+' 10 0 100 0 20 0 200 0 2 300 0' for name in ['nvme0n1','nvme0n1p1','sda','sdb','dm-0']))
|
||||||
|
with patch.object(h,'PROC',proc),patch.object(h,'SYS',sys):sample=h.disk_sample()
|
||||||
|
self.assertEqual(set(sample),{'nvme0n1','sda'})
|
||||||
|
newer={n:{**v,'counters':[20,120,40,240,800]} for n,v in sample.items()}
|
||||||
|
row=h.disk_rates(newer,(10,sample),12)[0]
|
||||||
|
self.assertEqual(row['read_bytes_per_second'],5120);self.assertEqual(row['write_bytes_per_second'],10240)
|
||||||
|
self.assertEqual(row['read_iops'],5);self.assertEqual(row['write_iops'],10);self.assertEqual(row['busy_percent'],25)
|
||||||
|
def test_first_sample_reset_and_new_device_are_unknown_not_zero(self):
|
||||||
|
s={'sda':dict(name='sda',model='SSD',in_flight=0,counters=[10]*5)}
|
||||||
|
self.assertIsNone(h.disk_rates(s,None,1)[0]['read_iops'])
|
||||||
|
self.assertIsNone(h.disk_rates(s,(1,{'sda':{**s['sda'],'counters':[20]*5}}),2)[0]['read_iops'])
|
||||||
|
self.assertIsNone(h.disk_rates(s,(1,{}),2)[0]['read_iops'])
|
||||||
|
self.assertIsNone(h.disk_rates(s,(2,s),2)[0]['read_iops'])
|
||||||
|
def test_idle_zero_and_busy_time_clamped(self):
|
||||||
|
s={'sda':dict(name='sda',model='SSD',in_flight=0,counters=[10]*5)}
|
||||||
|
self.assertEqual(h.disk_rates(s,(1,s),2)[0]['read_iops'],0)
|
||||||
|
newer={'sda':{**s['sda'],'counters':[10,10,10,10,5010]}}
|
||||||
|
self.assertEqual(h.disk_rates(newer,(1,s),2)[0]['busy_percent'],100)
|
||||||
|
|
||||||
|
if __name__=='__main__':unittest.main()
|
||||||
Reference in new issue
Block a user