Preliminary Investigation: Finally, the Real Culprits

Hey everyone,

My investigation into the high CPU usage on the "moon" server has been a process of refining the data to get a clear answer. After first identifying python3 processes as the general cause, I updated my metrics script to capture more detailed information, specifically the full command line of the top process.

This new data allows for a much more precise analysis. Instead of just guessing which Python scripts are the problem, I can now query the metrics database for exactly which commands are running when the server's total CPU usage spikes.

The Analysis

New Metrics, Fresh Data

I ran a simple query to select the top CPU command line from any data point where the server's overall CPU usage was greater than 50%:

sqlite3 -header -csv server_metrics.db "SELECT top_cpu_cmdline FROM metrics WHERE cpu_percent == 100"

The Top Spikes

sqlite3 -header -csv server_metrics.db "SELECT top_cpu_cmdline FROM metrics WHERE cpu_percent > 50"

Showing what made all 8 spikes

The output was a list of the commands that were at the top of the process list during these high-load moments. After tallying the results from the last 24 hours, two scripts are clearly responsible for the vast majority of the CPU spikes:

  • python3 sendNotifications.py
  • python3 monitorDeposits.py

These two background bots appeared with roughly equal frequency during the periods of high load. Interestingly, the metrics collection script itself showed up once, but its impact is negligible compared to the notification and deposit monitoring scripts.

Conclusion

This finally gives us a clear, actionable target. The high server load isn't coming from the web applications, as one might suspect, but from background daemons running constantly.

The next step is to dive into the code for sendNotifications.py and monitorDeposits.py. I'll be looking for any inefficiencies, such as loops that don't have a sleep interval, or resource-intensive calculations that can be optimized. This has been a great lesson in the importance of collecting the right data. It took a few tries, but we now have a precise answer.

As always,
Michael Garcia a.k.a. TheCrazyGM

0.09355658 BEE
3 comments

Excellent detective work, congratulations on the now-specific clarity! Diving into the code is where I would have hit my (present) wall...lol! 😁 🙏 💚 ✨ 🤙

0.00049684 BEE

One of us, One of us, One of us!

It will come, everyone was new at one point. Just don't give up. :D

0.00000399 BEE

Hehe...I feel it, and I have the inkling that I'd become quite good at coding if I really dove into it. I still haven't really started to learn one language well yet, partly because choosing which one is not so easy. Python seems like a good choice, but since it's such a high-level language, I feel like I'd probably miss a lot. Then there's the issue of time to actually learn it. 😁 🙏 💚 ✨ 🤙

0.00045496 BEE

Now we are getting into the brass tax! I am actually really happy we are doing this investigation before the server rearrangement 🔥

!PAKX
!PIMP
!PIZZA

0.00043583 BEE

View or trade PAKX tokens.

@ecoinstant, PAKX has voted the post by @thecrazygm. (1/2 calls)



Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.

0.00042592 BEE

PIZZA!

$PIZZA slices delivered:
@ecoinstant(1/20) tipped @thecrazygm

Come get MOONed!

0.00041739 BEE