-
Notifications
You must be signed in to change notification settings - Fork 525
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): support MemoryManagement for graph query framework #2649
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2649 +/- ##
============================================
- Coverage 47.70% 1.19% -46.52%
+ Complexity 821 8 -813
============================================
Files 720 723 +3
Lines 58989 57517 -1472
Branches 7607 7214 -393
============================================
- Hits 28143 685 -27458
- Misses 28031 56781 +28750
+ Partials 2815 51 -2764 ☔ View full report in Codecov by Sentry. |
...ver/hugegraph-core/src/main/java/org/apache/hugegraph/memory/allocator/IMemoryAllocator.java
Outdated
Show resolved
Hide resolved
...rver/hugegraph-core/src/main/java/org/apache/hugegraph/memory/pool/impl/MemoryPoolStats.java
Outdated
Show resolved
Hide resolved
...rver/hugegraph-core/src/main/java/org/apache/hugegraph/memory/pool/impl/QueryMemoryPool.java
Outdated
Show resolved
Hide resolved
...er/hugegraph-core/src/main/java/org/apache/hugegraph/memory/allocator/AbstractAllocator.java
Outdated
Show resolved
Hide resolved
hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
Outdated
Show resolved
Hide resolved
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.
How to re-point a Java variable to an off-heap object? we can set its address to an off-heap memory:
- https://stackoverflow.com/questions/25257400/moving-objects-off-heap
- https://highlyscalable.wordpress.com/2012/02/02/direct-memory-access-in-java/ (original article)
But! There is a risk in using off-heap objects, that is, off-heap objects refer to on-heap objects, such as vertex label, which may be released by schema cache.
We have two ways to solve this risk:
- One way is to pin the referenced in-heap object when an off-heap object is created, such as saving it in a hashset collection;
- The other way is to refresh the in-heap object when taking an off-heap object (such as re-get it from the schema cache by label id).
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/memory/MemoryManager.java
Outdated
Show resolved
Hide resolved
...server/hugegraph-core/src/main/java/org/apache/hugegraph/memory/pool/AbstractMemoryPool.java
Outdated
Show resolved
Hide resolved
@javeme @imbajin @zyxxoo @MingzhenHan PTAL~ |
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.
Thanks & merge it first~
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.
why change this file?
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.
why change this file?
maybe influenced by Fury
dependencies🤔?
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.
why change this file?
maybe influenced by
Fury
dependencies🤔?
Yes, and I ran wrong regenerate_known_dependencies.sh
which is in hugegraph-dist/scripts/dependency, resulting in a duplicate known-dependencies.txt
under hugegraph-dist/scripts/dependency.
Actually, only regenerate_known_dependencies.sh
in /install-dist/scripts/dependency is enough and correct. regenerate_known_dependencies.sh
in hugegraph-dist/scripts/dependency seems useless and may cause misunderstanding for programmers.
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.
fixed
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.
@imbajin maybe could entirely remove hugegraph-commons/hugegraph-dist
?
This reverts commit 7c86e84.
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/EdgeId.java
Show resolved
Hide resolved
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeProperty.java
Show resolved
Hide resolved
|
||
public class FurySerializationUtil { | ||
|
||
public static final Fury FURY = Fury.builder().withLanguage(Language.JAVA) |
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.
Seems Fury is used to serialize/deserialize object to/from offheap, serialized payload size may be not important here. Maybe we can disable number compress here by FuryBuilder#withNumerCompressed(false)
. If we have lots of number for serialization, disable this option will have much better performance
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.
This Fury is not thread safe, please use ThreadSafeFury
instead
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.
Thanks for your suggestions! All these will be improved in next pr
As title.
Users can use following new options to configure memory management:
# The memory management switch in HugeGraph. Options: off-heap, on-heap, disable.
memory.mode=off-heap
# The maximum memory capacity that can be managed for all queries in HugeGraph.
memory.max_capacity=1073741824
# The maximum memory capacity that can be managed for a query in HugeGraph.
memory.one_query_max_capacity=104857600
# The alignment used for round memory size.
memory.alignment=8
Detailed docs: