When I restart the Tor Browser Bundle shortly after I've closed it I have the impression that relay information load faster. So I assume that the information about running relays is cached somehow. Is this assumption true? If yes, how long do those cached informations hold? If no, do you have an idea why it 'feels' sometimes faster?
1 Answer
Yes. The Tor program caches its directory information -- and it does it the same way inside TBB as it does in, say, the Tor debian package.
You can see the files in Data/Tor/ in your tor-browser directory. These files are documented in the Tor man page, under the "FILES" section towards the end. The most interesting two for Tor 0.2.3.x and 0.2.4.x are:
DataDirectory/cached-consensus and/or cached-microdesc-consensus The most recent consensus network status document we’ve downloaded.
and
DataDirectory/cached-microdescs and cached-microdescs.new These files hold downloaded microdescriptors. Lines beginning with @-signs are annotations that contain more information about a given router. The ".new" file is an append-only journal; when it gets too large, all entries are merged into a new cached-microdescs file.
You can learn all about what a "consensus" is and what a "router descriptor" is in the Tor directory protocol specification, as linked from the Design Documents section on the Tor documentation page.
There's also a cached-certs file, which contains the signed subkeys of the directory authorities.
As for how long the cached documents are valid, it depends on the document. The directory authorities create a new consensus every hour, and your client fetches a new one every 2-4 hours. But if you can't get a new one, you remain willing to use your current one for up to 24 hours -- that way the network doesn't grind to a halt when a few directory authorities go down for a bit. The microdescriptors are designed to last for a week or so; you only need a new one when the relay changes one of the elements of its microdescriptor -- typically the onion key.