-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid slow CI tests on MACOS_X using build flag
Build with MACOS_IGNORE_FULLFSYNC=1 to build a version of Roc ksDB which does not HAVE_FULLFSYNC and is therefore much faster at some intensive open/close operations, such as are often found in testing. DO NOT use this in production, or in performance testing. e.g $ make clean jclean $ MACOS_IGNORE_FULLFSYNC=1 make -j12 rocksdbjava This turns off the default -DHAVE_FULLFSYNC (on Mac only) on platform detection, which has a huge cost on open/close testing due to very conservative flush safety - using `fcntl(fd_, F_FULLFSYNC)` Same option is also added to cmake build to turn off FULLFSYNC on MacOS build
- Loading branch information
1 parent
09d7f6a
commit 95d059c
Showing
4 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
java/src/test/java/org/rocksdb/OpenFSyncPerformanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.rocksdb; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* This test is intended to be run on MacOS | ||
* It is used to compare/validate versions of RocksDB built using | ||
* `make clean jclean; make -j12 rocksdbjava` | ||
* versus versions built using | ||
* `make clean jclean; MACOS_IGNORE_FULLFSYNC=1 make -j12 rocksdbjava` | ||
* The latter run this test about 10x faster on MacOS. | ||
* @link <a href="https://github.com/facebook/rocksdb/issues/13147">...</a> | ||
* `MACOS_IGNORE_FULLFSYNC` can be used to build fast test-only versions of RocksDB for efficient CI usage | ||
*/ | ||
public class OpenFSyncPerformanceTest { | ||
|
||
@Test | ||
public void testOpen() throws RocksDBException { | ||
int count = 100; | ||
ArrayList<Long> deltas = new ArrayList<>(count); | ||
long sum = 0; | ||
for (int i = 0; i < count; i++) { | ||
long start = System.currentTimeMillis(); | ||
try(RocksDB db = RocksDB.open("test-open-" + i)) { | ||
long delta = System.currentTimeMillis() - start; | ||
//System.out.println("RocksDB.open() cost:" + (delta)); | ||
sum += delta; | ||
deltas.add(delta); | ||
} finally { | ||
RocksDB.destroyDB("test-open-" +i, new Options()); | ||
} | ||
} | ||
long mean = sum / count; | ||
long variance = 0; | ||
for (long d : deltas) { | ||
variance += (d - mean) * (d - mean); | ||
} | ||
double sd = Math.sqrt((double) (variance/count)); | ||
System.out.println("RocksDB.open() mean cost:" + (sum/count) + ", SD: " + sd + ", count: " + count); | ||
} | ||
} |