.setCreateMissingColumnFamilies(true) .setIncreaseParallelism(rocksThreads) .setMaxBackgroundCompactions(rocksThreads) .setInfoLogLevel(InfoLogLevel.INFO_LEVEL); dbOptions = options;
dbOptions.setCreateIfMissing(true); dbOptions.setMaxBackgroundFlushes(2); dbOptions.setMaxBackgroundCompactions(2); ColumnFamilyOptions familyOptions = new ColumnFamilyOptions(); familyOptions.setTargetFileSizeBase(fileSizeBase);
@Override public DBOptions createDbOptions(DBOptions currentOptions) { if (currentOptions == null) currentOptions = new DBOptions(); currentOptions.setCreateIfMissing(true); currentOptions.setCreateMissingColumnFamilies(true); //currentOptions.setMemTableConfig(new HashLinkedListMemTableConfig()); //currentOptions.setStatsDumpPeriodSec(300); //currentOptions.createStatistics(); currentOptions.setAllowOsBuffer(true); currentOptions.setMaxOpenFiles(-1); currentOptions.setMaxBackgroundFlushes(2); currentOptions.setMaxBackgroundCompactions(2); currentOptions.setAllowOsBuffer(false); return currentOptions; }
@Override public DBOptions setMaxBackgroundCompactions( final int maxBackgroundCompactions) { assert(isOwningHandle()); setMaxBackgroundCompactions(nativeHandle_, maxBackgroundCompactions); return this; }
.setCreateMissingColumnFamilies(true) .setIncreaseParallelism(parallelism) .setMaxBackgroundCompactions(maxBackgroundCompactions) .setMaxBackgroundFlushes(maxBackgroundFlushes) .setWalSizeLimitMB(0L)
/** * Builds RocksDb {@link DBOptions}. * * @param maxBackgroundFlushes * high priority threads, usually 1 or 2 would be enough * @param maxBackgroundCompactions * low priority threads, between 1 - num_cpu_cores * @param maxBackgroundThreads * {@code >= maxBackgroundFlushes, maxBackgroundCompactions} * @param maxLogFileSize * if equal to {@code 0}, write all logs to one file and roll by time * @return */ public static DBOptions buildDbOptions(int maxBackgroundFlushes, int maxBackgroundCompactions, int maxBackgroundThreads, long maxLogFileSize) { DBOptions dbOptions = new DBOptions(); dbOptions.setCreateIfMissing(true).setCreateMissingColumnFamilies(true) .setErrorIfExists(false); dbOptions.setMaxBackgroundFlushes(maxBackgroundFlushes) .setMaxBackgroundCompactions(maxBackgroundCompactions) .setIncreaseParallelism(maxBackgroundThreads); dbOptions.setAllowMmapReads(true).setAllowMmapWrites(true); dbOptions.setMaxOpenFiles(-1); dbOptions.setKeepLogFileNum(100).setLogFileTimeToRoll(3600) .setMaxLogFileSize(maxLogFileSize); return dbOptions; }