Hi,
AFAICS, the og file contains a buffer which stores UserLogRecord until
we write them on disk. This allows the Log system to be fast, and also
allow a dedicated thread to flush the data on disk regularly.
So far, so good.
But I'm wondering if it would'nt be simpler to use a MemoryMappedFile
instead, as the Log file size is fixed. We will then let the underlying
OS to deal with flushes, not needing a dedicated thread to handle it.
Also MemoryMappedFile are faster than RandomFile, as it's working on
pages, which are managed by the OS (their size is depending on the OS
tuning). Last, not least, we won't need to dedicate a 4Mb buffer to
store temporary userRecords, as MemoryMappedFiles aren't using the JVM
memory.
The only modification would be to check that the file is not full, and
if so, we will just have to create a new one.
Concurrent access to the file are also protected by the
MemoryMappedFile, we don't need to do anything but to declare the kind
of access we want on the portion of the file we wanyt to access.
thoughts ?
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com