Background jobs

Discover how to effectively manage background jobs using the App Monitor.

In the App Monitor’s “Jobs” section, you can track the status and details of various jobs associated with your application. Jobs come in different types and are generated as a result of various operations within the app runtime. Some common triggers for background jobs include:

  • Executing an action in the background
  • Receiving an event from an legacy service
  • Exporting or importing records

Within the App Monitor, you can monitor jobs responsible for these operations, view their statuses, progress, and access relevant logs.

Here’s the information available for each job:

  • Create date: Indicates when the job was created.
  • Waiting: Shows the elapsed time between job creation and the start of execution. This value increases while the job is pending.
  • Start date: Marks when the job’s execution commenced.
  • Duration: Reflects the time taken for the job to complete since its start date. This value continues to grow while the job is in progress.
  • Status: Indicates the current status of the job, such as "Pending," "In Progress," or "Finished."
  • Errors: Flags the presence of errors during job execution, with detailed information available in the job’s logs.
  • Low priority: Marks jobs as low priority, impacting their execution when the app experiences heavy loads.
  • Run by: Identifies the user who triggered the job; it may be empty for system jobs.
  • Progress: Offers an estimate of the job’s progress, although some jobs may not update this accurately.
  • Children execution: Shows the progress of child jobs, if any exist. Note that additional child jobs might be created during execution, adjusting the overall progress.

Operations on jobs

You can perform several operations on jobs by selecting the relevant jobs:

  • Stop: Attempts to gracefully halt a running job. After stopping, you can choose to resume it. Please note that certain jobs, such as those executing listeners, may not be stoppable mid-execution and will remain in a "Stopping" state until completion. System jobs may not have the option to stop.

  • Resume: Resumes the execution of a job in the "Stopped" state, continuing from where it left off.

  • Force Stop: Forces a job in the "Stopping" state to halt. Use this cautiously, as it may result in inconsistent data if no alternative exists.

  • Cancel: Discards a job in the "Stopped" state, making it unrecoverable.

  • Restart: Available for specific job types, this operation re-executes a "Finished" job if necessary.

  • Set low priority: Marks a job as low priority, scheduling it for execution during low app load periods.

  • Remove low priority: Removes the low priority flag, ensuring a job is executed as usual.

Logs

For each job, you can access logs specific to its execution. Log searching and filtering function similarly to app logs.

Children jobs

During a job’s execution, it may trigger other jobs known as children jobs. These not only help maintain the clarity of the main jobs list but also influence job scheduling. The scheduler allocates execution time based on root jobs (those without parents) to prevent a single job with numerous children from blocking others.

System jobs

You can view system jobs by clicking the “Show system jobs” button in the secondary menu. System jobs are generated by the platform to perform essential tasks, such as data refactorings or automatic updates to relationship fields.

System jobs are typically not necessary to monitor but can be inspected when needed.

Statistics

In the "Jobs > Statistics" section of the App Monitor, you can find valuable insights into job execution over time, including:

  • Number of creations: Indicates the total number of jobs created, useful for detecting anomalies in your app.

  • Average waiting time: Reflects the average duration a job waits before execution. An increase in this value suggests a performance issue, possibly requiring additional app instances.

  • Min waiting time: Displays the shortest waiting time among jobs before execution.

  • Max waiting time: Highlights the longest waiting time a job experienced before execution.