hetrixtools / agent

HetrixTools Server Monitoring Agent (Linux)
https://hetrixtools.com/uptime-monitor/
88 stars 29 forks source link

Avoid writing `.log` file to disk when possible #57

Open SukkaW opened 10 months ago

SukkaW commented 10 months ago

I noticed that the agent consistently collects server status data, compresses and encodes it, and stores it in the hetrixtools_agent.log file:

https://github.com/hetrixtools/agent/blob/00d0650ca34ff63be9ff587186c47ad16acbdf77/hetrixtools_agent.sh#L655

This process signifies that the agent writes several hundred kilobytes of data to the disk every minute, potentially diminishing SSD lifespan.

Would it be possible to simply save the data within a shell variable and directly send the request using that variable (i.e., store all information in memory)? This could enhance performance and extend disk lifespan.

SukkaW commented 10 months ago

Do notice that we can use the /run directory (newer Linux) or /var/run (older Linux) directly. /run or /var/run is the tmpfs (in RAM), not in disk.