[infinispan-issues] [JBoss JIRA] (ISPN-8385) Off-heap container entries contain addional bytes

William Burns (JIRA) issues at jboss.org
Wed Nov 8 11:19:00 EST 2017


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

William Burns edited comment on ISPN-8385 at 11/8/17 11:18 AM:
---------------------------------------------------------------

That is exactly what it is. Also to note this is only an issue with embedded off heap, server is perfectly fine since the serialization occurs on the client.

Looking at this there are 2 possible solutions:

# We could wrap the byte[] differently, thus preventing the GlobalMarshaller from occurring. Unfortunately we would then have to store an extra byte with the key and value to signify that it is a byte[] and not a serialized object. So this still has the same issue as reported. This also would then add an additional byte overhead to non byte[] entries, which when running embedded should be the most commonly used entries by far.
# If we pay attention to the upcoming cache type value and if it was _application/octet-stream_ we would know the values will always have to be byte[]. This isn't doable currently though and would only work under specific configuration settings.
# We could wrap the data container retrieved from the cache and automatically perform the encoding and wrapping for the user. This is probably the cleanest method, but I am not sure if we want to do this or not. [~gustavonalle] have an opinion? Virtually all of the components you can retrieve don't do this currently. Do we then have to go and change them all? Sounds nasty to me.

Therefore I am suggesting that this is not a bug and is just intended. If the user wants to use the data container directly they should retrieve the encoder and wrapper from the cache and do the operation themselves.


was (Author: william.burns):
That is exactly what it is. Also to note this is only an issue with embedded off heap, server is perfectly fine since the serialization occurs on the client.

Looking at this there are 2 possible solutions:

# We could wrap the byte[] differently, thus preventing the GlobalMarshaller from occurring. Unfortunately we would then have to store an extra byte with the key and value to signify that it is a byte[] and not a serialized object. So this still has the same issue as reported. This also would then add an additional byte overhead to non byte[] entries, which when running embedded should be the most commonly used entries by far.
# If we pay attention to the upcoming cache type value and if it was _application/octet-stream_ we would know the values will always have to be byte[]. This isn't doable currently though and would only work under specific configuration settings.
# We could wrap the data container retrieved from the cache and automatically perform the encoding and wrapping for the user. This is probably the cleanest method, but I am not sure if we want to do this or not. [~gustavonalle] have an opinion? Virtually all of the components you can retrieve don't do this currently. Do we then have to go and change them all? Sounds nasty to me.

Therefore I am saying that this 

> Off-heap container entries contain addional bytes
> -------------------------------------------------
>
>                 Key: ISPN-8385
>                 URL: https://issues.jboss.org/browse/ISPN-8385
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 9.1.1.Final, 9.2.0.Alpha1
>            Reporter: Vojtech Juranek
>            Assignee: William Burns
>
> Off-heap container entries contain some additional bytes (ASCII 1,2,1,4), which probably shouldn't be there. Besides additional consumption of memory, it can cause problem as entry put into the cache with cache API is not accessible via container API (which is available to the use), i.e. something like this will fail:
> {noformat}
> cache.put(key, value);
> container = AbstractDelegatingCache.unwrapCache(cache).getAdvancedCache().getDataContainer();
> InternalCacheEntry entry = container.get(key);
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the infinispan-issues mailing list