[Samba] slow creating files

Алексей Ганков a.v.gankov at gmail.com
Wed Feb 8 06:10:11 MST 2012


We tried to migrate from old Windows fileserver (p4, single HDD) to 
Samba (FedoraCore15, Samba 3.5.12-72.fc15, ext4 volume, xeon, raid5).
Our pipeline is so, that some special software generates files on that 
fileserver.
The typical filesize ~50 mbytes.
On the old hardware, software (win2k3 server) the time of single file 
creation was about 10 seconds. On the new configuration it takes 20-25 
seconds.
Copying of large files to\from samba server is ok (more than 80 mbytes\sec).
It was default Samba installation.
The usual tuning doesn't help at all (TCPNODELAY etc...)

Is there any idea for tuning?

Also, I wrote easy test that confused me:

#include "stdio.h"
#include "stdlib.h"
#include "time.h"
void main(int argc, char *argv[])
{
int fsize=40000000;
int i=0;
FILE *to;
char 
str[]="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
time_t start, end;
double diff;

time(&start);
to=fopen(argv[1], "w+");
for(i=0; i < fsize/100; i++)
     {
     fprintf(to, "\n%7d-%s",i, str);
/    fflush(to); // makes it slow!/
     }
fclose(to);
time(&end);
diff=difftime(end,start);
printf("\n \t time_diff =  %.2lf", diff);
}

This was started on Win7 client PC, It creates about 40 mbytes size file 
in pointed path.
Comparing timings on our samba share and win2k3 share gives: ~40 seconds 
on Samba and on  3-4 seconds win2k3!
That means that fflush cause dramatically slow down of fileshare.

Alexey


More information about the samba mailing list