Opened 10 years ago

Closed 10 years ago

#1706 closed enhancement (duplicate)

Calculate fraction of bytes spent on answering directory requests

Reported by: karsten Owned by: Karsten
Priority: Medium Milestone:
Component: Metrics/CollecTor Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


I'm using the following patch to distinguish Directory traffic from OR traffic on my test relay:

diff --git a/src/or/connection.c b/src/or/connection.c
index 7b1493b..9eeed63 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2075,11 +2075,17 @@ connection_buckets_decrement(connection_t *conn, time_t n

if (conn->type == CONN_TYPE_EXIT)

rep_hist_note_exit_bytes_read(conn->port, num_read);

rep_hist_note_bytes_read(num_read, now);

+ log_info(LD_DIR, "Read %d bytes from %s connection " U64_FORMAT ".",
+ num_read, conn_type_to_string(conn->type),
+ U64_PRINTF_ARG(conn->global_identifier));

if (num_written > 0) {

if (conn->type == CONN_TYPE_EXIT)

rep_hist_note_exit_bytes_written(conn->port, num_written);

rep_hist_note_bytes_written(num_written, now);

+ log_info(LD_DIR, "Wrote %d bytes to %s connection " U64_FORMAT ".",
+ num_written, conn_type_to_string(conn->type),
+ U64_PRINTF_ARG(conn->global_identifier));


if (connection_counts_as_relayed_traffic(conn, now)) {

As a result, I get a very low fraction of Directory traffic compared to OR traffic. I wonder why that is the case.

In the attachment you can find a histogram of 10-second intervals and the sum of read and written bytes in KiB/s. There are only very few Directory connections with very little bandwidth consumption in that histogram. This is a 500 KiB/s middle node running for 24 hours.

Child Tickets

Attachments (1)

histogram.png (21.1 KB) - added by karsten 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by karsten

Attachment: histogram.png added

comment:1 Changed 10 years ago by nickm

Is it possible that this is undercounting "linked" directory connections, tunneled over TLS via BEGINDIR?

comment:2 Changed 10 years ago by arma

Top of connection_buckets_decrement() says

if (!connection_is_rate_limited(conn))

return; /* local IPs are free */

And linked conns are not rate limited.

comment:3 Changed 10 years ago by arma

/ Called whenever we've written data on a connection. */
static int
connection_flushed_some(connection_t *conn)

is probably the right place to look for written. Not sure about read yet.

Or you could move your patch to the top of connection-buckets-decrement
before that connection-is-rate-limited check, if it's just meant as a hack.

comment:4 Changed 10 years ago by karsten

Good catch. Argh. Thanks!

I moved my patch before the connection-is-rate-limited check for another 24-hour test. I'll have a look for a better place when implementing these stats in Tor, rather than testing whether the results might be useful.

comment:5 Changed 10 years ago by karsten

Resolution: duplicate
Status: newclosed

Oops, forgot about this trac entry when opening #1790. Closing this one.

Note: See TracTickets for help on using tickets.