--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to a topic in the Google Groups "kryo-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kryo-users/op81RmHXOsM/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to kryo-users+...@googlegroups.com.
Thank you both for the response.Nate, I don't think my object graph is deeper than about 20 objects. If I remove some references to get rid of cycles (but the depth of objects stays the same), the stack problems disappear.Leo, thanks for the suggestion. I tried applying your patch from March 12, but seem to be having the exact same problem.
Hi Leo, I'd be happy to send you some sample code. Where is the best place for me to upload that? (or should I just attach it to this email?)
I think I figured this out, and Nate was right about the object graph being deep.I was trying to serialize a Graph object, with each Node object storing a Set<Node> of neighbors. Although I didn't realize at first, this actually results in a very deep object graph since objects are serialized depth-first.Is there an easy way to encourage Kryo to first create references to all my Node objects, without recursively serializing all their fields?
--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
--- You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+unsubscribe@googlegroups.com.
Am 26.04.2013 08:31, schrieb mongonix:
> I guess this is a perfect use-case, where my continuations-based
> serialization hack that I posted some time ago would be the savior :-)
> Too bad that this approach required intrusive changes to Kryo, which often
> negatively affect performance (20-30%) in typical use-cases that do not use
> deep object graphs.
Okay, I just finished applying the original patch (required some manual
labor, but the tests still succeed).
Someone should update jvm-serializers to use the latest Kryo. Those micro benchmarks have had a lot more eyes on them.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
BTW, it may happen that Avro also will update their benchmarks :-) ... because I more or less ported my Unsafe-based serialization improvements to Avro. It will be merged into trunk soon. These improvements make reflection-based Avro serializers 3-5 times faster on average than they were before.
Has there been any movement on trying to get continuations into trunk? I'm bumping into the same sort of ArrayOutOfBounds issues in IdentiyObjectInMap and/or stack overflows on nested graphs.
While they are big messages, the built-in Java serializer as well as a custom serializer written by my company have no problems serializing the objects. I'm using a combination of CompatibleFieldSerializer (for message wrappers) and TaggedFieldSerializer (for message payloads and backward/forward compatibility) and have cut my message size in half to prevent Kryo from erroring out. (The serialized bytes come to about 21Meg on the half-size messages).
IdentityObjectIntMap#resize silently throws an exception trying to resize the valueTable - it's caught in a finally block higher up within Kryo#writeObjectAndClass, but now IdentiyObjectIntMap has an inconsistent internal state (capacity is now twice as large as the actual valueTable array) and throws an uncaught exception when the IdentityObjectInMap#clean is called later on.
IdentityObjectIntMap#resize silently throws an exception trying to resize the valueTable - it's caught in a finally block higher up within Kryo#writeObjectAndClass, but now IdentiyObjectIntMap has an inconsistent internal state (capacity is now twice as large as the actual valueTable array) and throws an uncaught exception when the IdentityObjectInMap#clean is called later on.
On Thu, Aug 15, 2013 at 4:55 PM, Brian Erst <brian...@gmail.com> wrote:
IdentityObjectIntMap#resize silently throws an exception trying to resize the valueTable - it's caught in a finally block higher up within Kryo#writeObjectAndClass, but now IdentiyObjectIntMap has an inconsistent internal state (capacity is now twice as large as the actual valueTable array) and throws an uncaught exception when the IdentityObjectInMap#clean is called later on.I don't see anywhere Kryo eats an exception. Can you be more specific?
It seems the cuckoo hashing is not working well for your objects. If your objects have poor hashcodes, IdentityObjectIntMap will have many collisions and resize larger than it would otherwise. You could try tweaking IdentityObjectIntMap, eg increase stashCapacity and/or pushIterations.
I suggest implementing your own MapReferenceResolver using java.util.IdentityHashMap (copypasta the existing one). The cuckoo hashing can have poor put performance, so maybe it isn't the best for for writtenObjects in MapReferenceResolver, which is likely 50/50 more gets/puts for most object graphs. The benefits of IdentityObjectIntMap are 1) no allocations for puts, 2) faster gets, 3) no boxing. The downside is slower puts and large backing arrays when there are hash collisions.
-Nate
I should have been a little more precise in my answer. What happens is that the true exception is hidden.
Yeah, I think there is something odd about the hashing of my objects. It would seem that how I do hashes shouldn't matter as you are using System#identityHashCode but I do seem to see a few resizes that are triggered by the stash running out of space, which if I understand the code correctly, would appear to indicate a bunch of hash collisions.
Oh you're right of course, it's an identity map so your hashcodes don't matter. I wonder if the changes to the internal hash2 and hash3 help (they were using a long and then truncating). I also wonder if we would have better hashing if we hash the identity hashcode instead of using it as-is for the first hash.
-Nate
--
You received this message because you are subscribed to a topic in the Google Groups "kryo-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kryo-users/op81RmHXOsM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kryo-users+...@googlegroups.com.
I quickly learned the errors of my ways of not using IdentityHashMap. :D ("Why the hell is this enum serializing as 1 and deserializing as 3???")
I moved back to using my "full size" messages, which end up calling CustomReferenceResolver#addWriteObject about 2.8M times per message and it's just happily churning away.
If I have time to build a local copy of kryo and play with it, I'll look into why the IdentityObjectIntMap gets so carried away
On Thursday, August 15, 2013 4:55:06 PM UTC+2, Brian Erst wrote:Has there been any movement on trying to get continuations into trunk? I'm bumping into the same sort of ArrayOutOfBounds issues in IdentiyObjectInMap and/or stack overflows on nested graphs.I'll provide tomorrow an updated patch for continuations based on the current trunk and containing some bug fixes. But the overall code structure of the patch hasn't changed a lot since I posted the original version of continuations a while ago.