Playing with /dev/random and available entropy
|
5th Jan, 2013, 04:48 AM
Post: #1
|
|||
|
|||
Playing with /dev/random and available entropy
After reading a thread on XDA about symlinking /dev/random to /dev/urandom and playing with the kernels read/write_wake_threshold values on Android devices I thought I'd try it on the Pi. There's a debate going in the XDA thread and on ASOP that it's just a placebo but hundreds of users have noticed a significant performance difference on their phones and Android kernel maintainers have begun to integrate the changes.
/dev/random generates entropy from numerous sources in the real-wrodl environment, e.g. keyboard strokes, mouse movement, touch screen swipes, and even sound via the microphone. With the Pi none of this happens as none of these devices are connected (for me anyway) so entropy generation is a little limited. You can check your current level with Code: cat /proc/sys/kernel/random/entropy_avail /dev/urandom is non-blocking so it won't hold your application, it will just keep generating entropy and thus faster responding apps. NOTE: /dev/urandom is "less secure" then /dev/random (Google it for an explanation) - this doesn't bother me. Using XBMC I've noticed a slight speed difference in just browsing through the menus, e.g. the "Settings" screen loads faster. fgrep-ing my way through the source code /dev/random is only used a few times within the XBMC code, one of ffmpegs libraries and libenca (used for text encoding) so it shouldn't make a difference. I know its used throughout the kernel and many other applications/libraries (e.g Couch Potato), SMB, anything to do with SSL, SSH, etc. Anyway long story short here's what I did: Code: apt-get install rng-tools Check your entropy now, it should be at least 3000. I'd be interested to see if anybody experiences any performance increases after doing this and its not just a placebo? To revert this just stop the rng-tools daemon, restore the /dev/random.org file and set the read/write thresholds back to 64 and 128 respectively. NOTE: The thresholds will reset on reboot, add them to /etc/sysctl.conf. I could be wrong on some of the information above, it's just what I've read in a few hours! Cheers. |
|||
5th Jan, 2013, 04:57 AM
Post: #2
|
|||
|
|||
RE: Playing with /dev/random and available entropy
Let me at first share this with you:
Code: cat /proc/sys/kernel/random/entropy_avail pilight - modular domotica solution
|
|||
5th Jan, 2013, 04:59 AM
Post: #3
|
|||
|
|||
RE: Playing with /dev/random and available entropy
Interesting, mine was always hovering around ~140ish - what are you running on your Pi?
|
|||
5th Jan, 2013, 05:06 AM
Post: #4
|
|||
|
|||
RE: Playing with /dev/random and available entropy
Just what you guys are
pilight - modular domotica solution
|
|||
5th Jan, 2013, 05:10 AM
Post: #5
|
|||
|
|||
Re: Playing with /dev/random and available entropy
on mine shows only 137
~~~~>>>Please always follow rules and read before you post<<<~~~~ |
|||
5th Jan, 2013, 05:19 AM
Post: #6
|
|||
|
|||
RE: Playing with /dev/random and available entropy
CurlyMo: already changed your thresholds?
Rikardo: would be interested to see if you notice any performance gain from this |
|||
5th Jan, 2013, 05:28 AM
Post: #7
|
|||
|
|||
RE: Playing with /dev/random and available entropy
No
pilight - modular domotica solution
|
|||
5th Jan, 2013, 05:50 AM
Post: #8
|
|||
|
|||
Re: Playing with /dev/random and available entropy
is it supposed to survive reboot ?
i did the steps and it showed arround 2700ish than i rebooted and now is back to low 128 ~~~~>>>Please always follow rules and read before you post<<<~~~~ |
|||
5th Jan, 2013, 06:03 AM
Post: #9
|
|||
|
|||
RE: Playing with /dev/random and available entropy
As long as you set your thresholds in /etc/sysctl.conf as well
|
|||
« Next Oldest | Next Newest »
|
Possibly Related Threads... | |||||
Thread: | Author | Replies | Views: | Last Post | |
Keep entropy pool full | JayBlanc | 15 | 49,583 |
21st Apr, 2013 04:22 AM Last Post: CurlyMo |