spladug opened a new pull request #2200:
URL: https://github.com/apache/thrift/pull/2200


   Client: py
   
   This is inspired by changes to the Go library (THRIFT-5214) and, by proxy, 
[this blog post][1]. The idea is that if the other end of the socket has closed 
their end of the connection, we can figure that out by doing a non-blocking 
read on our socket before we waste time serializing and sending a message just 
to find out the socket is closed when we try to read the response.
   
   I've done some 
[benchmarking](https://gist.github.com/spladug/91483032d410714e1d416467a476a1ad)
 on the addition and found it performs reasonably: costing about 2 microseconds 
per `isOpen()` call.
   
   I've tested on Python 2.7, 3.7, and 3.8 on Linux. I've tested on Python 3.8 
on Windows.
   
   We have been running this in production at reddit for several 
high-throughput services for several days. There was no noticeable impact on 
latencies but there is a very significant drop in RPC error rates.
   
   [1]: https://github.blog/2020-05-20-three-bugs-in-the-go-mysql-driver/
   
   <!-- Explain the changes in the pull request below: -->
     
   
   <!-- We recommend you review the checklist/tips before submitting a pull 
request. -->
   
   - [x] Did you create an [Apache 
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  (not 
required for trivial changes)
   - [x] If a ticket exists: Does your pull request title follow the pattern 
"THRIFT-NNNN: describe my issue"?
   - [x] Did you squash your changes to a single commit?  (not required, but 
preferred)
   - [x] Did you do your best to avoid breaking changes?  If one was needed, 
did you label the Jira ticket with "Breaking-Change"?
   - [ ] If your change does not involve any code, include `[skip ci]` anywhere 
in the commit message to free up build resources.
   
   <!--
     The Contributing Guide at:
     https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
     has more details and tips for committing properly.
   -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to