Archived from groups: alt.comp.hardware,alt.comp.lang.borland-delphi,comp.sys.ibm.pc.hardware.storage,microsoft.public.win32.programmer,microsoft.public.windowsxp.hardware (
More info?)
"Nathan McNulty" <525676@betaweb.com> wrote in message
news:OauKdFeaEHA.1048@tk2msftngp13.phx.gbl...
> Actually, what is happening is that the heads on the platter need to
> reconfigure themselves each time you read or write. It is a hardware
> limitation. By reading, the head can stay in the same location, but
> once it is told to write, the head has to position itself to change the
> magnetism of the sector of the platter it is on. Then once you request
> to read again, the head has to move again. It is the same as seek time
> when you have two files on different partitions it is going to take
> longer to find those files than if they were right next to each other.
Yes, a hardware limitation seems to make more sense.
I changed the code to this pseudo code, to illiminate the randomness and
make it regular switching:
if BooleanRead then
begin
Read 4 KB
BooleanRead := false;
end else
begin
Write 4 KB
BooleanRead := true;
end;
This will cause regular switching like:
Seek, Read, Write, Read, Write, Read, Write, etc
Instead of randomness like:
Seek, Read, Read, Write, Read, Write, Write, etc
My harddisk performs as follows for these 3 concepts (with the updated
concept 3 )
Concept 1 ( Reading )
It achieves 8 MByte/Sec to 12 MByte/Sec for reading a 36 MB file. ( with 4
KB block buffer )
After a few seconds the harddisk led stops burning. The speed increases to
100 or 180 MByte/Sec.
This is ofcourse only possible because it's fetched from some RAM I think. I
am not sure if it is coming from the Harddisk Read Cache or Windows XP file
cache... or whatever it's called. My guess would be Windows XP's file cache.
Concept 2 (Writing )
This test is very fluctating... sometimes 600 Kbyte/sec at worst...
sometimes a peak to 36 MByte/Sec.
Mostly it's 2 MByte/Sec with some peaks to 4 MByte/Sec.
My file system is pretty fragmented though.
Concept 3 ( Reading / Writing )
Well this is also pretty weird.
Sometimes it's 80 KByte/sec to 400 KByte/Sec.
Now it's 1 to 2 MByte/Sec
I suspect the small file size of only 36 MByte has to do with that.
So I will now test again on 100 MB file, to prevent any caching or to detect
it... possibly memory jump in task manager.
Concept 1 (Reading)
This time the speed is pretty constant. 8 MByte/Sec... with some lower peaks
to 6MByte/Sec and a few high peaks to 9 MByte/Sec.
But no more caching apperently in windows xp...
8 MByte/Sec or any multiple of MByte/Sec is what I would call good
performance.
This is in the light of my file transfer tool and 100 Megabit network cards
which are common nowadays.
100 Megabit is roughly 8 MByte/Sec or so... give or take a few...
Not that my file transfer tool reaches these speeds just... it has problems
with harddisk
=D
One more artificact of my benchmark programs after stop the test it takes a
while stop... probably because of the for loop... no big deal.
Concept 2 ( Writing )
Well this time writing was a lot thougher... 1 MByte/Sec to max 2
MByte/Sec... the program is less responsive than the read program... but
code is almost the same... and multi threaded. But not using async stuff...
just sync stuff
At least I think so
However async stuff aint that
great either
Since I wrote a program to do async stuff as well. So never mind that
Now comes the big test, since it's getting late
Concept 3 (Reading and Writing, with regular switches )
Oh my... now that's what I call bad performance !
The first 10 seconds it was 80 Kbyte/Sec... the next 20 seconds 160
Kbyte/sec.
Max was 200 KByte/sec.
So it seems switching from read to write to read to write requires extra
seeking etc...
Maximum seek time for my HD and most HD's is 20 milliseconds.
Average Seek time is around 10 to 15 milliseconds.
So that means 50 seeks per sec for worst case.
The buffer is 4 KB...
50x4 KB = 200 KB.
That's pretty amazing... the harddisk performs even worse than the worst
case scenerio.
I did not expect that.
Well I found this document about my harddisk...
It contains some information about seek times and such.
However the term 'Head Switch' means something else in this case.
It means moving from track to next track or something I think...
As far as I could tell there is no mentioning of latency from read to write
to read to write etc...
Or maybe I missed it... Anyway time for me to call it a day.
http://www.hitachigst.com/tech/techlib.nsf/techdocs/85256AB8006A31E587256A7A006F9551/$file/dtta_sp.pdf
Bye,
Skybuck.
This clearly indicates the file
With the new code my harddisk now performs in the range of:
80 KByte / Sec to 400 KByte / Sec which I call poor/bad performance.
Concept 1 ( The Reading ) can achieve easily 8 MByte/Sec to 12 MByte/Sec.
After a few seconds on a 36 MB file it achieves 180 MByte/Sec this is
probably from Windows XP cache or maybe Harddisk Cache ?
The harddisk is completely silent. I can't imagina th
can achieve 1 MByte / Sec up to 12 MByte/Sec
>
> Nathan McNulty
>
> kony wrote:
>
> > On Wed, 14 Jul 2004 17:53:52 +0200, "Skybuck Flying"
> > <nospam@hotmail.com> wrote:
> >
> >
> >>Hi,
> >>
> >>Take these 3 concepts and then look at the implementation/performance:
> >>
> >>( 3 Concepts for reading/writing with harddisks )
> >>
> >>Concept 1:
> >>
> >>Seek, Read, Read, Read, Read, Read, Etc
> >>
> >>Results: FAST
> >>
> >>Concept 2:
> >>
> >>Seek, Write, Write, Write, Write, Write, Etc
> >>
> >>Results: FAST
> >>
> >>Concept 3:
> >>
> >>Seek, Read, Write, Read, Write, Read, Write,
> >>
> >>Results: SLOW ???
> >>
> >>The pseudo code is like:
> >>
> >>Seek( 0 ); // offset 0
> >>
> >>For I:=0 to FileBlocks-1 do // number of 4KB blocks in file.
> >>begin
> >> if Random(2) = 0 then
> >> Read( 4 KB )
> >> Else
> >> Write( 4 KB );
> >>end;
> >>
> >>The original concept is:
> >>
> >>Do a seek once.
> >>
> >>Then read or write a block of data. The head is automatically forwarded
to
> >>the next block. So no extra seek is needed.
> >>
> >>For concept 1 and concept 2 this works just fine and gives good
performance.
> >>
> >>However concept 3 has very bad performance.
> >>
> >>Is this a software issue ? ( Windows XP )
> >>
> >>Is this a hardware issue ? ( Harddisk Read Head and Harddisk Write Head
> >>can't work together like this and an extra seek is needed ? )
> >>
> >>Or some sort of driver issue ? ( Harddisk driver / firmware issue ? )
> >>
> >>Bye,
> >> Skybuck.
> >>
> >
> >
> >
> > I may not know the answer but feel an important question might be
> > "What is very bad performance?", compared to good performance...
> > numbers are our friends.
> >
> > Could it simply be that you're switching back and forth with data
> > flow so the caching (on the drive) isn't effective?