Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public class DbLedgerStorage implements LedgerStorage {

private static final int MB = 1024 * 1024;

private static final long DEFAULT_WRITE_CACHE_MAX_SIZE_MB = (long) (0.25 * PlatformDependent.maxDirectMemory())
/ MB;
private static final long DEFAULT_READ_CACHE_MAX_SIZE_MB = (long) (0.25 * PlatformDependent.maxDirectMemory())
/ MB;
private static final long DEFAULT_WRITE_CACHE_MAX_SIZE_MB =
(long) (0.25 * PlatformDependent.estimateMaxDirectMemory()) / MB;
private static final long DEFAULT_READ_CACHE_MAX_SIZE_MB =
(long) (0.25 * PlatformDependent.estimateMaxDirectMemory()) / MB;

static final String READ_AHEAD_CACHE_BATCH_SIZE = "dbStorage_readAheadCacheBatchSize";
private static final int DEFAULT_READ_AHEAD_CACHE_BATCH_SIZE = 100;
Expand Down Expand Up @@ -136,7 +136,7 @@ public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, Le
log.info(" - Write cache size: {} MB", writeCacheMaxSize / MB);
log.info(" - Read Cache: {} MB", readCacheMaxSize / MB);

if (readCacheMaxSize + writeCacheMaxSize > PlatformDependent.maxDirectMemory()) {
if (readCacheMaxSize + writeCacheMaxSize > PlatformDependent.estimateMaxDirectMemory()) {
throw new IOException("Read and write cache sizes exceed the configured max direct memory size");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ public ServerConfiguration setJournalMaxMemorySizeMb(long journalMaxMemorySizeMb
*/
public long getJournalMaxMemorySizeMb() {
// Default is taking 5% of max direct memory (and convert to MB).
long defaultValue = (long) (PlatformDependent.maxDirectMemory() * 0.05 / 1024 / 1024);
long defaultValue = (long) (PlatformDependent.estimateMaxDirectMemory() * 0.05 / 1024 / 1024);
return this.getLong(JOURNAL_MAX_MEMORY_SIZE_MB, defaultValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public double get() {
registerMetrics(Gauge.build("jvm_memory_direct_bytes_max", "-").create().setChild(new Child() {
@Override
public double get() {
return PlatformDependent.maxDirectMemory();
return PlatformDependent.estimateMaxDirectMemory();
}
}));

Expand Down