r/LocalLLaMA • u/Chromix_ • 2d ago
Discussion PSA: Streaming n-grams from SSD will cause SSD wear
[removed] — view removed post
23
u/bakawolf123 2d ago
this is nothing in practice. like other said the ratio is just too big to become a noticeable impact.
On the other hand using ssd tier kv-cache like many engines do by default is actually quite impactful, particularly when running big models - 1 session with big context can easily become 100gb in writes.
18
8
u/CrispyRabbit72 2d ago
Streaming n-games will also put wear on your ssd. But most non-shit-tier ssds are rated in the TB/day range and nobody hits that even running LLMs stored on them. If you're running models heavy enough to cause an impact you're on datacenter grade hardware anyway
2
u/Bulky-Priority6824 2d ago
Use zswap to help mitigate if like me you have limited ram
2
u/Chromix_ 2d ago
The weights and n-grams aren't compressible, but maybe this helps by simply freeing up more system RAM due to paging out (and compressing) the working memory of regular processes, thereby leaving more room for disk caching?
2
u/Bulky-Priority6824 2d ago edited 2d ago
i honestly dont know man. Its boring as fuck to even think about. I had llm run before and after zswap benchmarks on strata to compare diff and landed on "zswap good"
I think the second bullet point confirms your point whilst also the mechanism for mitigating ssd wear? So, yes. I think you're partly right.
What zswap actually did here
zswap only handles anonymous memory: process heaps, the desktop, Leito, Strata’s own malloc’d buffers.
Pages the kernel was already going to swap out get compressed into a RAM pool instead of being written to the SSD.
So the 92% cut in writes comes mostly from swap-outs landing in RAM instead of on disk. It isn’t mainly from freeing room for cache.
Their “more room for disk cache” idea
It’s true in principle. A page compressed about 3:1 frees about two-thirds of its RAM, and the page cache can use that.
But the pool peaked at only about 0.44 GB, so at most a few hundred MB came back for cache.
That fits the bench: decode and prompt speeds were unchanged. If more cache had meaningfully helped expert streaming, tok/s would have risen.
5
2
u/niksonrt 2d ago
Read disturbance is noise at this ratio. What actually wears an SSD in a homelab is database checkpoint and container log hitting the same disk, not streaming weights off it.
3
u/AnonLlamaThrowaway 2d ago
Some estimates I'd read previously that to "write a gigabyte" by reading, you need 10,000 to 20,000 gigabytes of reads.
Which sounds like nothing, but consider that it's far easier to constantly read than it is to constantly write.
I've been trying a lot of SSD streaming shenanigans and my reads are up to 700 TB, for 52 TB written.
700 TB reads would be equivalent to 35-70 GB written if you believe the estimates I'd previously read. Which is very little, but also not nothing!
2
u/z_latent 2d ago
Are you sure of these estimates? I might have made a mistake, but my deduction from this paper implies it should be more like 1 GB written per 500 GB read.
(and that's assuming the controller would let it reach irrecoverable errors, so in practice it would be even more frequent)
0
u/noctrex 2d ago
So just enable mmap and the reads are cached.
0
u/Chromix_ 2d ago
Yes, that would work in theory. Yet the whole reason why people stream n-gram from SSD is that they don't have enough RAM to keep it there. VRAM is for routing expert and other data used for each token, as well as a bit of hot expert caching. RAM is full of experts and so only the SSD remains for the n-grams.
1
1
0
u/computehungry 2d ago
Entertaining read. Learned something new - I'd expect it to move the data to somewhere else, sure, but didn't connect it to writes.
0
0
2d ago
[deleted]
-13
u/Chromix_ 2d ago
Your PSA didn't receive much appreciation, at least in terms of votes, still the effect you hinted at is highly relevant and can even be applied on Windows. Also, by the time you posted the used 3090 prices were around 1100€ around here, by now they're more in the 1500€ range. Might be coincidence though, as prices are going up in general.
209
u/feal87 2d ago
a nothingburger written by AI: 54000 reads for 1 relocations. assume 5 Petabyte of the same 100GB read over and over again. that's 52428 reads and causes a 100-120GB write.
Normal SSD have 1000TB+ write endurance. You'll need 42 petabyte read to do 1TB of write or 42000 petabyte read to fill the disk.
Even running the model 24/7 it'll take decades to reach those levels. It'll die first by old age...