[infinispan-issues] [JBoss JIRA] (ISPN-4678) Trim down ExpandableMarshalledValueByteStream to the actual data length before storing in cache

Dan Berindei (JIRA) issues at jboss.org
Tue Sep 2 07:02:00 EDT 2014


    [ https://issues.jboss.org/browse/ISPN-4678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997624#comment-12997624 ] 

Dan Berindei edited comment on ISPN-4678 at 9/2/14 7:01 AM:
------------------------------------------------------------

[~mgencur]] the default max doubling size is actually 4MB, not 4KB, but I don't think we should be doubling the size at all: StringBuillder uses a 1.5 growth factor, and we could do the same.

If we changed the growth factor to 1.5, I'm not sure it would still make sense to "shrink" the ExpandableMarshalledValueByteStream by moving it into a new instance (or a new ImmutableMarshalledValueByteStream). We could also do the move only if the wasted space is greater than a threshold (say 20% of the buffer).


was (Author: dan.berindei):
[~afield] the default max doubling size is actually 4MB, not 4KB, but I don't think we should be doubling the size at all: StringBuillder uses a 1.5 growth factor, and we could do the same.

If we changed the growth factor to 1.5, I'm not sure it would still make sense to "shrink" the ExpandableMarshalledValueByteStream by moving it into a new instance (or a new ImmutableMarshalledValueByteStream). We could also do the move only if the wasted space is greater than a threshold (say 20% of the buffer).

> Trim down ExpandableMarshalledValueByteStream to the actual data length before storing in cache
> -----------------------------------------------------------------------------------------------
>
>                 Key: ISPN-4678
>                 URL: https://issues.jboss.org/browse/ISPN-4678
>             Project: Infinispan
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>          Components: Core
>    Affects Versions: 7.0.0.Beta1
>            Reporter: Martin Gencur
>            Assignee: Martin Gencur
>
> When storeAsBinary configuration flag is used, the ExpandableMarshalledValueByteStream is used to serialize objects to byte arrays. 
> However, for value size up to 4kB, almost half of the space for each cache entry can be wasted because the ByteStream is stored as is - with the additional space for future expansion.
> For value size greater than 4kB, only additional 25% of actual value size can be wasted. But as these values can be quite large, the wasted space gets bigger too.
> It is not necessary to store ExpandableMarshalledValueByteStream as is and can be shrinked to actual data size before storing in cache.



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the infinispan-issues mailing list