facebookincubator/oomd

Show: lib to parse proc/cgroup data as json

Closed this issue · 2 comments

Hi,

the other day I watched a talk linked in HackerNews [1] by A. Zhang which mentioned this repo here.
I really liked the idea of this service so I had a look at the code and it seems that a sizable part of it is about getting a snapshot of the proc/psi data, ie parsing it into structs that then have lots and lots of optional members.

Which made me wonder if it might make more sense to parse the proc/psi data into JSON?
In order to get a feel for this idea I started a little library that only does that: fetch a snapshot of proc/croup/psi data as (nlohmann) JSON:
https://github.com/franklange/jm

It's only a quick prototype to see how this might look like, so it only handles a couple of use-cases but has basic tests for the parsers and should be easily extendable if needed.
Just wanted to share this idea and see if you guys have any feedback or input of why you didn't go for this approach?

Best,
Frank


[1] https://news.ycombinator.com/item?id=38894208

I don't have the full context regarding the decisions behind but my guess is that JSON is useful for human-readability as a serialization protocol, but for OOMD it does not store the system metrics as files or use it for IPC. It only logs occasionally. Therefore I think JSON may not bring enough benefits to justify its cost in extra complexity and runtime resource usage. But thank you for your suggestion and interests in the project!

Hi Leon,

thanks for the feedback! I still see some value in using JSON-as-a-library to fetch/manage state to simplify some code but I understand the concerns about performance. Always good to get a different perspective!
Let me know if there are other topics that I might be able to help with!