[tor-bugs] #12890 [Tor]: Design and implement optimizations for socket write limits
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sat Dec 20 20:54:53 UTC 2014
#12890: Design and implement optimizations for socket write limits
-----------------------------+--------------------------------
Reporter: robgjansen | Owner: robgjansen
Type: enhancement | Status: new
Priority: normal | Milestone: Tor: 0.2.6.x-final
Component: Tor | Version:
Resolution: | Keywords: tor-relay
Actual Points: | Parent ID: #12541
Points: |
-----------------------------+--------------------------------
Comment (by robgjansen):
Replying to [comment:11 nickm]:
> (Rob, please let me know which of the above are necessary before you
could start testing this.)
Some changes and thoughts:
1. **I have attached a patch** for a slight refactoring of the thread
main loop to make it easier to run the thread in Shadow.
1. I thought about it, and I'm pretty sure we don't actually want the
socket size calculation anymore. I needed it in my prototype because I was
not setting socket buf sizes explicitly, and so had to deal with the buf
size changing underneath me from tcp autotuning. Since we are setting the
buf size, taking `buf_size = MIN(sock_space, tcp_space);` would mean that
the buf size could never increase - and I think we don't want that! So,
all we would have to compute is `tcp_space` and we can save the other two
syscalls :) **I have attached a patch for this as well.**
1. It would be useful to have the global read/write limits feature there
before starting to test. For now, this could be as simple as a
configuration option that specifies the upstream link capacity, and then
the logic necessary to enforce the limit.
1. We probably also want to write a bit above the per-socket and/or
global limits, so that we can minimize kernel 'starvation' (when the
kernel could have sent something, but it had no data to send because our
calculations were a bit off). Options that specify how much above the per-
socket and global limits we want to write would be helpful. For example,
`buf_size = tcp_space;` would become `buf_size = tcp_space *
get_options()->KISTSockBufSizeFactor;` (e.g., 1.25) and there would be a
similar config for global limits. I think upper/lower bounds are a good
idea to enforce some max/min values.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12890#comment:12>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list