[infinispan-issues] [JBoss JIRA] (ISPN-7802) Use chunked reads/writes in TcpTransport

Radim Vansa (JIRA) issues at jboss.org
Mon May 15 04:54:00 EDT 2017


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

Radim Vansa commented on ISPN-7802:
-----------------------------------

[~dan.berindei] Because NIO (some code in sun.*) allocates a direct buffer with the same size as the provided array and stores this in a thread-local, never releasing that. 

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6210541

> Use chunked reads/writes in TcpTransport
> ----------------------------------------
>
>                 Key: ISPN-7802
>                 URL: https://issues.jboss.org/browse/ISPN-7802
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Remote Protocols
>    Affects Versions: 9.0.0.Final
>            Reporter: Radim Vansa
>            Assignee: Tristan Tarrant
>
> The buffering implementation of {{TcpTransport.socketInputStream}} needs to use fixed size input buffer, rather than growing as {{BufferedInputStream}} does. Growing buffer can lead to excessive memory consumption on heap, and more importantly, by direct memory allocated in JDK classes and pooled in thread-local caches.
> EDIT: As Tristan pointed out, the {{BufferedInputStream}} does not grow in our use case, but if {{TcpTransport}} passes a big {{byte[]}} buffer, the implementation works as read through/write through. Therefore we need to chunk all calls.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the infinispan-issues mailing list