GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add vector graph build diagnostics logging by tae898 · Pull Request #3305 · ArcadeData/arcadedb

Add vector graph build diagnostics logging #3305

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.

Sign up for GitHub

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

Merged
lvca merged 3 commits into ArcadeData:main from humemai:add-vector-graph-build-diagnostics
Feb 2, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Add vector graph build diagnostics logging #3305

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
4c122eb
Add vector graph build diagnostics logging
tae898 Feb 1, 2026
c4196ac
Tweak graph build diagnostics defaults
tae898 Feb 1, 2026
763997c
Throttle graph build logs to 5s
tae898 Feb 2, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

5 changes: 5 additions & 0 deletions 5 engine/src/main/java/com/arcadedb/GlobalConfiguration.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ This setting is intended as a safety measure against excessive resource consumpt
"Recommended: 50-200 for read-heavy, 200-500 for write-heavy workloads.",
Integer.class, 100),

VECTOR_INDEX_GRAPH_BUILD_DIAGNOSTICS("arcadedb.vectorIndex.graphBuildDiagnostics", SCOPE.DATABASE,
"Enable diagnostic logging during vector graph build progress (heap/off-heap memory and index file sizes). " +
"This provides visibility during graph construction; disable if any logging overhead is a concern.",
Boolean.class, true),
Comment thread
tae898 marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


// NETWORK
NETWORK_SAME_SERVER_ERROR_RETRIES("arcadedb.network.sameServerErrorRetry", SCOPE.SERVER,
"Number of automatic retries in case of IO errors with a specific server. If replica servers are configured, look also at HA_ERROR_RETRY setting. 0 (default) = no retry",
Expand Down
114 changes: 110 additions & 4 deletions 114 engine/src/main/java/com/arcadedb/index/vector/LSMVectorIndex.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,13 @@

import java.io.File;
import java.io.IOException;
import java.lang.management.BufferPoolMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -183,6 +188,98 @@ public interface GraphBuildCallback {
void onGraphBuildProgress(String phase, int processedNodes, int totalNodes, long vectorAccesses);
}

private static final class GraphBuildDiagnosticsSnapshot {
private final long heapUsedBytes;
private final long heapMaxBytes;
private final long offHeapBytes;
private final long vectorIndexBytes;
private final long graphFileBytes;
private final long pqFileBytes;
private final long compactedFileBytes;
private final String fileBreakdown;

private GraphBuildDiagnosticsSnapshot(final long heapUsedBytes, final long heapMaxBytes, final long offHeapBytes,
final long vectorIndexBytes, final long graphFileBytes, final long pqFileBytes, final long compactedFileBytes,
final String fileBreakdown) {
this.heapUsedBytes = heapUsedBytes;
this.heapMaxBytes = heapMaxBytes;
this.offHeapBytes = offHeapBytes;
this.vectorIndexBytes = vectorIndexBytes;
this.graphFileBytes = graphFileBytes;
this.pqFileBytes = pqFileBytes;
this.compactedFileBytes = compactedFileBytes;
this.fileBreakdown = fileBreakdown;
}

private double heapUsedMb() {
return heapUsedBytes / (1024.0 * 1024.0);
}

private double heapMaxMb() {
return heapMaxBytes / (1024.0 * 1024.0);
}

private double offHeapMb() {
return offHeapBytes / (1024.0 * 1024.0);
}

private double totalFilesMb() {
final long total = vectorIndexBytes + graphFileBytes + pqFileBytes + compactedFileBytes;
return total / (1024.0 * 1024.0);
}
}

private boolean isGraphBuildDiagnosticsEnabled() {
return getDatabase().getConfiguration().getValueAsBoolean(GlobalConfiguration.VECTOR_INDEX_GRAPH_BUILD_DIAGNOSTICS);
}

private GraphBuildDiagnosticsSnapshot captureGraphBuildDiagnostics() {
final MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
final MemoryUsage heap = memoryBean != null ? memoryBean.getHeapMemoryUsage() : null;
final long heapUsed = heap != null ? heap.getUsed() : 0L;
final long heapMax = heap != null ? (heap.getMax() > 0 ? heap.getMax() : heap.getCommitted()) : 0L;

long directBytes = 0L;
long mappedBytes = 0L;
for (final BufferPoolMXBean pool : ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)) {
if (pool == null)
continue;
final String name = pool.getName();
if ("direct".equalsIgnoreCase(name)) {
directBytes = pool.getMemoryUsed();
} else if ("mapped".equalsIgnoreCase(name)) {
mappedBytes = pool.getMemoryUsed();
}
}
final long offHeap = directBytes + mappedBytes;

final long vectorIndexBytes = safeFileSize(
mutable != null && mutable.getComponentFile() != null ? Path.of(mutable.getComponentFile().getFilePath()) : null);
final long graphFileBytes = safeFileSize(
graphFile != null && graphFile.getComponentFile() != null ? Path.of(graphFile.getComponentFile().getFilePath()) : null);
final long pqFileBytes = safeFileSize(pqFile != null ? pqFile.getFilePath() : null);
final long compactedFileBytes = safeFileSize(
compactedSubIndex != null && compactedSubIndex.getComponentFile() != null ?
Path.of(compactedSubIndex.getComponentFile().getFilePath()) :
null);

final String breakdown = String.format("idx=%.1f, graph=%.1f, pq=%.1f, compacted=%.1f", vectorIndexBytes / (1024.0 * 1024.0),
graphFileBytes / (1024.0 * 1024.0), pqFileBytes / (1024.0 * 1024.0), compactedFileBytes / (1024.0 * 1024.0));

return new GraphBuildDiagnosticsSnapshot(heapUsed, heapMax, offHeap, vectorIndexBytes, graphFileBytes, pqFileBytes,
compactedFileBytes, breakdown);
}

