Skip to content
Browse files

Expose additional bdb lock tuning parameters: number of lock tables, …

…fair locks
  • Loading branch information...
1 parent 17964e6 commit c2829ed55d722998dbd21108f1f6ac6f0c883278 @afeinberg afeinberg committed Feb 20, 2011
View
23 src/java/voldemort/server/VoldemortConfig.java
@@ -74,6 +74,8 @@
private boolean bdbCursorPreload;
private int bdbCleanerThreads;
private long bdbLockTimeoutMs;
+ private int bdbLockNLockTables;
+ private boolean bdbFairLatches;
private String mysqlUsername;
private String mysqlPassword;
@@ -201,6 +203,8 @@ public VoldemortConfig(Props props) {
this.bdbCleanerThreads = props.getInt("bdb.cleaner.threads", 1);
this.bdbCleanerLookAheadCacheSize = props.getInt("bdb.cleaner.lookahead.cache.size", 8192);
this.bdbLockTimeoutMs = props.getLong("bdb.lock.timeout.ms", 500);
+ this.bdbLockNLockTables = props.getInt("bdb.lock.nLockTables", 1);
+ this.bdbFairLatches = props.getBoolean("bdb.fair.latches", false);
// enabling preload make cursor slow for insufficient bdb cache size.
this.bdbCursorPreload = props.getBoolean("bdb.cursor.preload", false);
@@ -592,6 +596,25 @@ public final void setBdbLockTimeoutMs(long bdbLockTimeoutMs) {
this.bdbLockTimeoutMs = bdbLockTimeoutMs;
}
+ public void setBdbLockNLockTables(int bdbLockNLockTables) {
+ if(bdbLockNLockTables < 1 || bdbLockNLockTables > 32767)
+ throw new IllegalArgumentException("bdbLockNLockTables should be greater than 0 and "
+ + "less than 32767");
+ this.bdbLockNLockTables = bdbLockNLockTables;
+ }
+
+ public int getBdbLockNLockTables() {
+ return bdbLockNLockTables;
+ }
+
+ public boolean getBdbFairLatches() {
+ return bdbFairLatches;
+ }
+
+ public void setBdbFairLatches(boolean bdbFairLatches) {
+ this.bdbFairLatches = bdbFairLatches;
+ }
+
/**
*
* The cleaner will keep the total disk space utilization percentage above
View
4 src/java/voldemort/store/bdb/BdbStorageConfiguration.java
@@ -92,6 +92,10 @@ public BdbStorageConfiguration(VoldemortConfig config) {
Integer.toString(config.getBdbCleanerThreads()));
environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_LOOK_AHEAD_CACHE_SIZE,
Integer.toString(config.getBdbCleanerLookAheadCacheSize()));
+ environmentConfig.setConfigParam(EnvironmentConfig.LOCK_N_LOCK_TABLES,
+ Integer.toString(config.getBdbLockNLockTables()));
+ environmentConfig.setConfigParam(EnvironmentConfig.ENV_FAIR_LATCHES,
+ Boolean.toString(config.getBdbFairLatches()));
environmentConfig.setLockTimeout(config.getBdbLockTimeoutMs(), TimeUnit.MILLISECONDS);
databaseConfig = new DatabaseConfig();
databaseConfig.setAllowCreate(true);
View
1 test/integration/voldemort/store/grandfather/GrandfatherTest.java
@@ -875,6 +875,7 @@ private VoldemortServer startServer(int nodeId, List<StoreDefinition> storeDef,
new Properties());
config.setGrandfather(true);
config.setSlopFrequencyMs(10000);
+ config.setBdbFairLatches(true);
VoldemortServer server = new VoldemortServer(config);
server.start();
serverMap.put(nodeId, server);

0 comments on commit c2829ed

Please sign in to comment.
Something went wrong with that request. Please try again.