reduce cache size and lifetime to reduce memory issues

This commit is contained in:
2023-02-08 16:47:41 +01:00
parent d0a2a7f47c
commit e79536cf00

View File

@@ -111,7 +111,7 @@ public class DataStore implements AutoCloseable {
// A Doc will never be changed once it is created. Therefore we can cache them // A Doc will never be changed once it is created. Therefore we can cache them
// easily. // easily.
private final HotEntryCache<Long, Doc> docIdToDocCache = new HotEntryCache<>(Duration.ofMinutes(30), 100_000); private final HotEntryCache<Long, Doc> docIdToDocCache = new HotEntryCache<>(Duration.ofMinutes(10), 50_000);
private final HotEntryCache<PartitionedTagsCacheKey, PdbWriter> writerCache; private final HotEntryCache<PartitionedTagsCacheKey, PdbWriter> writerCache;
@@ -154,7 +154,7 @@ public class DataStore implements AutoCloseable {
final long start = System.nanoTime(); final long start = System.nanoTime();
writer.write(dateAsEpochMilli, value); writer.write(dateAsEpochMilli, value);
final double duration = (System.nanoTime() - start) / 1_000_000.0; final double duration = (System.nanoTime() - start) / 1_000_000.0;
if (duration > 10) { if (duration > 100) {
System.out.println(" write took: " + duration + " ms " + tags); System.out.println(" write took: " + duration + " ms " + tags);
} }
} }
@@ -422,7 +422,7 @@ public class DataStore implements AutoCloseable {
final PdbWriter result = new PdbWriter(pdbFile, diskStorage.getExisting(partitionId)); final PdbWriter result = new PdbWriter(pdbFile, diskStorage.getExisting(partitionId));
final double duration = (System.nanoTime() - start) / 1_000_000.0; final double duration = (System.nanoTime() - start) / 1_000_000.0;
if (duration > 10) { if (duration > 100) {
METRICS_LOGGER_NEW_WRITER.info("newPdbWriter took {}ms tags: {}", duration, tags); METRICS_LOGGER_NEW_WRITER.info("newPdbWriter took {}ms tags: {}", duration, tags);
} }
return result; return result;