Replies: 2 comments 3 replies
-
Another thing to discuss is what else we should delete. For example the MySQL backend stores every single command request in three places:
should be be cleaning up |
Beta Was this translation helpful? Give feedback.
-
Yes, I agree an option to delete commands is worth supporting. But there's a few caveats I want to note:
I'd lean very heavily towards your suggestion #1: implementing this inside of the I think this feature (of command deletion) should be entirely the discrection of a storage backend. Your suggestion #2 to add storage interface methods of, say, Something that's been discussed in #6 is the idea of having API access to the existing command queue including command completion status, full result retrieval, and to the point in #6 — the ability to resend webhook events. That's an idea that's been around for a while with MicroMDM as well. The problem there is that the Webhook is not guaranteed for anything. Basically: it's an HTTP request fired off asynchronously. So in order to combat the issue of unreliable HTTP having retroactive access to the command queue and thus (possibly) webhook events seems beneficial. That said other ideas to solve this problem are integrating with proper message queueing system like, say, NSQ and many others. Anyway I mention this to just bolster that this would definitely want to be an option and not a default configuration. As far as "configurability" — the mysql storage backend already has the familiar Go Lines 61 to 64 in 56c9b7e As far as an actual implementation goes in the mysql storage backend I have a few thoughts as well. Essentially I imaging it working something like this: Assuming the above mentioned boolean is turned on for the storage, then every time we're called to store command results for an
Just a note that in NanoMDM (this open source project) we have full referential integrity in the SQL schema so deleting a command from the table will delete all of it's enqueued instances ( One other note is that I recently added a mysql storage command queue integration test in cbda10f. It is default-off (gated away by a Go build tag of I hope that helps. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Currently none of the storage backends delete enqueued commands, even after a acknowledge/error response. Apple states that commands only need to be kept on the queue until one of these positive responses has been received. When operating at scale, these commands (especially those with large payloads) begin to take up incredible amounts of space which hinders maintainability and resource efficiency. I propose that we delete every command as soon as the last machine has acknowledged it (commands can be sent to multiple machines, so care must be taken to not delete them too eagerly).
This can be done in one of several fashions:
StoreCommandReport
in the storage drivers to check for any remaining references to a command, and then delete it if none existDeleteCommand
orCleanupCommand
method to the interfaceI'm not sure if I like the first option, because it adds additional side effects to
StoreCommandReport
when deletions should be treated specially (and opted-into). Of course the second is more work, but I'm willing to figure out what it takes to do this.I'm opening this up to discussion to see if there are any better options and how y'all feel about cleaning up already ack'd commands.
Beta Was this translation helpful? Give feedback.
All reactions