Best Approach to Pause/Resume Artifact Download

Our device performs some operations where we limit network traffic to a minimum, and that traffic is managed by these specific operations. These operations are initiated by users, and may occur at any time.

I don’t believe state scripts will work, as the download may already be in progress when the user initiates an operation.

Is there any issue with just stopping the service in the middle of a download and resuming when the operation is complete? This seems like it would typically work since mender resumes downloads due to other scenarios(poor connectivity/power loss etc.) but I am wondering if there is a better way.

If shutting down the service is the normal approach, would it also be a good idea to explicitly send inventory periodically? These operations may take hours once started and the device would not check in
with the service shut down.

Thanks!
Pat

Hi @Pat_Honeycutt, welcome to Mender Hub.

You can definitely shutdown the Mender service to respect network traffic restrictions but note that in some cases, if a deployment is in progress, that may be considered a failed deployment. I know there was some talk of adding better download-retry across Mender invocations but I don’t know the status of that. @lluiscampos, @oleorhagen can you comment?

There may be other Linux mechanisms that can work for this but I’ve never investigated them. I know you can limit network usage at a systemd service level but I believe that is a static setting in the service file that would require a service restart. Is there anyone with ideas on a dynamic mechanism to change the allowed bandwidth of a running process?

Drew

Hi @Pat_Honeycutt as far as I know, stopping the mender service during an update, will not resolve in a transparent continuation upon restart, I’m afraid.

But as you say, the download will continue from where it left off, later once restarted (just like it would in the case of powerloss, etc). I cannot see an issue with this approach, except for that it is not very elegant.

Also, note that the daemon needs to be running, in order to send the inventory (perhaps this should be improved :thinking: )

If the issue is that the client is stealing network bandwidth from your application, perhaps some sort of traffic shaping is a better option?

Hi @oleorhagen,

Thanks for the reply. I will need to look into a few options. I’ll report back when I make some progress.

1 Like