Linux daemon: how to store the data that is often updated -
Linux daemon: how to store the data that is often updated -
i work embedded systems (pic microcontrollers), have no experience in linux scheme programming.
i'm reading book "linux scheme programming" robert love, gives me basic understanding how should programme talk kernel, how things work, etc.
now, need write daemon should monitor per-application net activity, , store bandwidth of each application. (it's "nethogs" utility, daemon should run time , store statistics, unlike nethogs) although need such statistics (bandwidth per application), write daemon in educational purposes, don't care if kind of reinventing wheel.
the question short: preferred method store data?
say, daemon wake every second, grab current upload/download speed , applications caused network activity, store somewhere, , sleep again.
i see 2 ways store data:
implement own info format, kind of text file. don't this, because it's hard create extensible , on; rely on existing solution fits needs well; use database: say, sqlite. i'm not sure if thought write database each second, since expensive. should store info in ram minute, , flush database after that, if client connected displays real-time stats, flush info each sec anyway?not sure of this. there different, improve approaches? suggestions appreciated.
linux daemon datastore
Comments
Post a Comment