Skip to content
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

Real "read-only" mode with optimized memory consumption #221

Closed
michael-schnell opened this issue May 14, 2024 · 1 comment
Closed

Real "read-only" mode with optimized memory consumption #221

michael-schnell opened this issue May 14, 2024 · 1 comment

Comments

@michael-schnell
Copy link

michael-schnell commented May 14, 2024

Eclipse Store seems to add a lot of additional objects in memory.

Is there an option to load a real "read-only" model without that overhead? The "Read-Only" mode seems only to prevent writing, but does not seem to reduce the memory usage.

An alternative might be to purely use the Eclipse Serializer, but it lacks the "PersistenceTypeDictionary" of Eclipse Store. Would it be possible to use the "PersistenceTypeDictionary" standalone along with the Eclipse Serializer?

Here is a real world example with lots of objects that show a huge increase of memory consumption:

WITHOUT eclipse-store (root not persisted yet)

Total Bytes: 1’539’901’142
Total Classes: 8’556
Total Instances: 36’786’586

AFTER READING FROM eclipse-store

Total Bytes: 3’639’238’206
Total Classes: 9’730
Total Instances: 57’754’666
@michael-schnell
Copy link
Author

For anyone arriving at this issue:

The solution is to use the TypedSerializer instead of Serializer. This includes all type information in the byte array:

try (final Serializer<byte[]> serializer = TypedSerializer.Bytes()) {
    final byte[] data = serializer.serialize(root);
    ...
} catch (final Exception ex) {
    throw new IllegalStateException("Failed to serialize data", ex);
}

For more information take a look at this discussion: "How to extract the type information from the serializer":
eclipse-serializer/serializer#84 (comment)

Unfortunately there is almost no documentation the Eclipse Serializer, which is pretty bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant