[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #12890 [Tor]: Design and implement optimizations for socket write limits
#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: |
-----------------------------+--------------------------------
Changes (by robgjansen):
* milestone: Tor: 0.2.7.x-final => Tor: 0.2.6.x-final
Comment:
Currently talking with Nick about the design of this component. We decided
that this could completely be implemented in a separate thread with no
feedback to the master thread.
'''Get the buffer lengths:'''
{{{
ioctl(fd, SIOCINQ, &inqlen);
ioctl(fd, SIOCOUTQ, &outqlen);
}}}
This gives us the length (ie, data waiting for io) of the send and receive
buffer.
'''Get the TCP info:'''
{{{
getsockopt(fd, SOL_TCP, TCP_INFO, (void *)&tcp_info, &tcp_info_length);
}}}
That gives us this struct (or something like it):
{{{
struct tcp_info {
__u8 tcpi_state;
__u8 tcpi_ca_state;
__u8 tcpi_retransmits;
__u8 tcpi_probes;
__u8 tcpi_backoff;
__u8 tcpi_options;
__u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
__u32 tcpi_rto;
__u32 tcpi_ato;
__u32 tcpi_snd_mss;
__u32 tcpi_rcv_mss;
__u32 tcpi_unacked;
__u32 tcpi_sacked;
__u32 tcpi_lost;
__u32 tcpi_retrans;
__u32 tcpi_fackets;
/* Times. */
__u32 tcpi_last_data_sent;
__u32 tcpi_last_ack_sent; /* Not remembered, sorry. */
__u32 tcpi_last_data_recv;
__u32 tcpi_last_ack_recv;
/* Metrics. */
__u32 tcpi_pmtu;
__u32 tcpi_rcv_ssthresh;
__u32 tcpi_rtt;
__u32 tcpi_rttvar;
__u32 tcpi_snd_ssthresh;
__u32 tcpi_snd_cwnd;
__u32 tcpi_advmss;
__u32 tcpi_reordering;
__u32 tcpi_rcv_rtt;
__u32 tcpi_rcv_space;
__u32 tcpi_total_retrans;
};
}}}
[See here - http://linuxgazette.net/136/pfeiffer.html More info here.]
'''Then we want setsockopt to set the buffer sizes based on the current
length and the tcp window:'''
{{{
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *)&snd_size, snd_size_len);
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *)&rcv_size, rcv_size_len);
}}}
'''NOTE:''' When setting `SO_SNDBUF` and `SO_RCVBUF` with `setsockopt`,
the value applied is double the valued passed (it is automatically doubled
by the kernel).
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12890#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs