I suspect that Use Case makes a difference which is why you are apt to see different options.
From the TrueNAS AI:
My personal take is:
Turning on TRIM could be a good thing as it typically will improve the longevity of the SSD.
Turning on TRIM can also impact a system that is moving a lot of data.
So, if you are not constantly moving large amounts of data all the time, TRIM is a good thing. If you do move large amounts of data, then it is worth testing if TRIM ON impacts the system where you feel it is harming performance of your system.
And my personal take is purely my opinion, not factually tested by me.
I think the issues comes from the fact that ZFS does not need to write a block with all zeros for it to be marked as unused, it just deletes the reference.
Also when zeroing out a block on a NVMe/SSD comes with a write cost. However I do not know if newer devices actually need to write zeros to a block to mark it as unused on a hardware level any more when it can just delete the reference in the internal mapping section.
I assume that Virtual machines still need to zero out blocks so the TRIm command is passed upstream, but again I am not 100% on this.
I would assume in either case, a zero’ed out block would still trigger the block to be recognised as unused.
Have you checked if your devices support TRIM? Most manufactured today do, but I would not say all.
I have always thought the blocks are erased, but to be honest, I’m not sure if that means writing 0’s to it or if there is an erase state and it is just waiting for data to be written. But I know in the past it was write 0’s and then the block is trimmed. Technology changes so fast.
My thoughts are that when an operating system deletes a file without the drive using TRIM (SSD) or DEALLOCATE (NVMe), then the controller has to do a read, modify, erase, write cycle when new data is written to those blocks the deleted file occupied. During low usage periods the drive will run garbage collection but would still need to do a read, modify, erase cycle. This all will result in increased wear and lower performance on the drive.
When using Trim the command tells the drive controller the blocks no longer contain valid data and can be cleared, and the drive controller tracks that. Trim also tells garbage collection which blocks no longer contain valid data (and it tracks that) so the drive won’t need to read and erase the old data from the blocks. This cuts down on wear of the memory cells.
Which means when Trim is used the controller can directly write to the blocks. So using trim should result in better overall performance, better wear leveling, and increased life for the drive.
I generally turn on TRIM for any SSD’s or NVMe drives I use. On the robots at work we greatly increased the life of the ssd’s by turning trim on with no impact on performance. Current Windows versions I think by default enables TRIM on any SSD’s and NVME drives.
Personally, I think my head would explode trying to design a SSD or NVMe and figure all this out.