1

I'm trying to develop a small app in Java that will monitor my server's CPU load and memory (with SIGAR) and display real time or past data on graphs in the client app (on my home computer).

I was wondering which way would be best to store the data, file or database (in tems of resources, speed, ..) as I record it every second ?

  • 1
    Possible duplicate of [http://stackoverflow.com/questions/2356851/database-vs-flat-files][1] [1]: http://stackoverflow.com/questions/2356851/database-vs-flat-files – Swapnil Feb 19 '15 at 09:28
  • Things to consider are 'overhead' ie how much memory / cpu / disk access etc the capture side uses (typically the lower level file approach would win here) vs flexibility of use etc (Where typically a db would win). A mixed approach is typical here, the capture goes to a file say and periodically that is loaded into a db which is then used by the frontend. Realistically your going to want to do things like 'thin out' the historical data replacing your per second data with 5 minute averages say, at least if you plan to retain the data long term. So 'best' depends on you priorities and goals – tolanj Feb 19 '15 at 09:31
  • I want my program to run background on the server, so use less ressources as possible (CPU and memory). So I was thinking querying a database every second would take more resources than just writing a new line in a text file. @tolanj that could be an alternative solution yeah – Captain Spaulding Feb 19 '15 at 09:37

0 Answers0