nvram space used by keys?

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
vvuk
DD-WRT Novice


Joined: 08 May 2009
Posts: 1

PostPosted: Sat Dec 18, 2010 7:49    Post subject: nvram space used by keys? Reply with quote
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?
Sponsor
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Mon Dec 20, 2010 23:08    Post subject: Reply with quote
Yes nvram is a mess and I've tossed out some of these ideas before but I don't think the devs care too much. Also if you enable features and then disable them then the variables usually are not unset; if you re-enable it then everything is filled out for you but while it's disabled it's just wasting space.
_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum