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/03 12:34:00 UTC

[jira] [Updated] (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 updated THRIFT-4714:
--------------------------------------
    Description: 
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.

  was: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 we pre-allocated, and write to the underlying transport once.


> 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
>          Time Spent: 10m
>  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)