Java Code Examples for org.rocksdb.DBOptions#setMaxOpenFiles()

The following examples show how to use org.rocksdb.DBOptions#setMaxOpenFiles() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultConfigurableOptionsFactory.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public DBOptions createDBOptions(DBOptions currentOptions) {
	if (isOptionConfigured(MAX_BACKGROUND_THREADS)) {
		currentOptions.setIncreaseParallelism(getMaxBackgroundThreads());
	}

	if (isOptionConfigured(MAX_OPEN_FILES)) {
		currentOptions.setMaxOpenFiles(getMaxOpenFiles());
	}

	return currentOptions;
}
 
Example 2
Source File: StorageOptionsFactory.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
public static DBOptions getDefaultRocksDBOptions() {
    // Turn based on https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide
    final DBOptions opts = new DBOptions();

    // If this value is set to true, then the database will be created if it is
    // missing during {@code RocksDB.open()}.
    opts.setCreateIfMissing(true);

    // If true, missing column families will be automatically created.
    opts.setCreateMissingColumnFamilies(true);

    // Number of open files that can be used by the DB.  You may need to increase
    // this if your database has a large working set. Value -1 means files opened
    // are always kept open.
    opts.setMaxOpenFiles(-1);

    // The maximum number of concurrent background compactions. The default is 1,
    // but to fully utilize your CPU and storage you might want to increase this
    // to approximately number of cores in the system.
    opts.setMaxBackgroundCompactions(Math.min(Utils.cpus(), 4));

    // The maximum number of concurrent flush operations. It is usually good enough
    // to set this to 1.
    opts.setMaxBackgroundFlushes(1);

    return opts;
}
 
Example 3
Source File: DefaultConfigurableOptionsFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public DBOptions createDBOptions(DBOptions currentOptions) {
	if (isOptionConfigured(MAX_BACKGROUND_THREADS)) {
		currentOptions.setIncreaseParallelism(getMaxBackgroundThreads());
	}

	if (isOptionConfigured(MAX_OPEN_FILES)) {
		currentOptions.setMaxOpenFiles(getMaxOpenFiles());
	}

	return currentOptions;
}
 
Example 4
Source File: DefaultConfigurableOptionsFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public DBOptions createDBOptions(DBOptions currentOptions, Collection<AutoCloseable> handlesToClose) {
	if (isOptionConfigured(MAX_BACKGROUND_THREADS)) {
		currentOptions.setIncreaseParallelism(getMaxBackgroundThreads());
	}

	if (isOptionConfigured(MAX_OPEN_FILES)) {
		currentOptions.setMaxOpenFiles(getMaxOpenFiles());
	}

	return currentOptions;
}