Why Userspace Sucks - Or 101 Really Dumb Things Your App Shouldn't Do
During the development of Fedora Core 5 I found myself asking the same questions day after day:
- Why does it take so long to boot?
- Why does it take so long to start X?
- Why do I get the opportunity to go fetch a drink after starting various applications and waiting for them to load?
- Why does idling at the desktop draw so much power?
- Why does it take longer to shut down than it does to boot up?
I initially set out to discover if there was something the kernel could do better to speed up booting. A number of suggestions have been made in the past ranging from better readahead, to improved VM caching strategies, or better on-disk block layout. I did not get that far however, because what I found in my initial profiling was disturbing.
We have an enormous problem with applications doing unnecessary work, causing wasted time, and more power-drain than necessary.
This talk will cover a number of examples of common applications doing incredibly wasteful things, and will also detail what can be, and what has been done to improve the situation.
I intend to show by example numerous applications doing incredibly dumb things, from silliness such as reloading and re-parsing XML files 50 times each run, to applications that wake up every few seconds to ask the kernel to change the value of something that has not changed since it last woke up.
I created my tests using patches to the Linux kernel, but experimented with other approaches using available tools like strace and systemtap. I will briefly discuss the use of these tools, as they apply to the provided examples, in later sections of this paper.
Our userspace sucks. Only through better education of developers of "really dumb things not to do" can we expect to resolve these issues.