fileMenu.save only saves the changed stuff

In a message to the Frontier-kernel list, Steve Hooker explains how he tweaks the performance of his Frontier server.

Central to his strategy is to limit the number of calls to the kernel verb fileMenu.save, assuming that this causes the whole database to be written each time. It’s not true. It only saves the stuff that’s new or changed. Objects that haven’t changed are not written.

This is why the database grows in size over time. If, when an object changes, it grows larger, it won’t fit into the space it used to occupy, so Frontier allocates a new, larger object and adds the old smaller one to the free list. It will try to re-use it, but if it can’t the database grows. This is why fileMenu.saveCopy creates a smaller database, it has none of the unused objects on the old version’s free list.

I have my servers save all modified databases every three minutes. If a file hasn’t changed, it doesn’t take any time to save it. If you don’t do this, and Frontier should crash, or you just quit the app, the changes will be lost.

Here’s a screen shot of the code that saves the changes.

A picture named savingCode.gif

If you have any questions about how the guts of Frontier works, ask — if I don’t know the answer I may be able to find out for you.

2 responses to this post.

  1. Ah-Ha! And awww thanks πŸ˜‰ That explains a lot. Now I see what I squish out every night.

    I do save everything every 10 minutes, now I’m on a much faster machine. And I miss out a lot of roots that shouldn’t change anyway, no point even looking. I think I’ll try every three minutes and see how it ‘feels.’ I don’t crash very often at all and save when anything new happens anyway.

    I’ve got one school who emails in 30 pictures in one news item. Each picture also becomes a message. I skip saving the pictures till the news item, then save the root. The root is normally about 36Mb, but swells to 225Mb after such. I guess that bloat is mainly the picture data, which I later clear. It is painful to save 225Mb, and sometimes she’ll email 4 or 5 such news items with 30 pictures each, so there’s 4 or 5 ouches over half an hour πŸ™‚
    http://bodnantinfants.educatr.com/

    Now, I can see that I really need to take the whole damned email operation off onto another machine and XML-RPC the tiny new messages over. And sucking down one huge email with all that JPEG data into one string object… Chopping out the pictures, thumbnailing… Yeah… Another machine.

    Thanks Dave

    Reply

  2. My mistake. The root is 36Mb, she emails stuff to pad it out to 225Mb, but I’m only saving the new stuff each save. I geddit πŸ™‚

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: