You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King III (JIRA)" <ji...@apache.org> on 2019/01/04 03:06:00 UTC

[jira] [Resolved] (THRIFT-4714) Java TFramedTransport calls write twice for each flush

     [ https://issues.apache.org/jira/browse/THRIFT-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James E. King III resolved THRIFT-4714.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.0

> Java TFramedTransport calls write twice for each flush
> ------------------------------------------------------
>
>                 Key: THRIFT-4714
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4714
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Library
>    Affects Versions: 0.12.0
>            Reporter: James E. King III
>            Assignee: James E. King III
>            Priority: Major
>             Fix For: 1.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Code calls two writes to the underlying transport per flush: one for the frame size and one for the payload.  The result is that folks use TBufferedTransport on top of TFramedTransport to avoid getting two ethernet frames for small packets.  This means everything is double-buffered!
> Based on THRIFT-1121 and THRIFT-959 this may have been an issue for a long time - the fix was easy however.  We make room for the frame size before writing to the buffer, then we only have to pull out the buffer, drop the frame size into the 4 bytes that we pre-allocated, and then write to the underlying transport once.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)