-
Notifications
You must be signed in to change notification settings - Fork 522
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
feat(server): adoption for off-heap memory management in kout module #2704
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2704 +/- ##
============================================
- Coverage 46.99% 37.15% -9.85%
+ Complexity 821 493 -328
============================================
Files 745 745
Lines 60062 60148 +86
Branches 7670 7687 +17
============================================
- Hits 28225 22345 -5880
- Misses 29014 35354 +6340
+ Partials 2823 2449 -374 ☔ View full report in Codecov by Sentry. |
@@ -93,27 +97,40 @@ public String get(@Context GraphManager manager, | |||
"'{}', max degree '{}', capacity '{}' and limit '{}'", | |||
graph, source, direction, edgeLabel, depth, | |||
nearest, maxDegree, capacity, limit); | |||
MemoryPool queryPool = MemoryManager.getInstance().addQueryMemoryPool(); |
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.
can we bind a MemoryPool for each graph
.bindCorrespondingTaskMemoryPool(Thread.currentThread().getName(), | ||
(TaskMemoryPool) currentTaskPool); | ||
MemoryPool currentOperationPool = currentTaskPool.addChildPool("kout-main-operation"); | ||
}); |
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.
add a method like graph.switchToMemoryPool("kout", "main")
?
|
||
ApiMeasurer measure = new ApiMeasurer(); | ||
try { |
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.
prefer to add a wrapper method for MemoryPool init-and-gc, then call the original method?
@@ -260,6 +260,7 @@ private Iterator<HugeVertex> queryVerticesByIds(IdQuery query) { | |||
return QueryResults.emptyIterator(); | |||
} | |||
if (needCacheVertex(vertex)) { | |||
vertex.convertIdToOnHeapIfNeeded(); |
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.
it's ok to just call convert in HeapCache.update(), at the same time, we avoid modifying the code everywhere
private static Id generateId(HugeType type, Id id) { | ||
// NOTE: it's slower performance to use: | ||
// String.format("%x-%s", type.code(), name) | ||
return IdGenerator.of(type.string() + "-" + id.asString()); | ||
return new IdGenerator.StringId(type.string() + "-" + id.asString()); |
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.
add a OnHeapIdGenerator.of() class?
@@ -58,7 +58,9 @@ public BinaryBackendEntry.BinaryId newBinaryId(byte[] bytes, Id id) { | |||
.getCorrespondingTaskMemoryPool( | |||
Thread.currentThread() | |||
.getName()); | |||
return new BinaryIdOffHeap(bytes, null, | |||
return taskMemoryPool == null ? |
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.
expect this.taskMemoryPool style
@@ -58,7 +58,9 @@ public BinaryBackendEntry.BinaryId newBinaryId(byte[] bytes, Id id) { | |||
.getCorrespondingTaskMemoryPool( | |||
Thread.currentThread() | |||
.getName()); |
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.
prefer by Thread id instead of Thread name
if (MEMORY_MODE == MemoryMode.DISABLE_MEMORY_MANAGEMENT) { | ||
return null; | ||
} | ||
|
||
int count = queryMemoryPools.size(); |
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.
expect this.xx stype
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.
What is the difference between QueryMemoryPool and MemoryPool? if no difference, just naming MemoryPool is ok.
and can we make some special names for CorrespondingTaskMemoryPool and CurrentWorkingOperatorMemoryPool, such as RequestMemoryPool and RequestStageMemoryPool
@@ -77,7 +77,7 @@ public class MemoryManager { | |||
private final MemoryArbitrator memoryArbitrator; | |||
private final ExecutorService arbitrateExecutor; | |||
|
|||
private static MemoryMode MEMORY_MODE = MemoryMode.ENABLE_OFF_HEAP_MANAGEMENT; | |||
private static MemoryMode MEMORY_MODE = MemoryMode.DISABLE_MEMORY_MANAGEMENT; |
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.
MEMORY_MODE style is only for const var, and if there is only a single MemoryManager, also remove static mark: private MemoryMode memoryMode
return new BinaryIdOffHeap(bytes, null, | ||
return taskMemoryPool == null ? | ||
new BinaryBackendEntry.BinaryId(bytes, id) : | ||
new BinaryIdOffHeap(bytes, null, |
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.
We can directly get the memory pool at one time MemoryManager.getInstance().currentMemoryPool()
, it does the 2 steps:
getCorrespondingTaskMemoryPool, getCurrentWorkingOperatorMemoryPool.
wip...