linode/longview — pull request #4 by cederberg (2013-12-21 15:58:48+00:00)
Title: Changed to load and run all data getters in a child process

The data getters are using quite a bit of RSS memory, which seems wasteful to me. So this patch changes the datagetter module to fork, load modules, fetch data and then serialize the result to JSON and pipe back to the parent process.

This is will cause some extra CPU work, but it also reduces the RSS memory by some 3500 kB. Using this run-time model fully, it might be possible to cut down some additional MB. For instance, the JSON serialization might not be needed for each run of the loop.

All in all, the longview agent is now down to 12.6 MB on my system. But it should be possible to cut that down by at least half in my mind.

Let me know if you find these type of optimizations interesting.