My program works very slow if the database is located in Sloaris NFS
server and run it on the Linux box,I tried RH 7,8 and ES3.0. But if I move
the database to local, it works fine. The Linux is 6X slower than Sloaris
or HP-UX in the same condition.
So I wrote a small program to test it and figured out the fseek seems the
bottleneck. And I also try to change the NFS wsize/rsize (from 1024 to 32768), but didnot help!
Any one faced the same issue? Or any suggestion? Thanks in advance!
Actually I'm not sure shall I put this issue here or at Programming Foums,
I will try it here first and seems to be the netowrk NFS issue?
*** Test program *****
#include <stdio.h>
main()
{
FILE *fo;
int ibuf[500],i,one;
one = 1;
memset(ibuf,0,500*sizeof(int));
printf("==> start creating a 500MB file\n");
fo = fopen("./datafile","wb");
for(i = 0 ; i < 10000 ; ++i) {
fwrite(ibuf,sizeof(int),500,fo);
}
fclose(fo);
printf("==> end of file creation\n\n");
printf("==> now starts modifying file\n");
fo = fopen("./datafile","r+b");
for(i = 0 ; i < 2000 ; ++i) {
fseek(fo,50*i,SEEK_SET);
fwrite(&one,sizeof(int),1,fo);
}
fclose(fo);
printf("==> end modifying file\n");