Some older SSDs choke if you hit them with more than one request. Perfect example - the old JMF602 and JMF602 B controllers (with 2KiB and 4KiB of cache) would often lock up if they had to process more than one request. 1 request = 1ms, 2 requests = 700-3000ms. 3 requests = oh my god kill me now.
No algorithm is going to be designed that can detect that - and if it is, it probably takes away from FancyCache in other ways. IMO this is another reason to implement an advanced mode, where things like this can be tweaked:
viewtopic.php?f=26&t=759#p2145
viewtopic.php?f=26&t=780#p2144
So things on the list: Average Write Queue Depth, Average Write Trigger, Block Write Size
Since I like the idea behind Averaging writes, I'll provide examples of possible options that could be used to adjust its behaviour, and also some example values for different drives.
Average Write Max Queue Depth - the max write queue depth FancyCache will go to. This is in blocks - not in Filesystem writes.
Average Write Pref Queue Depth - the preferred queue depth FancyCache tries to go to. This is in blocks - not in Filesystem writes.
Average Write Trigger Time - The amount of time the drive must be "idle" for writes to be queued.
Average Write Trigger - The amount of data that must be exceeded for the drive to not be considered "idle".
Max Block Write Size - The maximum block write size.
Pref Block Write Size - The preferred block write size. (to avoid impacting responsiveness)
Sucky SSD: (50-150MB/sec sequential, 0.2MB/sec 4k, 1 - 3000ms access times)
Average Write Max Queue Depth - 1
Average Write Pref Queue Depth - 1
Average Write Trigger Time - 100ms
Average Write Trigger - 128KiB
Max Block Write Size - 256KiB
Pref Block Write Size - 16KiB
The SSD must be idle (read/write less than 128KiB in 100ms) for the averaging writes to kick in. (Or if the write cache is full, that will trigger it) Then FancyCache tries to write one 16-256KiB block, and waits for the drive to be idle again.
Average HDD: (100-150MB/sec sequential, 0.5 - 1MB/sec 4k, 10 - 13ms access times)
Average Write Max Queue Depth - 6
Average Write Pref Queue Depth - 2
Average Write Trigger Time - 30ms
Average Write Trigger - 128KiB
Max Block Write Size - 2048KiB
Pref Block Write Size - 512KiB
The HDD must be idle (read/write less than 128KiB in 30ms) for the averaging writes to kick in. (Or if the write cache is full, that will trigger it) Then FancyCache tries to write 2-6 blocks up to 2048KiB in size. If the blocks are larger, less writes are queued. If the blocks are smaller, it gets closer to the max queue depth. Then FancyCache waits for the drive to be idle again.
Good SSD: (200MB/sec sequential, 10MB/sec 4k, 0.1 - 0.4ms access times)
Average Write Max Queue Depth - 200
Average Write Pref Queue Depth - 4
Average Write Trigger Time - 4ms
Average Write Trigger - 64KiB
Max Block Write Size - 2048KiB
Pref Block Write Size - 256KiB
The SSD must be idle (read/write less than 64KiB in 4ms) for the averaging writes to kick in. (Or if the write cache is full, that will trigger it) Then FancyCache tries to write 4-200 blocks up to 2048KiB in size. If the blocks are larger, less writes are queued. If the blocks are smaller, it gets closer to the max queue depth. Then FancyCache waits for the drive to be idle again.
Great SSD: (600MB/sec sequential, 40MB/sec 4k, 0.1 - 0.4ms access times)
Average Write Max Queue Depth - 400
Average Write Pref Queue Depth - 20
Average Write Trigger Time - 4ms
Average Write Trigger - 128KiB
Max Block Write Size - 4096KiB
Pref Block Write Size - 512KiB
The SSD must be idle (read/write less than 128KiB in 4ms) for the averaging writes to kick in. (Or if the write cache is full, that will trigger it) Then FancyCache tries to write 20-400 blocks up to 4096KiB in size. If the blocks are larger, less writes are queued. If the blocks are smaller, it gets closer to the max queue depth. Then FancyCache waits for the drive to be idle again.
The algorithm would have to understand that it's trying to balance out the number of writes against the amount of data, to avoid an unresponsive system. Low queue depths tell it that it's dealing with a HDD or bad controller, while allowing high max queue depths tells it the drive can handle it. High max block write size indicates high sequential speeds, but FancyCache does have to factor in that time is spent writing and scale back the write queue depth accordingly.
Maybe FancyCache already does something like this - but being able to tweak the raw values would help us fine tune the behaviour we want to our hardware. We'd do the experimenting for you and report back on what works for our hardware, so your coders don't have to.