001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2008 Sun Microsystems, Inc. 025 */ 026package org.forgerock.opendj.server.config.server; 027 028 029 030import java.util.SortedSet; 031import org.forgerock.opendj.config.server.ConfigurationChangeListener; 032 033 034 035/** 036 * A server-side interface for querying JE Backend settings. 037 * <p> 038 * A JE Backend stores application data in a Berkeley DB Java Edition 039 * database. 040 */ 041public interface JEBackendCfg extends PluggableBackendCfg { 042 043 /** 044 * Gets the configuration class associated with this JE Backend. 045 * 046 * @return Returns the configuration class associated with this JE Backend. 047 */ 048 Class<? extends JEBackendCfg> configurationClass(); 049 050 051 052 /** 053 * Register to be notified when this JE Backend is changed. 054 * 055 * @param listener 056 * The JE Backend configuration change listener. 057 */ 058 void addJEChangeListener(ConfigurationChangeListener<JEBackendCfg> listener); 059 060 061 062 /** 063 * Deregister an existing JE Backend configuration change listener. 064 * 065 * @param listener 066 * The JE Backend configuration change listener. 067 */ 068 void removeJEChangeListener(ConfigurationChangeListener<JEBackendCfg> listener); 069 070 071 072 /** 073 * Gets the "db-cache-percent" property. 074 * <p> 075 * Specifies the percentage of JVM memory to allocate to the 076 * database cache. 077 * <p> 078 * Specifies the percentage of memory available to the JVM that 079 * should be used for caching database contents. Note that this is 080 * only used if the value of the db-cache-size property is set to "0 081 * MB". Otherwise, the value of that property is used instead to 082 * control the cache size configuration. 083 * 084 * @return Returns the value of the "db-cache-percent" property. 085 */ 086 int getDBCachePercent(); 087 088 089 090 /** 091 * Gets the "db-cache-size" property. 092 * <p> 093 * The amount of JVM memory to allocate to the database cache. 094 * <p> 095 * Specifies the amount of memory that should be used for caching 096 * database contents. A value of "0 MB" indicates that the 097 * db-cache-percent property should be used instead to specify the 098 * cache size. 099 * 100 * @return Returns the value of the "db-cache-size" property. 101 */ 102 long getDBCacheSize(); 103 104 105 106 /** 107 * Gets the "db-checkpointer-bytes-interval" property. 108 * <p> 109 * Specifies the maximum number of bytes that may be written to the 110 * database before it is forced to perform a checkpoint. 111 * <p> 112 * This can be used to bound the recovery time that may be required 113 * if the database environment is opened without having been properly 114 * closed. If this property is set to a non-zero value, the 115 * checkpointer wakeup interval is not used. To use time-based 116 * checkpointing, set this property to zero. 117 * 118 * @return Returns the value of the "db-checkpointer-bytes-interval" property. 119 */ 120 long getDBCheckpointerBytesInterval(); 121 122 123 124 /** 125 * Gets the "db-checkpointer-wakeup-interval" property. 126 * <p> 127 * Specifies the maximum length of time that may pass between 128 * checkpoints. 129 * <p> 130 * Note that this is only used if the value of the checkpointer 131 * bytes interval is zero. 132 * 133 * @return Returns the value of the "db-checkpointer-wakeup-interval" property. 134 */ 135 long getDBCheckpointerWakeupInterval(); 136 137 138 139 /** 140 * Gets the "db-cleaner-min-utilization" property. 141 * <p> 142 * Specifies the occupancy percentage for "live" data in this 143 * backend's database. 144 * <p> 145 * When the amount of "live" data in the database drops below this 146 * value, cleaners will act to increase the occupancy percentage by 147 * compacting the database. 148 * 149 * @return Returns the value of the "db-cleaner-min-utilization" property. 150 */ 151 int getDBCleanerMinUtilization(); 152 153 154 155 /** 156 * Gets the "db-directory" property. 157 * <p> 158 * Specifies the path to the filesystem directory that is used to 159 * hold the Berkeley DB Java Edition database files containing the 160 * data for this backend. 161 * <p> 162 * The path may be either an absolute path or a path relative to the 163 * directory containing the base of the OpenDJ directory server 164 * installation. The path may be any valid directory path in which 165 * the server has appropriate permissions to read and write files and 166 * has sufficient space to hold the database contents. 167 * 168 * @return Returns the value of the "db-directory" property. 169 */ 170 String getDBDirectory(); 171 172 173 174 /** 175 * Gets the "db-directory-permissions" property. 176 * <p> 177 * Specifies the permissions that should be applied to the directory 178 * containing the server database files. 179 * <p> 180 * They should be expressed as three-digit octal values, which is 181 * the traditional representation for UNIX file permissions. The 182 * three digits represent the permissions that are available for the 183 * directory's owner, group members, and other users (in that order), 184 * and each digit is the octal representation of the read, write, and 185 * execute bits. Note that this only impacts permissions on the 186 * database directory and not on the files written into that 187 * directory. On UNIX systems, the user's umask controls permissions 188 * given to the database files. 189 * 190 * @return Returns the value of the "db-directory-permissions" property. 191 */ 192 String getDBDirectoryPermissions(); 193 194 195 196 /** 197 * Gets the "db-evictor-core-threads" property. 198 * <p> 199 * Specifies the core number of threads in the eviction thread pool. 200 * <p> 201 * Specifies the core number of threads in the eviction thread pool. 202 * These threads help keep memory usage within cache bounds, 203 * offloading work from application threads. db-evictor-core-threads, 204 * db-evictor-max-threads and db-evictor-keep-alive are used to 205 * configure the core, max and keepalive attributes for the eviction 206 * thread pool. 207 * 208 * @return Returns the value of the "db-evictor-core-threads" property. 209 */ 210 int getDBEvictorCoreThreads(); 211 212 213 214 /** 215 * Gets the "db-evictor-keep-alive" property. 216 * <p> 217 * The duration that excess threads in the eviction thread pool will 218 * stay idle. After this period, idle threads will terminate. 219 * <p> 220 * The duration that excess threads in the eviction thread pool will 221 * stay idle. After this period, idle threads will terminate. 222 * db-evictor-core-threads, db-evictor-max-threads and 223 * db-evictor-keep-alive are used to configure the core, max and 224 * keepalive attributes for the eviction thread pool. 225 * 226 * @return Returns the value of the "db-evictor-keep-alive" property. 227 */ 228 long getDBEvictorKeepAlive(); 229 230 231 232 /** 233 * Gets the "db-evictor-lru-only" property. 234 * <p> 235 * Indicates whether the database should evict existing data from 236 * the cache based on an LRU policy (where the least recently used 237 * information will be evicted first). 238 * <p> 239 * If set to "false", then the eviction keeps internal nodes of the 240 * underlying Btree in the cache over leaf nodes, even if the leaf 241 * nodes have been accessed more recently. This may be a better 242 * configuration for databases in which only a very small portion of 243 * the data is cached. 244 * 245 * @return Returns the value of the "db-evictor-lru-only" property. 246 */ 247 boolean isDBEvictorLruOnly(); 248 249 250 251 /** 252 * Gets the "db-evictor-max-threads" property. 253 * <p> 254 * Specifies the maximum number of threads in the eviction thread 255 * pool. 256 * <p> 257 * Specifies the maximum number of threads in the eviction thread 258 * pool. These threads help keep memory usage within cache bounds, 259 * offloading work from application threads. db-evictor-core-threads, 260 * db-evictor-max-threads and db-evictor-keep-alive are used to 261 * configure the core, max and keepalive attributes for the eviction 262 * thread pool. 263 * 264 * @return Returns the value of the "db-evictor-max-threads" property. 265 */ 266 int getDBEvictorMaxThreads(); 267 268 269 270 /** 271 * Gets the "db-evictor-nodes-per-scan" property. 272 * <p> 273 * Specifies the number of Btree nodes that should be evicted from 274 * the cache in a single pass if it is determined that it is 275 * necessary to free existing data in order to make room for new 276 * information. 277 * <p> 278 * Changes to this property do not take effect until the backend is 279 * restarted. It is recommended that you also change this property 280 * when you set db-evictor-lru-only to false. This setting controls 281 * the number of Btree nodes that are considered, or sampled, each 282 * time a node is evicted. A setting of 10 often produces good 283 * results, but this may vary from application to application. The 284 * larger the nodes per scan, the more accurate the algorithm. 285 * However, don't set it too high. When considering larger numbers of 286 * nodes for each eviction, the evictor may delay the completion of a 287 * given database operation, which impacts the response time of the 288 * application thread. In JE 4.1 and later, setting this value too 289 * high in an application that is largely CPU bound can reduce the 290 * effectiveness of cache eviction. It's best to start with the 291 * default value, and increase it gradually to see if it is 292 * beneficial for your application. 293 * 294 * @return Returns the value of the "db-evictor-nodes-per-scan" property. 295 */ 296 int getDBEvictorNodesPerScan(); 297 298 299 300 /** 301 * Gets the "db-log-filecache-size" property. 302 * <p> 303 * Specifies the size of the file handle cache. 304 * <p> 305 * The file handle cache is used to keep as much opened log files as 306 * possible. When the cache is smaller than the number of logs, the 307 * database needs to close some handles and open log files it needs, 308 * resulting in less optimal performances. Ideally, the size of the 309 * cache should be higher than the number of files contained in the 310 * database. Make sure the OS number of open files per process is 311 * also tuned appropriately. 312 * 313 * @return Returns the value of the "db-log-filecache-size" property. 314 */ 315 int getDBLogFilecacheSize(); 316 317 318 319 /** 320 * Gets the "db-log-file-max" property. 321 * <p> 322 * Specifies the maximum size for a database log file. 323 * 324 * @return Returns the value of the "db-log-file-max" property. 325 */ 326 long getDBLogFileMax(); 327 328 329 330 /** 331 * Gets the "db-logging-file-handler-on" property. 332 * <p> 333 * Indicates whether the database should maintain a je.info file in 334 * the same directory as the database log directory. 335 * <p> 336 * This file contains information about the internal processing 337 * performed by the underlying database. 338 * 339 * @return Returns the value of the "db-logging-file-handler-on" property. 340 */ 341 boolean isDBLoggingFileHandlerOn(); 342 343 344 345 /** 346 * Gets the "db-logging-level" property. 347 * <p> 348 * Specifies the log level that should be used by the database when 349 * it is writing information into the je.info file. 350 * <p> 351 * The database trace logging level is (in increasing order of 352 * verbosity) chosen from: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, 353 * FINER, FINEST, ALL. 354 * 355 * @return Returns the value of the "db-logging-level" property. 356 */ 357 String getDBLoggingLevel(); 358 359 360 361 /** 362 * Gets the "db-num-cleaner-threads" property. 363 * <p> 364 * Specifies the number of threads that the backend should maintain 365 * to keep the database log files at or near the desired utilization. 366 * <p> 367 * In environments with high write throughput, multiple cleaner 368 * threads may be required to maintain the desired utilization. 369 * 370 * @return Returns the value of the "db-num-cleaner-threads" property. 371 */ 372 Integer getDBNumCleanerThreads(); 373 374 375 376 /** 377 * Gets the "db-num-lock-tables" property. 378 * <p> 379 * Specifies the number of lock tables that are used by the 380 * underlying database. 381 * <p> 382 * This can be particularly important to help improve scalability by 383 * avoiding contention on systems with large numbers of CPUs. The 384 * value of this configuration property should be set to a prime 385 * number that is less than or equal to the number of worker threads 386 * configured for use in the server. 387 * 388 * @return Returns the value of the "db-num-lock-tables" property. 389 */ 390 Integer getDBNumLockTables(); 391 392 393 394 /** 395 * Gets the "db-run-cleaner" property. 396 * <p> 397 * Indicates whether the cleaner threads should be enabled to 398 * compact the database. 399 * <p> 400 * The cleaner threads are used to periodically compact the database 401 * when it reaches a percentage of occupancy lower than the amount 402 * specified by the db-cleaner-min-utilization property. They 403 * identify database files with a low percentage of live data, and 404 * relocate their remaining live data to the end of the log. 405 * 406 * @return Returns the value of the "db-run-cleaner" property. 407 */ 408 boolean isDBRunCleaner(); 409 410 411 412 /** 413 * Gets the "db-txn-no-sync" property. 414 * <p> 415 * Indicates whether database writes should be primarily written to 416 * an internal buffer but not immediately written to disk. 417 * <p> 418 * Setting the value of this configuration attribute to "true" may 419 * improve write performance but could cause the most recent changes 420 * to be lost if the OpenDJ directory server or the underlying JVM 421 * exits abnormally, or if an OS or hardware failure occurs (a 422 * behavior similar to running with transaction durability disabled 423 * in the Sun Java System Directory Server). 424 * 425 * @return Returns the value of the "db-txn-no-sync" property. 426 */ 427 boolean isDBTxnNoSync(); 428 429 430 431 /** 432 * Gets the "db-txn-write-no-sync" property. 433 * <p> 434 * Indicates whether the database should synchronously flush data as 435 * it is written to disk. 436 * <p> 437 * If this value is set to "false", then all data written to disk is 438 * synchronously flushed to persistent storage and thereby providing 439 * full durability. If it is set to "true", then data may be cached 440 * for a period of time by the underlying operating system before 441 * actually being written to disk. This may improve performance, but 442 * could cause the most recent changes to be lost in the event of an 443 * underlying OS or hardware failure (but not in the case that the 444 * OpenDJ directory server or the JVM exits abnormally). 445 * 446 * @return Returns the value of the "db-txn-write-no-sync" property. 447 */ 448 boolean isDBTxnWriteNoSync(); 449 450 451 452 /** 453 * Gets the "disk-full-threshold" property. 454 * <p> 455 * Full disk threshold to limit database updates 456 * <p> 457 * When the available free space on the disk used by this database 458 * instance falls below the value specified, no updates are permitted 459 * and the server returns an UNWILLING_TO_PERFORM error. Updates are 460 * allowed again as soon as free space rises above the threshold. 461 * 462 * @return Returns the value of the "disk-full-threshold" property. 463 */ 464 long getDiskFullThreshold(); 465 466 467 468 /** 469 * Gets the "disk-low-threshold" property. 470 * <p> 471 * Low disk threshold to limit database updates 472 * <p> 473 * Specifies the "low" free space on the disk. When the available 474 * free space on the disk used by this database instance falls below 475 * the value specified, protocol updates on this database are 476 * permitted only by a user with the BYPASS_LOCKDOWN privilege. 477 * 478 * @return Returns the value of the "disk-low-threshold" property. 479 */ 480 long getDiskLowThreshold(); 481 482 483 484 /** 485 * Gets the "java-class" property. 486 * <p> 487 * Specifies the fully-qualified name of the Java class that 488 * provides the backend implementation. 489 * 490 * @return Returns the value of the "java-class" property. 491 */ 492 String getJavaClass(); 493 494 495 496 /** 497 * Gets the "je-property" property. 498 * <p> 499 * Specifies the database and environment properties for the 500 * Berkeley DB Java Edition database serving the data for this 501 * backend. 502 * <p> 503 * Any Berkeley DB Java Edition property can be specified using the 504 * following form: property-name=property-value. Refer to OpenDJ 505 * documentation for further information on related properties, their 506 * implications, and range values. The definitive identification of 507 * all the property parameters is available in the example.properties 508 * file of Berkeley DB Java Edition distribution. 509 * 510 * @return Returns an unmodifiable set containing the values of the "je-property" property. 511 */ 512 SortedSet<String> getJEProperty(); 513 514}