[JBoss JIRA] Commented: (ISPN-59) Add unit test that verifies number of written bytes
by Galder Zamarreño (JIRA)
[ https://jira.jboss.org/jira/browse/ISPN-59?page=com.atlassian.jira.plugin... ]
Galder Zamarreño commented on ISPN-59:
--------------------------------------
David and I were yesterday discussing this and he suggested an option to reduce the payload which should also improve perf since these objects would be resolved earlier in the JBMAR call stack:
May 12 19:19:50 <dmlloyd> if you want to shave off a few more bytes, you could use object table writers instead of externalizers to read and write objects with less overhead (but without the inter-version compatibility guarantees you get with externalizers)
May 12 19:19:58 <dmlloyd> for your use case it might be the smart thing to do
May 12 19:22:08 <galderz> what compatibility are you refering to exactly?
May 12 19:23:20 <dmlloyd> with externalizers, if you read from the stream under a different instance that has, say, a newer version of the class, since it uses the externalizer that was sent over the wire it will still work as long as the class is still compatible with the externalizer
May 12 19:23:45 <dmlloyd> with object tables, if the reader tries to read more bytes than the writer wrote, it'll blow up
May 12 19:23:53 <dmlloyd> (but it's much faster)
May 12 19:24:49 <dmlloyd> I have a feeling that it's not unlike the guarantees that the old marshaller made - the protocol simply does not change, period
May 12 19:26:13 <galderz> the old marshaller uses VAM in front
May 12 19:26:23 <galderz> which appends a version at the beginning of writing something
May 12 19:26:50 <dmlloyd> ah, well you could still do that
May 12 19:26:51 <galderz> so, when you read, it checks what version it is and sends it the appropiate marshaller
May 12 19:27:08 <galderz> that's how newer versions can still read older data
May 12 19:27:11 <dmlloyd> that would solve the problem for sure
May 12 19:27:30 <dmlloyd> then I'd recommend that you use object tables instead of externalizers
May 12 19:27:54 <galderz> besides, we keep sending externalizers around which i had doubts about last week
May 12 19:28:01 <dmlloyd> two stages maybe: have a Map<Object, Writer> that's checked for singletons, then a Map<Class<?>, Writer> that is for class-writers
May 12 19:28:43 <dmlloyd> then on the reader side you could just have a List<Blah> where Blah has e.g. Object read(Unmarshaller unmarshaller)
May 12 19:29:07 <dmlloyd> you could use IdentityHashMap for those maps and it should be pretty zippy
May 12 19:29:51 <galderz> I could have a class that implements both Blah and Writer
May 12 19:29:58 <galderz> and that would be my current externalizer
May 12 19:30:01 <galderz> pretty much
May 12 19:30:05 <dmlloyd> sure
May 12 19:30:18 <galderz> ok
> Add unit test that verifies number of written bytes
> ---------------------------------------------------
>
> Key: ISPN-59
> URL: https://jira.jboss.org/jira/browse/ISPN-59
> Project: Infinispan
> Issue Type: Sub-task
> Components: RPC
> Reporter: Galder Zamarreño
> Assignee: Galder Zamarreño
> Fix For: 4.0.0.BETA1, 4.0.0.GA
>
> Attachments: MarshallerTest.java, org.infinispan.marshall.MarshallerTest.xml
>
>
> Add written byte number comparisons to present JBossMarshallerTest to make sure that it writes
> less bytes that existing MarshallerImpl and standard Java Serialization (ObjectStreamMarshaller)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira