chia-plotter icon indicating copy to clipboard operation
chia-plotter copied to clipboard

Add options for a reducing amount of temp2 space used at any given time

Open stevekm opened this issue 3 years ago • 9 comments

Related to #819 and #805

By using a RAM block cache as small as 40GB, almost 50% of writes to a temp2 SSD volume can be prevented.

If would be great if this concept could be extended to adjust chia_plot to restrict the amount of data it is processing at any given time in the temp2 dir such that it might completely fit into a user's RAM block cache or RAM disk.

This kind of feature would be very valuable for the Chia community, since it could give users with less system memory the ability to do more plotting in memory without degrading SSD's. It would also help to negate some of the bad press that Chia gets for it's reputation as an "SSD destroyer".

stevekm avatar Jul 13 '21 16:07 stevekm

Tu ya configuraste para que con 40GB de Ram funcione? Si es así, me podrías explicar porfavor? mi placa no soporta 128 gb de RAM, pero 64 si es una opción

nikobart avatar Jul 13 '21 18:07 nikobart

@nikobart I used PrimoCache on Windows to configure a 40GB L1 cache (Strategy: Write Only, Defer Write period: infinite) for my temp2 SSD volume. This reduced SSD drive writes by about 50%. I believe the Linux equivalent would be to use bcache. My system only has 64GB RAM as well, so this left enough free memory for the Chia plotter and other background tasks

stevekm avatar Jul 13 '21 18:07 stevekm

@nikobart Solía PrimoCache en Windows para configurar una caché L1 de 40 GB (Estrategia: Sólo escritura, Defer periodo Comentario: infinito) para el volumen de mi SSD Temp 2. Esta unidad SSD reduce las escrituras en aproximadamente un 50%. Creo que el equivalente de Linux sería usar bcache. Mi sistema solo tiene 64 GB de RAM, por lo que esto dejó suficiente memoria libre para el trazador Chia y otras tareas en segundo plano.

Muchas Gracias! última duda, la velocidad de trazado se vio afectada?

nikobart avatar Jul 13 '21 18:07 nikobart

Nice idea! However, at least for me, be careful with PrimoCache....latest Win10 x64 and after reboot, during restart, had multiple BSODS and had to hard reset.

The equivalent Linux version would be rapiddisk, but it is quite coumbersome to build/install/use (recompiling kernel etc..)

Would be nice to have a guide for Linux with bcache (or eventually LVM too since it supports caching). I'll start with few commands as example:

installing bcache

sudo apt-get update sudo apt-get upgrade sudo apt-get install bcache-tools

creating & mounting ramdisk

sudo mkdir /mnt/ramdisk sudo mount -t tmpfs -o size=2G ramdisk /mnt/ramdisk sudo mount -a

creating bcache device

sudo wipefs -a /dev/ssd -> this will wipe ssd sudo make-bcache -B /dev/ssd -C /mnt/ramdisk --discard --writeback sudo mkfs.ext4 /dev/bcache0

deleting bcache device

sudo umount -v /dev/bcache0 sudo su - -c "echo 1 >/sys/fs/bcache/device_uuid/unregister" sudo su - -c "echo 1 >/sys/block/bcache0/bcache/stop"

the problem im facing is that, after creating the ramdisk, I launch sudo make-bcache and get the following error: Cannot use "/mnt/ramdisk", it is a folder"....Any idea?

wavepacket0 avatar Jul 14 '21 15:07 wavepacket0

PrimoCache results:

  • win10 latest
  • 1x nvme as tmpdrive & tmpdrive2 (21G, write only, defer time infinite, block size 4k)
  • Total write req 1.12TB (host)
  • Total disk write 0,99TB

this is about a 11% of saved writes per plot (confirmed also by CrystaldiskMark). Plot time barely affected (48min ubuntu, 51min win10)

wavepacket0 avatar Jul 14 '21 17:07 wavepacket0

the problem im facing is that, after creating the ramdisk, I launch sudo make-bcache and get the following error: Cannot use "/mnt/ramdisk", it is a folder"....Any idea?

You can't use bcache with a tmpfs ramdisk. You need block device. brd module does it.

kareem613 avatar Jul 14 '21 22:07 kareem613

new test done:

  • E:\ tempdrive1 | D:\ tempdrive2
  • cache enabled on D:\
  • cache info: 25GB, block size 4kb, write only, defer write infinite, mode native, empty data written from cache
  • 1.12TB / 1.43TB -> 21.7% saved ssd writes -> about 300GB per plot
  • 6% faster plot time compared to ubuntu

wavepacket0 avatar Jul 15 '21 21:07 wavepacket0

PrimoCache results:

  • cache enabled on tempdrive2
  • cache info: 55GB, block size 4kb, write-read , defer write infinite, mode native, empty data written from cache.
  • tempdrive2 total write 991GB / write to disk 394GB -> 594Gb saved ssd writes
  • plot time drop from 48 min to 40 min

rnizametdinov avatar Jul 28 '21 02:07 rnizametdinov

@wavepacket0 Any luck making it work with bcache in Ubuntu ?

Enissay avatar Nov 11 '21 08:11 Enissay