Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

contiguous files

6 views
Skip to first unread message

Roedy Green

unread,
May 14, 2012, 3:44:26 AM5/14/12
to
In one of my applications I write thousands of small files. If I look
at the result with O&O Defragger it shows that nearly all the files
are fragmented. The fool thing went out of its way to fragment the
files. What makes it even more annoying is that I write these file in
one i/o each.. Surely Java should tell the OS the size it needs ahead
of time and the OS should find a contiguous chunk if possible.

Maybe these files are not being written in one hunk (as a side effect
of encoding). Any thoughts?
--
Roedy Green Canadian Mind Products
http://mindprod.com
Programmers love to create simplified replacements for HTML.
They forget that the simplest language is the one you
already know. They also forget that their simple little
markup language will bit by bit become even more convoluted
and complicated than HTML because of the unplanned way it grows.
.

Boudewijn Dijkstra

unread,
Jul 12, 2012, 3:18:30 PM7/12/12
to
Op Mon, 14 May 2012 09:44:26 +0200 schreef Roedy Green
<see_w...@mindprod.com.invalid>:
> In one of my applications I write thousands of small files. If I look
> at the result with O&O Defragger it shows that nearly all the files
> are fragmented. The fool thing went out of its way to fragment the
> files. What makes it even more annoying is that I write these file in
> one i/o each.. Surely Java should tell the OS the size it needs ahead
> of time and the OS should find a contiguous chunk if possible.
>
> Maybe these files are not being written in one hunk (as a side effect
> of encoding). Any thoughts?

When the write cache becomes full, the disk block allocator becomes sloppy
and may use any free block that is currently near the write head.

Perhaps you can force blocks to be allocated without filling the write
cache, by using RandomAccessFile#setLength(long).

--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/
0 new messages