[tor-bugs] #7176 [Tor]: Reduced TOR memory consumption for embedded devices

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Mon Oct 22 18:37:54 UTC 2012


#7176: Reduced TOR memory consumption for embedded devices
-----------------------------------+----------------------------------------
    Reporter:  cypherpunks         |        Type:  enhancement                   
      Status:  needs_review        |    Priority:  normal                        
   Milestone:  Tor: 0.2.4.x-final  |   Component:  Tor                           
     Version:  Tor: unspecified    |    Keywords:  tor-client embedded low-memory
      Parent:                      |      Points:                                
Actualpoints:                      |  
-----------------------------------+----------------------------------------

Comment(by cypherpunks):

 There is a trac at AccessLabs as well, but it looks like it hasn't been
 updated in a few months (after they closed "support 2.3.19"). Might be
 able to contact someone via there to get them to comment on these.

 Having a specific key directory different from the TorDataDirectory is
 useful for an OpenWRT router (as I mentioned above) as it allows the keys
 to survive a reboot. Assuming that preserving the keys across reboots is
 actually a useful thing to do. I think it would be absolutely fine for the
 OpenWRT build process to pass in a couple of ./configure defines to make
 this happen, e.g.
 $ ./configure --enable-key-dir --with-key-dir=/etc/tor/keys

 The use of mmap() rather than tempfile might be a total wash, as I'm not
 sure how tempfile() on a tmpfs differs from mmap(-1) in terms of memory
 usage. I would be surprised if they were hugely different. A small
 savings, sure, but I would really be shocked if it was a huge improvement.

 The gzipped() file seems like it might be the biggest winner for mem
 usage. Compressing the data stored in the cache will really help with
 reducing memory consumption (I would imagine).

 I can test the patches in a couple groups to see if they provide huge
 improvements. I will assume that the time to live patches aren't too
 important (they take hours to have any effect), so I'll ignore them. The
 anon_mmap() and the gzip cache are the most likely candidates for
 immediate improvement, with gzip the most likely to be useful. I will test
 memory consumption and CPU utilization with the following combinations:

 * tor-alpha (vanilla build)
 * tor-alpha + gzip
 * tor-alpha + anon_mmap()
 * tor-alpha + gzip + anon_mmap()

 I'll report back the results of those changes. It is a bit hard to measure
 using only busybox, so the findings might be rough. Hopefully the memory
 savings are so profound that even busybox will detect them.

 The device I am going to be testing on is a TP-LINK MR3040, which has the
 following spec: 400mhz MIPS cpu, 32mb RAM, 4mb Flash. This device can load
 tor-stable, but after doing so it is... unstable. This is due primarily to
 tor-stable requiring something like 20mb of RAM during load, and using
 100% of CPU. I am hoping these patches will help significantly with that
 and bring the memory usage down to a sub-16mb size.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7176#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list