mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 09:06:21 +01:00
more flushtest
This commit is contained in:
parent
a4c7aae14c
commit
b726cbeed5
@ -47,10 +47,10 @@ int main(int argc, char* argv[], char *envp[] ) {
|
||||
fwrite("abc", 3, 1, f);
|
||||
fflush(f);
|
||||
fsync( fileno( f ) );
|
||||
sleepmillis(10);
|
||||
sleepmillis(2);
|
||||
}
|
||||
int ms = t.millis();
|
||||
cout << "flush with sleeps intermixed: " << ms << "ms, " << (ms-5000) / 500.0 << "ms/request" << endl;
|
||||
int ms = t.millis() - 500 * 2;
|
||||
cout << "flush with sleeps: " << ms << "ms, " << ms / 500.0 << "ms/request" << endl;
|
||||
}
|
||||
|
||||
char buf[8192];
|
||||
@ -82,14 +82,14 @@ int main(int argc, char* argv[], char *envp[] ) {
|
||||
buf[0]++;
|
||||
fflush(f);
|
||||
fullsync(fileno(f));
|
||||
sleepmillis(10);
|
||||
sleepmillis(2);
|
||||
}
|
||||
int ms = t.millis();
|
||||
cout << "fullsync with sleeps intermixed: " << ms << "ms, " << (ms-5000) / 500.0 << "ms/request" << endl;
|
||||
int ms = t.millis() - 2 * 500;
|
||||
cout << "fullsync with sleeps: " << ms << "ms, " << ms / 500.0 << "ms/request" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// with noatime
|
||||
// without growing
|
||||
{
|
||||
fclose(f);
|
||||
/* try from beginning of the file, where we aren't appending and changing the file length,
|
||||
@ -107,5 +107,24 @@ int main(int argc, char* argv[], char *envp[] ) {
|
||||
cout << "fullsync without growing: " << ms << "ms, " << ms / ((double) n) << "ms/request" << endl;
|
||||
}
|
||||
|
||||
// without growing, with delay
|
||||
{
|
||||
fclose(f);
|
||||
/* try from beginning of the file, where we aren't appending and changing the file length,
|
||||
to see if this is faster as the directory entry then doesn't have to be flushed (if noatime in effect).
|
||||
*/
|
||||
f = fopen("/data/db/temptest", "r+");
|
||||
Timer t;
|
||||
int n = 500;
|
||||
for( int i = 0; i < n; i++ ) {
|
||||
fwrite("xyz", 3, 1, f);
|
||||
fflush(f);
|
||||
fullsync(fileno(f));
|
||||
sleepmillis(2);
|
||||
}
|
||||
int ms = t.millis() - 2 * 500;
|
||||
cout << "fullsync without growing with sleeps: " << ms << "ms, " << ms / ((double) n) << "ms/request" << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user