Ever wonder what’s up with the lag seen from time to time on your Android device while using certain apps or playing a variety of games? Developer lambgx02 likely cared a bit more than you, as it was bothering him enough to try to find the root cause of the issue so that he could attempt to fix it. He discovered that with a “very limited entropy pool” your device lags, as it waits for the kernel to generate more random data. Confused? Yeah, most of us probably are. In short, he may have found a solution to the problem.
Thanks to an an application and/or .zip file he created called Seeder, your device is able to produce that same high quality random data at much quicker intervals, which results in a reduction in lag.
Here is the technical explanation:
So, I was experiencing significant lag as we all do from time to time, and decided I was going to get to the bottom of it.
After tracing and debugging for hours, I discovered the source of 90% of Android’s lag. In a word, entropy (or lack thereof).
Google’s JVM, like Sun’s, reads from /dev/random. For all random data. Yes, the /dev/random that uses a very limited entropy pool.
Random data is used for all kinds of stuff.. UUID generation, session keys, SSL.. when we run out of entropy, the process blocks. That manifests itself as lag. The process cannot continue until the kernel generates more high quality random data.
So, I cross-compiled rngd, and used it to feed /dev/urandom into /dev/random at 1 second intervals.
Result? I have never used an Android device this fast.
It is literally five times faster in many cases. Chrome, maps, and other heavy applications load in about 1/2 a second, and map tiles populate as fast as I can scroll. Task switching is instantaneous. You know how sometimes when you hit the home button, it takes 5-10 seconds for the home screen to repopulate? Yeah. Blocking on read of /dev/random. Problem solved. But don’t take my word for it .. give it a shot!
In order to give it a shot, you need to have a rooted device. After that, you can either install the .apk file, give it root permissions, and then run it after each reboot. If you want a more permanent solution, there is a .zip file that can be flashed in custom recovery.
I have yet to test it myself, but if you cruise through the XDA threads below, you’ll find nothing but glowing reviews of Seeder. This is definitely not limited to the Nexus 7, either.
Be sure to post your results or thoughts in the comments.
Cheers Teng and Lucas!