* rewrite very slow
@ 2008-02-15 19:16 DS
2008-02-16 0:36 ` Eric Sandeen
0 siblings, 1 reply; 5+ messages in thread
From: DS @ 2008-02-15 19:16 UTC (permalink / raw)
To: xfs
Hello,
I need some help to tunning my storage.
Very simple test at begin (perl script test.pl):
#!/usr/bin/perl
$time=time();
for ($i=1;$i<100;$i++)
{
open (SUBOR,">$i.txt");
print SUBOR "aaaaaaaaaaaaaaaaaaa\n";
close (SUBOR);
print "WRITE $i. FILE\n";
}
$time2=time();
$rozdiel_casov=$time2-$time;
print "TIME ".$rozdiel_casov." sekund\n";
First run:
file1:/mnt/hosting/test# ./test.pl
WRITE 1. FILE
WRITE 2. FILE
...
WRITE 98. FILE
WRITE 99. FILE
TIME 0 sekund
Every next run (rewrite existing files) is very very very slow:
file1:/mnt/hosting/test# ./test.pl
WRITE 1. FILE
WRITE 2. FILE
...
WRITE 98. FILE
WRITE 99. FILE
TIME 43 sekund
I try it on ext3. Every run is only 1-3seconds.
I tried tunning my storage.
My last mount specification:
(rw,noatime,nodiratime,nobarrier,osyncisosync,logbsize=256k,logbufs=8,quota)
I tried all possible configuration (barrier, nobarrier, osyncisosync,
logbssize=XX,logbufs=2-8) nothing help me.
file1:/mnt/hosting/test# xfs_info /mnt/hosting/
meta-data=/dev/mapper/vghosting-hosting isize=256 agcount=32,
agsize=7626752 blks
= sectsz=512 attr=2
data = bsize=4096 blocks=244056064,
imaxpct=25
= sunit=0 swidth=0 blks, unwritten=1
naming =version 2 bsize=4096
log =internal bsize=4096 blocks=32768, version=2
= sectsz=512 sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0
I test it on 4 other xfs storages and results was similar.
Any ideas?
Thanks.
Dusan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: rewrite very slow
2008-02-15 19:16 rewrite very slow DS
@ 2008-02-16 0:36 ` Eric Sandeen
2008-02-16 2:46 ` David Chinner
2008-02-16 5:41 ` DS
0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2008-02-16 0:36 UTC (permalink / raw)
To: DS; +Cc: xfs
DS wrote:
> Hello,
>
> I need some help to tunning my storage.
...
> TIME 43 sekund
What kernel? when I test on my 2.6.23.9-85.fc8 and 2.6.22.5 boxes, I
see 2 and 7 seconds for rewrite, respectively.
but granted, on ext3 I get 0 seconds for every run.
Also the difference appears to be O_TRUNC (which the perl script does);
if I code it in c:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
void main(void)
{
int i;
int fd;
char file[4];
for (i = 0; i < 100; i++) {
sprintf(file, "%d.txt", i);
fd = open(file, O_CREAT|O_RDWR|O_TRUNC, 0644);
write(fd, "aaaaaaaaaaaaaaaaaaa\n");
close(fd);
}
}
rewrite is a bit slower w/ O_TRUNC in place, plenty fast w/o it. Not
sure about the xfs/ext3 difference... this is probably a side-effect of
flushes xfs put into place on truncate (IIRC?)
-Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: rewrite very slow
2008-02-16 0:36 ` Eric Sandeen
@ 2008-02-16 2:46 ` David Chinner
2008-02-16 5:43 ` DS
2008-02-16 5:41 ` DS
1 sibling, 1 reply; 5+ messages in thread
From: David Chinner @ 2008-02-16 2:46 UTC (permalink / raw)
To: Eric Sandeen; +Cc: DS, xfs
On Fri, Feb 15, 2008 at 06:36:06PM -0600, Eric Sandeen wrote:
> DS wrote:
> > Hello,
> >
> > I need some help to tunning my storage.
>
> ...
> > TIME 43 sekund
>
>
> What kernel? when I test on my 2.6.23.9-85.fc8 and 2.6.22.5 boxes, I
> see 2 and 7 seconds for rewrite, respectively.
>
> but granted, on ext3 I get 0 seconds for every run.
>
> Also the difference appears to be O_TRUNC (which the perl script does);
> if I code it in c:
>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
>
> void main(void)
> {
> int i;
> int fd;
> char file[4];
>
> for (i = 0; i < 100; i++) {
> sprintf(file, "%d.txt", i);
> fd = open(file, O_CREAT|O_RDWR|O_TRUNC, 0644);
> write(fd, "aaaaaaaaaaaaaaaaaaa\n");
> close(fd);
> }
> }
>
> rewrite is a bit slower w/ O_TRUNC in place, plenty fast w/o it. Not
> sure about the xfs/ext3 difference... this is probably a side-effect of
> flushes xfs put into place on truncate (IIRC?)
Yup - after a truncate we use flush-on-close semantics if the file
is closed before pdflush does writeback. yes, it has a measurable
impact on silly microbenchmarks like this, but nobody even noticed
it when we introduced this code 2-3 years ago...
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: rewrite very slow
2008-02-16 0:36 ` Eric Sandeen
2008-02-16 2:46 ` David Chinner
@ 2008-02-16 5:41 ` DS
1 sibling, 0 replies; 5+ messages in thread
From: DS @ 2008-02-16 5:41 UTC (permalink / raw)
To: xfs
Test configuration:
Linux kernel 2.6.23.1 #1 SMP
2x Intel(R) Xeon(TM) CPU 2.40GHz with HT
iSCSI storage (1TB - 7 sata disks in RAID6, 2GB cache controler)
Yes, your "test" works fine:
file1:/mnt/hosting/test# time ./test
real 0m0.334s
user 0m0.000s
sys 0m0.000s
Is there any way to get it work for perl/php/other scripts/programs?
DS
On Fri, Feb 15, 2008 at 06:36:06PM -0600, Eric Sandeen wrote:
> DS wrote:
> > Hello,
> >
> > I need some help to tunning my storage.
>
> ...
> > TIME 43 sekund
>
>
> What kernel? when I test on my 2.6.23.9-85.fc8 and 2.6.22.5 boxes, I
> see 2 and 7 seconds for rewrite, respectively.
>
> but granted, on ext3 I get 0 seconds for every run.
>
> Also the difference appears to be O_TRUNC (which the perl script does);
> if I code it in c:
>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
>
> void main(void)
> {
> int i;
> int fd;
> char file[4];
>
> for (i = 0; i < 100; i++) {
> sprintf(file, "%d.txt", i);
> fd = open(file, O_CREAT|O_RDWR|O_TRUNC, 0644);
> write(fd, "aaaaaaaaaaaaaaaaaaa\n");
> close(fd);
> }
> }
>
> rewrite is a bit slower w/ O_TRUNC in place, plenty fast w/o it. Not
> sure about the xfs/ext3 difference... this is probably a side-effect of
> flushes xfs put into place on truncate (IIRC?)
>
> -Eric
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: rewrite very slow
2008-02-16 2:46 ` David Chinner
@ 2008-02-16 5:43 ` DS
0 siblings, 0 replies; 5+ messages in thread
From: DS @ 2008-02-16 5:43 UTC (permalink / raw)
To: xfs
Hmm, and what cat I do to get it work now?
DS
On Sat, Feb 16, 2008 at 01:46:34PM +1100, David Chinner wrote:
> On Fri, Feb 15, 2008 at 06:36:06PM -0600, Eric Sandeen wrote:
> > DS wrote:
> > > Hello,
> > >
> > > I need some help to tunning my storage.
> >
> > ...
> > > TIME 43 sekund
> >
> >
> > What kernel? when I test on my 2.6.23.9-85.fc8 and 2.6.22.5 boxes, I
> > see 2 and 7 seconds for rewrite, respectively.
> >
> > but granted, on ext3 I get 0 seconds for every run.
> >
> > Also the difference appears to be O_TRUNC (which the perl script does);
> > if I code it in c:
> >
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <fcntl.h>
> >
> > void main(void)
> > {
> > int i;
> > int fd;
> > char file[4];
> >
> > for (i = 0; i < 100; i++) {
> > sprintf(file, "%d.txt", i);
> > fd = open(file, O_CREAT|O_RDWR|O_TRUNC, 0644);
> > write(fd, "aaaaaaaaaaaaaaaaaaa\n");
> > close(fd);
> > }
> > }
> >
> > rewrite is a bit slower w/ O_TRUNC in place, plenty fast w/o it. Not
> > sure about the xfs/ext3 difference... this is probably a side-effect of
> > flushes xfs put into place on truncate (IIRC?)
>
> Yup - after a truncate we use flush-on-close semantics if the file
> is closed before pdflush does writeback. yes, it has a measurable
> impact on silly microbenchmarks like this, but nobody even noticed
> it when we introduced this code 2-3 years ago...
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> Principal Engineer
> SGI Australian Software Group
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-16 5:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-15 19:16 rewrite very slow DS
2008-02-16 0:36 ` Eric Sandeen
2008-02-16 2:46 ` David Chinner
2008-02-16 5:43 ` DS
2008-02-16 5:41 ` DS
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox