You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "kpumuk (via GitHub)" <gi...@apache.org> on 2025/12/21 23:35:01 UTC
[PR] THRIFT-5914: Disable lingering for the Ruby server and configure client [thrift]
kpumuk opened a new pull request, #3275:
URL: https://github.com/apache/thrift/pull/3275
<!-- Explain the changes in the pull request below: -->
Implemented lingering the same way C++ library handles it:
* completely disabled for the server https://github.com/apache/thrift/blob/master/lib/cpp/src/thrift/transport/TServerSocket.cpp#L335-L342
* enabled for the client but with timeout of 0 seconds https://github.com/apache/thrift/blob/master/lib/cpp/src/thrift/transport/TSocket.cpp#L101-L102
Lingering for the client can be configured:
```ruby
socket = Thrift::Socket.new('localhost', port)
# Disable lingering
socket.linger(false, 0)
# Enable lingering with timeout 10 seconds
socket.linger(true, 10)
```
## Benchmark
Before:
```
THRIFT_NUM_CALLS=1 THRIFT_NUM_CLIENTS=1000 THRIFT_SERVER=Thrift::ThreadPoolServer ruby benchmark/benchmark.rb; netstat -n | wc -l
Starting server...
Spawning benchmark processes...
Collecting output...
Translating output...
Analyzing output...
Server class: Thrift::ThreadPoolServer
Server interpreter: ruby
Client interpreter: ruby
Socket class: Thrift::Socket
Number of processes: 40
Clients per process: 1000
Calls per client: 1
Using fastthread: no
Connection failures: 0
Connection errors: 0
Average time per call: 0.0080 seconds
Average time per client (1 calls): 0.0082 seconds
Total time for all calls: 319.6949 seconds
Real time for benchmarking: 9.1044 seconds
Shortest call time: 0.0001 seconds
Longest call time: 0.0229 seconds
Shortest client time (1 calls): 0.0003 seconds
Longest client time (1 calls): 0.2283 seconds
====> 13714 open sockets afterwards in TIME_WAIT status
```
After:
```
$ THRIFT_NUM_CALLS=1 THRIFT_NUM_CLIENTS=1000 THRIFT_SERVER=Thrift::ThreadPoolServer ruby benchmark/benchmark.rb; netstat -n | wc -l
Starting server...
Spawning benchmark processes...
Collecting output...
Translating output...
Analyzing output...
Server class: Thrift::ThreadPoolServer
Server interpreter: ruby
Client interpreter: ruby
Socket class: Thrift::Socket
Number of processes: 40
Clients per process: 1000
Calls per client: 1
Using fastthread: no
Connection failures: 0
Connection errors: 0
Average time per call: 0.0083 seconds
Average time per client (1 calls): 0.0084 seconds
Total time for all calls: 330.7904 seconds
Real time for benchmarking: 9.2939 seconds
Shortest call time: 0.0001 seconds
Longest call time: 0.0245 seconds
Shortest client time (1 calls): 0.0003 seconds
Longest client time (1 calls): 0.2390 seconds
====> 4 open sockets afterwards, ~85 in the process
```
<!-- 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? [THRIFT-5914](https://issues.apache.org/jira/browse/THRIFT-5914)
- [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.
To unsubscribe, e-mail: dev-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-5914: Disable lingering for the Ruby server and configure client [thrift]
Posted by "kpumuk (via GitHub)" <gi...@apache.org>.
kpumuk commented on PR #3275:
URL: https://github.com/apache/thrift/pull/3275#issuecomment-3682149912
Current state in other libraries, omitted ones do not configure lingering (off by default)
| Language | Server | Client | Notes |
| -------- | ------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| c_glib | | | Proposed, and then deleted here [THRIFT-2414](https://issues.apache.org/jira/browse/THRIFT-2414) |
| cpp | [0, 0] | [1, 0] | Issues with terminating connections [THRIFT-3888](https://issues.apache.org/jira/browse/THRIFT-3888), in WSL [THRIFT-5374](https://issues.apache.org/jira/browse/THRIFT-5374) |
| d | [0, 0] | | |
| delphi | [0, 0] | [1, 0] | |
| java | | [0, 0] | |
| netstd | | | Intentionally not used, see [THRIFT-904](https://issues.apache.org/jira/browse/THRIFT-904) |
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-5914: Disable lingering for the Ruby server and configure client [thrift]
Posted by "kpumuk (via GitHub)" <gi...@apache.org>.
kpumuk commented on PR #3275:
URL: https://github.com/apache/thrift/pull/3275#issuecomment-3679948770
Found this ticket and now I am questioning both this and C++ implementation: https://issues.apache.org/jira/browse/THRIFT-3888
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-5914: Disable lingering for the Ruby server and configure client [thrift]
Posted by "kpumuk (via GitHub)" <gi...@apache.org>.
kpumuk closed pull request #3275: THRIFT-5914: Disable lingering for the Ruby server and configure client
URL: https://github.com/apache/thrift/pull/3275
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] THRIFT-5914: Disable lingering for the Ruby server and configure client [thrift]
Posted by "kpumuk (via GitHub)" <gi...@apache.org>.
kpumuk commented on PR #3275:
URL: https://github.com/apache/thrift/pull/3275#issuecomment-3680278884
Stress-testing with `so_linger(1, 0)` on a benchmark with 40,000 separate calls in multiple processes, closing and re-opening the socket for each call leads to actual data loss on `oneway` RPC - 0-4 calls out of 40,000.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org