I'm running a relay on my Raspberry Pi due to its low power consumption and simplicity, and have it set up to run headless via SSH so I can monitor it with tor-arm. My issue is that the longer my relay is running and the more Tor flags it gets, the more connections are made to my relay (mostly incoming) until it gets swamped and crashes.

For the first few days of operating my relay will have the flags Fast, HSDir, Running, V2Dir and Valid, and will average between 100 and 200 total connections perfectly fine. After three or four days it will gain the Stable flag, and that's when I will see incoming connections skyrocket; my Pi will handle 300 to 400 total connections but after that will struggle, and 500+ for an extended period will cause it to crash or reset, losing all connections and Tor flags.

Is it possible to somehow impose a limit on the total number of connections made by my relay? If I could keep the number of connections below 300, my Pi relay would always be rock solid and more worthy of the Stable flag when garnered.

I'm running Tor version

1 Answer 1


Tor Manual doesn't list a configuration option for limiting the connected clients. But it seems MaxAdvertisedBandwidth option can be used to reduce the number of clients by reducing the chance of being selected for a circuit (since this depends on the advertised bandwidth):

Server operators who want to reduce the number of clients who ask to build circuits through them (since this is proportional to advertised bandwidth rate) can thus reduce the CPU demands on their server without impacting network performance.

Tor FAQ entry titled Why is my Tor relay using so much memory? also suggest this configuration option for reducing the memory load:

If you still can't handle the memory load, consider reducing the amount of bandwidth your relay advertises. Advertising less bandwidth means you will attract fewer users, so your relay shouldn't grow as large[...]

So even the bandwidth is not your bottleneck, you may hopefully use this limit to keep the number of clients low.

  • Bandwidth isn't my problem - as I have those set in my torrc file - it's the number of connections being made to my relay that seem to be killing it. The more connections made to my relay, the more lagged it gets until it reaches the point of crashing.
    – PhraseD
    Mar 15, 2014 at 2:05
  • But the point was using bandwidth limit to indirectly reduce the number of clients. It turns out MaxAdvertisedBandwidth is a better control here, so I updated my answer. I admit that this is not a perfect solution as finding the right BW limit may require some trial & error.
    – gacar
    Mar 15, 2014 at 5:19
  • Ah! I didn't realize that the automated process for building Tor circuits relied on the bandwidth being offered. Although I was aware of the MaxAdvertisedBandwidth option, upon looking at the Tor manual again it clearly says it can be used to reduce the number of clients who connect. I'll try experimenting with this value. Thank you, gacar! :)
    – PhraseD
    Mar 15, 2014 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.