Re: ResourceStore and its saving/flush strategies for writing out configuration to disk

On Thu, 28 Jun 2007, Christian Weber wrote:

>
> i have a question regarding the ResourceStore on how changes to the Jigsaw 
> configuration are saved/flushed to disk.
> Assuming the following Scenario:
>
> The Jigsaw server is running and the computer crashes, so that Jigsaw has no 
> time to shutdown anymore.
> I'm currently examine this Scenario, because this happens a few days ago, not 
> to me, but i'm used to examine this case and shall find out, whether it is 
> possible that Jigsaw has corrupted the files, because it wasn't able to 
> shutdown properly, while the computer crashed, or if it's not possible that 
> Jigsaw corrupts the configuration files and isn't able to recover from this 
> at the next startup.


> In order to understand why this happend, it would be great, if you could say, 
> which of the following "Jigsaws saving Policies" are correct or if it is 
> handled different.
>
> These strategies comes into my mind:
> - Does Jigsaw loads the configuration, once at the startup, and further 
> doesn't touch the configuration files for
>   writing while running, so it only writes the configuration back from 
> memory to disk at shutdown?
>
> - Or does Jigsaw additionally writes out configuration changes to disk 
> periodically.
>
> - Does Jigsaw flush changes, made in the AdminGUI, immediately to disk after 
> commiting and saving them or are the
>   changes just altered in memory and get written out at shutdown or some 
> periodically save procedure?


Jigsaw's configuration is cached partially (or completely) read from the 
disk to the memory. You can tune the number of stores (roughly 
corresponding to the number of directories in store a time t), to make it 
larger. (org.w3c.jigsaw.loadedstore=..)

When the internal store cache is full, and a new one is read and the LRU 
one is flushed. Only if a change happened in the configuration, the 
flushed store will effectively be serialized to the disk.
When something is serialized, it is saved first in a temp file, then the 
temp file replace the old one.
The same happens ehwn the server is shut down (using the shutdownhook).

When something is edited using the GUI, you need to click on 'Save' to 
flush the changes to the disk, otherwise it will be done only during 
shutdown, or if the impacted store is flushed.

You can tune also the limit where the stores are no longer flushed 
automatically (as they would be too big to save/load and impact the server 
performances... Typically over 1000 entries per store).
Hope this answers your questions.
Cheers,

-- 
Baroula que barouleras, au tiéu toujou t'entourneras.

         ~~Yves

Received on Monday, 2 July 2007 18:17:35 UTC