Saving a database that is a bundle with lots of smaller data files in it. I used to be able to save the entire thing in a fraction of a second, I use atomic saves by writing to a temporary file in the same folder and then calling ExchangeFilesMBS to swap the two. This has always worked great, but since updating my test boxes to High Sierra it takes FOREVER. I did some profile and 90% or more of the 10 seconds it now takes to do what used to take 1.5 is inside the ExchangeFilesMBS call. This is on an almost brand new macbook pro with the built in SSD, same problem on other machines with SSDs.
On High Sierra with an APFS drive I can only swap 16 files in an entire second! When I move the database bundle to an external USB drive that is formatted to journaled HFS+ I can swap almost 200 files in the same second even though its not a fast drive.
Has anyone else noticed this slowdown or have any recommendations on what to do about it? Or is there a new way to do this swap on the new file system that I should ask Christian to implement in the MBS plugins?
That one is definitely better! I can do 40 exchanges in a second as opposed to the 16 with the original. Its still far from the 200 a second I can do even on a slow external drive though. I suspect Apple has broken something in their APFS…
Well, we nowhave three apis in use
- latest rename api
- Exchange function which is deprecated
- old code to do it ourselves
I hope they tune the new api…
Thank you Christian for the fantastic speed of support! Im going to explore other options too like alternating between 2 files and loading whichever is there and never exchanging the files at all. But that will require some other structural changes in the app and Im not sure it will gain me very much. I already wasted a bunch of time trying to do that but leave an alias behind that pointed to the currently active file, that seemed like a good idea at the time But dealing with aliases is a bit of a pain and Id have had to delete and re-create the alias every time too. Ugh… For now Im going to use that plugin and try to limit the number of writes and exchanges I do at one time to spread out the load.