private static long safeFileSize(final Path path) {
if (path == null)
return 0L;
try {
return Files.size(path);
} catch (final IOException e) {
return 0L;
}
}
Comment thread
tae898 marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


/**
* Helper class for collecting vector entries during graph build.
* Used to avoid race conditions with concurrent VectorLocationIndex modifications.
Expand Down Expand Up @@ -836,7 +933,7 @@ private void buildGraphFromScratch(final GraphBuildCallback graphCallback) {
* @param graphCallback Optional callback for graph build progress
*/
private void buildGraphFromScratchWithRetry(final GraphBuildCallback graphCallback) {
// Always have a progress reporter: if caller didn't provide one, log throttled progress every ~2s
// Always have a progress reporter: if caller didn't provide one, log throttled progress every ~5s
final GraphBuildCallback effectiveGraphCallback;
if (graphCallback != null) {
effectiveGraphCallback = graphCallback;
Expand All @@ -849,13 +946,22 @@ private void buildGraphFromScratchWithRetry(final GraphBuildCallback graphCallba

final long now = System.currentTimeMillis();
final boolean progressed = processedNodes != lastLoggedProcessed[0];
final boolean timeElapsed = now - lastLogTimeMs[0] >= 2000;
final boolean timeElapsed = now - lastLogTimeMs[0] >= 5000;
Comment thread

@tae898 tae898 Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2s was too much.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
final boolean reachedEnd = processedNodes >= totalNodes && lastLoggedProcessed[0] != totalNodes;
final boolean shouldLog = progressed && (timeElapsed || reachedEnd);

if (shouldLog) {
LogManager.instance().log(this, Level.INFO,
"Graph build %s: %d/%d (vector accesses=%d)", phase, processedNodes, totalNodes, vectorAccesses);
if (isGraphBuildDiagnosticsEnabled()) {
final GraphBuildDiagnosticsSnapshot diagnostics = captureGraphBuildDiagnostics();
LogManager.instance().log(this, Level.INFO,
"Graph build %s: %d/%d (vector accesses=%d, heap=%.1f/%.1fMB, offheap=%.1fMB, files=%.1fMB [%s])",
phase, processedNodes, totalNodes, vectorAccesses,
diagnostics.heapUsedMb(), diagnostics.heapMaxMb(), diagnostics.offHeapMb(),
diagnostics.totalFilesMb(), diagnostics.fileBreakdown);
} else {
LogManager.instance().log(this, Level.INFO,
"Graph build %s: %d/%d (vector accesses=%d)", phase, processedNodes, totalNodes, vectorAccesses);
}
lastLogTimeMs[0] = now;
lastLoggedProcessed[0] = processedNodes;
}
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402860 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.