-
Notifications
You must be signed in to change notification settings - Fork 2
feat(inkless): add persistent storage for infinispan #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e6f5ffd
36b8a53
bb0e6e6
90b02dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,9 +78,25 @@ public class InklessConfig extends AbstractConfig { | |
private static final int CONSUME_CACHE_BLOCK_BYTES_DEFAULT = 16 * 1024 * 1024; // 16 MiB | ||
|
||
public static final String CONSUME_CACHE_MAX_COUNT_CONFIG = CONSUME_PREFIX + "cache.max.count"; | ||
private static final String CONSUME_CACHE_MAX_COUNT_DOC = "The maximum number of objects to cache in memory."; | ||
private static final String CONSUME_CACHE_MAX_COUNT_DOC = "The maximum number of objects to cache in memory. " + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bad config, counting number of objects is worse than counting memory. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree. When using size-based config, cache creation fails with:
So, I think you're right; this will require further changes to be supported. Let's look into this in a follow-up |
||
"If the cache exceeds this limit, and the cache persistence is enabled, " + | ||
"the least recently used objects will be persisted to disk and removed from memory."; | ||
private static final int CONSUME_CACHE_MAX_COUNT_DEFAULT = 1000; | ||
|
||
public static final String CONSUME_CACHE_PERSISTENCE_ENABLE_CONFIG = CONSUME_PREFIX + "cache.persistence.enable"; | ||
private static final String CONSUME_CACHE_PERSISTENCE_ENABLE_DOC = "Enable cache persistence to disk. " + | ||
"If this is not set, the cache will not be persisted to disk. " + | ||
"If this is set, the cache will be persisted to disk when it exceeds the maximum count limit."; | ||
|
||
public static final String CONSUME_CACHE_EXPIRATION_LIFESPAN_SEC_CONFIG = CONSUME_PREFIX + "cache.expiration.lifespan.sec"; | ||
private static final String CONSUME_CACHE_EXPIRATION_LIFESPAN_SEC_DOC = "The lifespan in seconds of a cache entry before it will be removed from all storages."; | ||
private static final int CONSUME_CACHE_EXPIRATION_LIFESPAN_SEC_DEFAULT = 60; // Defaults to 1 minute | ||
|
||
public static final String CONSUME_CACHE_EXPIRATION_MAX_IDLE_SEC_CONFIG = CONSUME_PREFIX + "cache.expiration.max.idle.sec"; | ||
private static final String CONSUME_CACHE_EXPIRATION_MAX_IDLE_SEC_DOC = "The maximum idle time in seconds before a cache entry will be removed from all storages. " + | ||
"-1 means disabled, and entries will not be removed based on idle time."; | ||
private static final int CONSUME_CACHE_EXPIRATION_MAX_IDLE_SEC_DEFAULT = -1; // Disabled by default | ||
|
||
public static final String RETENTION_ENFORCEMENT_INTERVAL_MS_CONFIG = "retention.enforcement.interval.ms"; | ||
private static final String RETENTION_ENFORCEMENT_INTERVAL_MS_DOC = "The interval with which to enforce retention policies on a partition. " + | ||
"This interval is approximate, because each scheduling event is randomized. " + | ||
|
@@ -242,6 +258,29 @@ public static ConfigDef configDef() { | |
ConfigDef.Importance.LOW, | ||
CONSUME_CACHE_MAX_COUNT_DOC | ||
); | ||
configDef.define( | ||
CONSUME_CACHE_PERSISTENCE_ENABLE_CONFIG, | ||
ConfigDef.Type.BOOLEAN, | ||
false, | ||
ConfigDef.Importance.LOW, | ||
CONSUME_CACHE_PERSISTENCE_ENABLE_DOC | ||
); | ||
configDef.define( | ||
CONSUME_CACHE_EXPIRATION_LIFESPAN_SEC_CONFIG, | ||
ConfigDef.Type.INT, | ||
CONSUME_CACHE_EXPIRATION_LIFESPAN_SEC_DEFAULT, | ||
ConfigDef.Range.atLeast(10), // As it checks every 5 seconds, and the object lock timeout is 10 secs. | ||
ConfigDef.Importance.LOW, | ||
CONSUME_CACHE_EXPIRATION_LIFESPAN_SEC_DOC | ||
); | ||
configDef.define( | ||
CONSUME_CACHE_EXPIRATION_MAX_IDLE_SEC_CONFIG, | ||
ConfigDef.Type.INT, | ||
CONSUME_CACHE_EXPIRATION_MAX_IDLE_SEC_DEFAULT, | ||
ConfigDef.Range.atLeast(-1), | ||
ConfigDef.Importance.LOW, | ||
CONSUME_CACHE_EXPIRATION_MAX_IDLE_SEC_DOC | ||
); | ||
configDef.define( | ||
PRODUCE_UPLOAD_THREAD_POOL_SIZE_CONFIG, | ||
ConfigDef.Type.INT, | ||
|
@@ -330,6 +369,18 @@ public Long cacheMaxCount() { | |
return getLong(CONSUME_CACHE_MAX_COUNT_CONFIG); | ||
} | ||
|
||
public boolean isCachePersistenceEnabled() { | ||
return getBoolean(CONSUME_CACHE_PERSISTENCE_ENABLE_CONFIG); | ||
} | ||
|
||
public int cacheExpirationLifespanSec() { | ||
return getInt(CONSUME_CACHE_EXPIRATION_LIFESPAN_SEC_CONFIG); | ||
} | ||
|
||
public int cacheExpirationMaxIdleSec() { | ||
return getInt(CONSUME_CACHE_EXPIRATION_MAX_IDLE_SEC_CONFIG); | ||
} | ||
|
||
public int produceUploadThreadPoolSize() { | ||
return getInt(PRODUCE_UPLOAD_THREAD_POOL_SIZE_CONFIG); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.