Re: lseek/write
- From: golden <iang@xxxxxxxxxxxxx>
- Date: Mon, 19 Nov 2007 19:39:06 -0800 (PST)
On Nov 19, 2:33 pm, David Schwartz <dav...@xxxxxxxxxxxxx> wrote:
On Nov 18, 5:19 pm, golden <i...@xxxxxxxxxxxxx> wrote:
I have a question regarding disk IO performance. I would like to
understand why exactly writes to a disk are faster when I use lseek as
opposed to not using lseek. The snippet of code that I am using is as
follows:
Your test does two very different things. If 'lseek' is called, it
keeps overwriting the same piece of information. If 'lseek' is not
called, it keeps writing new information each time. It slows down when
you remove the 'lseek' because with the 'lseek' the writes cannot fit
in cache and with it, they can.
Ahhh... so without the write buffer, i continuously add to my buffer
cache. When I call fsync i flush the cache to disk but only the new
data is actually written to disk?
I would imagine that the write keeps track of the pointer after each
write, but my test does not bear that out.
Actually, your test bears that out. Why do you think not?
Ultimately, I am trying to determine why writes are faster to my local
disk than to my SAN storage (EMC w/ cache).
There's really no reason they should be, depending on how your SAN is
set up.
When I use the fsync,
writes are slower to san.
Well, duh. Synching is slow.
When I do not use the fsync, writes are
faster.
Right. Not synching is faster than synching.
I would appreciate any information regarding t his topic.
What do you find surprising exactly?
What I am trying to determine is why my writes are faster to my local
disk than to my SAN ( all things being equal) . If I remove the
fsync, my write is faster to the SAN. I assume that the OS handles
the writes far more effeciently in this case. When I fsync after each
write i remove any performance enhancements the OS can provide. So
The only conclusion I can come up with is that there are more hops to
the SAN. The transfer from memory to local disk cache is faster than
the fiberchannel path.
Thanks,
DS
.
- Follow-Ups:
- Re: lseek/write
- From: David Schwartz
- Re: lseek/write
- References:
- lseek/write
- From: golden
- Re: lseek/write
- From: David Schwartz
- lseek/write
- Prev by Date: Re: Running an application on startup in embedded linux
- Next by Date: Question on usb
- Previous by thread: Re: lseek/write
- Next by thread: Re: lseek/write
- Index(es):
Relevant Pages
|