Project

General

Profile

Actions

Bug #20183

closed

Memory usage: Move after_commit UpdatePriority.run_update_thread to controller

Added by Tom Clegg about 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Story points:
-
Release relationship:
Auto

Description

Currently, the UpdatePriority.run_update_thread hook appears to be associated with unusually high memory usage in passenger workers processes.

Proposed fix is to handle these asynchronous updates using a rails handler called by a controller thread, similar to trash sweeps.

After a container create/update/delete call, controller should
  • acquire a (new) dblock.DBLocker, UpdateContainerPriority, waiting if necessary
  • check for "priority>0 but should be 0" and "priority=0 but should be >0" using queries like the ones in the current ruby code source:services/api/lib/update_priority.go
  • if any need fixing, call rails to fix them in batches, using a (new) system-only endpoint update_priority
  • release UpdateContainerPriority lock

This should be done in a singleton goroutine that runs separately from the http request handlers, such that no more than 1 check-and-correct operation is in progress at any given time, and the http client doing a container update doesn't need to wait for it to finish.

When anything needs fixing, controller should log the timing and success/failure (according to rails) of each batch.


Subtasks 1 (0 open1 closed)

Task #20194: Review 20183-update-priority-threadResolvedPeter Amstutz03/06/2023Actions

Related issues

Related to Arvados - Feature #20192: Move AuditLogs.tidy_in_background from Rails to controllerNewActions
Actions

Also available in: Atom PDF