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

WriteBehindMapStore + OBJECT in-memory maps cause EntryProcessors to serialize objects #7040

Closed
fschuh opened this issue Dec 10, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@fschuh
Copy link

commented Dec 10, 2015

The issue is on line 103 of WriteBehindMapStore.java (Hazelcast 3.5.4):

    // we will be in this `if` only in case of an entry modification via entry-processor.
    // otherwise this extra serialization of value should not be happen.
    if (InMemoryFormat.OBJECT.equals(inMemoryFormat)) {
        value = toData(value);
    }

This causes all EntryProcessor runs that call entry.setValue() to serialize the object, leading to lower performance, similar to that of BINARY in-memory format.

Any particular reason for this serialization? This renders OBJECT in-memory format not viable when using write-behind with Hazelcast.

@ahmetmircik

This comment has been minimized.

Copy link
Member

commented Dec 10, 2015

Hi @fschuh,

Write-behind can be used to persist all states of an entry.

If in-memory-format is OBJECT, there is a possibility that a previous state of an entry can be overwritten by a subsequent write operation while both are waiting in the write-behind-queue because they are referencing to the same entry value. To prevent this, we are taking a snapshot by converting value to binary/data, otherwise we can lost a state.

@fschuh

This comment has been minimized.

Copy link
Author

commented Dec 11, 2015

Hi @ahmetmircik,

I see.
But in coalescing mode, only the last state should be persisted, correct?
And if the WriteBehindMapStore persist code runs on the same partition thread, there should be no dangers of having the object changed while the persistence is taking place.

The behavior you suggest makes sense if coalescing is disabled, but not when it's enabled.

@ahmetmircik

This comment has been minimized.

Copy link
Member

commented Dec 11, 2015

you are right, will fix it.

@fschuh

This comment has been minimized.

Copy link
Author

commented Dec 11, 2015

Great :)
Thanks for the quick reaction to the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.