[jdev] High Volume & Temporary Files

Matthias Wimmer m at tthias.net
Wed Mar 24 14:57:03 CST 2004


Hi Dave!

Dave Jarvis schrieb am 2004-03-23 16:08:45:
> 1) Copy all XML elements in the testing.xml file into the temporary 
> file, up until the closing elements.
> 2) Append the new message onto the end of the temporary file.
> 3) Write the closing elements.
> 4) Rename the temporary file over the existing file.

It's a but worse. Not just reading up to the end, adding and closing.
It starts with parsing the XML file, appending the new message in memory
and writing the complete XML tree to the disk again.

> If the file can be locked, I would recommend changing the algorithm:
> 1) Read from the end of the file until the last message
> 2) Truncate the file from the end of that message
> 3) Write the new message
> 4) Write whatever was truncated

That works well with binary files, but its hard to implement this in XML
fashion. If you need that many messages, it's really better to use an
other storage backend as Maqi proposed.


Tot kijk
    Matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20040324/4c354ea5/attachment-0002.pgp>


More information about the JDev mailing list