vvuk DD-WRT Novice
Joined: 08 May 2009 Posts: 1
|
Posted: Sat Dec 18, 2010 7:49 Post subject: nvram space used by keys? |
|
While trying to get down the amount of nvram used in my 601N, I noticed that out of 29,993 bytes, 73% of that was used by the -keys-, not the values. That is:
# nvram show | cut -d= -f1 | wc -c
size: 29993 bytes (2775 left)
21838
(I know that includes the \n's, but that'll be 100-200 bytes at most.) There's likely a lot of junk in here, and i'll be going through and doing a factory reset (as soon as I get back home), but I wonder if this is something to consider in future releases?
A couple of ideas come to mind:
1) Don't ever write keys with empty values; these keys (nvram show | grep '=$' | wc -c) are using up 7162 bytes for me (23% of total), or 6662 bytes on a different router with a clean v42-sp2 install (30% of total). This would probably be the biggest bang for the work invested.
2) Enforce some common naming policies; e.g. instead of having every milkfish param start with milkfish_, start it with 'mk_'. Replace common parts, e.g. ipaddr->ip, hwaddr->hw, etc. Replace all long names with shorter ones, e.g. "milkfish_ddsubscribersnum" -> "mk_dsnum".
3) Condense a number of wordy params. For example, I have a bunch of pci entries such as:
pci/1/1/mcs2gpo0=0x5555
pci/1/1/mcs2gpo1=0x5555
pci/1/1/mcs2gpo2=0x5555
pci/1/1/mcs2gpo3=0x5555
pci/1/1/mcs2gpo4=0
pci/1/1/mcs2gpo5=0
pci/1/1/mcs2gpo6=0
pci/1/1/mcs2gpo7=0
These could just be a single 'pci/1/1/mcs2gpo=0x5555 0x5555 0x5555 0x5555 0 0 0 0' entry.
4) More complex, but add some simple hierarchy to nvram. E.g. be able to group milkfish_* hierarchically, with the 'milkfish' string only stored once.
5) Use compression on large but regular data, e.g. traff. Applying gzip | base64 to the traff key values takes the size of traff data that I have from 1660 -> 1127 (32% savings). (Wouldn't help much for keys, unfortunately.)
Just some thoughts... now back to being a nvram janitor. I wonder if I can clear out a number of the no-value keys, and if I do, if they'll come back from the dead? |
|