ryanblenis / MeshCentral-ScriptTask

Scripting plugin for MeshCentral
Apache License 2.0
54 stars 14 forks source link

High CPU usage with ScriptTask plugin enabled #29

Open cgb opened 2 years ago

cgb commented 2 years ago

Hey there,

I've been ramping up my use of ScriptTask for scheduling scripts across a reasonable number of agents, and had noticed mongod CPU usage burst to 100% very regularly.

Monitoring CPU usage of the server, disabling ScriptTask results in this drop in CPU:

image

I do have > 120k rows in the plugin_scripttask collection:

rs:PRIMARY> db.getCollection("plugin_scripttask").find({}).count()
122373

From looking at the code, I can see some spinning over the data each minute (updateFrontEnd, historyData). I haven't looked too hard to see how it can be solved, but I thought I'd log this as a heads up for others and if I find any improvements, I'll report back.

Thanks!

ne0YT commented 1 year ago

@cgb hey there.. maybe you use something else now? would be very interested..

ryanblenis commented 1 year ago

Hey guys, sorry I've been coding a lot of other projects recently. Interested what data / results you're pushing around from the scripts and how often they run on endpoints?