What is going on with random writes on Apple Silicon?

Jimmyjames

Site Champ
Joined
Jul 13, 2022
Posts
993
I noticed something strange from a review X Elite yesterday. There was a comparison between the X Elite and the MacBook Air M3 15”. One section measures ssd performance. Usually the only thing they mention is sequential read and write speed, despite being less important in day to day use for most people. What stood out to me was the discrepancy in random write speeds.

This is the comparison:
1719166898792.png



We can see the random 4k write with a queue depth of 32 is 398 MB/s on the X Elite and 94 MB/s. With queue depth at 1 the X Elite scores 185MB/s while the M3 scores 37MB/s.

At first I thought it might be an issue of the number of nand chips used in the ssd, as there was some discussion of this a year or so ago. It seems like the Air in this example is a 1 TB model, so shouldn’t suffer the same slowdown. Then I thought it might be the result of Apple’s firmware, and their insistence on guaranteeing the ssd actually flushes writes to the nand. Something which doesn’t actually happen on many ssds. Apple writes their own firmware for the shipping ssds to make sure Force Unit Access and F_FULLSYNC is honoured. The drawback of this is it can slow down writes.

Then I tested my 2018 Intel Mac Mini:
1719167238976.png

Hmmmm, why is my six year old Intel box destroying the latest Apple Silicon machines in random writes? I am puzzled.
 
You might want to take a look at the discussion starting here, with post #25:
 
You might want to take a look at the discussion starting here, with post #25:
Hmmm that’s interesting. Not sure I understand it fully. So are we saying there is something in the default page size of 16kb that means Apple is optimising for different read and write sizes? To speed up paging?
 
I have no idea why optimizing for 16Kb pages would make 4Kb performance so much worse, but it does seem to me like testing for 16Kb read/write makes more sense on Apple Silicon
 
I think I forgot this part, but how DMA is implemented is probably a key factor. Intel and Apple Silicon will implement DMA differently, and so I wonder how DMA from the SSD controller is handled in terms of transfer sizes/etc.

I just don't know enough about the space to really have a good idea of what's going on. A lot of my knowledge in this space is something like 20 years old at this point.
 
It looks like the difference is pretty close to a factor of four. If the Mac has to write 16K at a time, that would mean it would have to write 4 4K pages sequentially before it could proceed to the next random write.
 
Back
Top