From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pbs-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 416BF1FF15E
	for <inbox@lore.proxmox.com>; Fri,  9 Aug 2024 13:22:53 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 036C83CD59;
	Fri,  9 Aug 2024 13:23:05 +0200 (CEST)
Date: Fri, 9 Aug 2024 13:22:31 +0200 (CEST)
From: Christian Ebner <c.ebner@proxmox.com>
To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>, 
 Max Carrara <m.carrara@proxmox.com>
Message-ID: <1045470937.13120.1723202551905@webmail.proxmox.com>
In-Reply-To: <D3B9YIIHKRP2.2EX6MKWE3C0NP@proxmox.com>
References: <D3B9YIIHKRP2.2EX6MKWE3C0NP@proxmox.com>
MIME-Version: 1.0
X-Priority: 3
Importance: Normal
X-Mailer: Open-Xchange Mailer v7.10.6-Rev67
X-Originating-Client: open-xchange-appsuite
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.022 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [proxmox.com]
Subject: Re: [pbs-devel] RFC: Scheduler for PBS
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pbs-devel-bounces@lists.proxmox.com
Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com>

> On 09.08.2024 11:31 CEST Max Carrara <m.carrara@proxmox.com> wrote:
> Architectural Overview
> ----------------------
> 
> The scheduler internally contains the type of job queue that is being
> used, which in our case is a simple FIFO queue. We also used HTTP
> long-polling [3] to schedule backup jobs, responding to the client only
> when the backup job is started.
> 
> While long-polling appears to work fine for our current intents and
> purposes, we still want to test if any alternatives (e.g.
> "short-polling", as in normal polling) are more robust.
> 
> The main way to communicate with the scheduler is via its event loop.
> This is a plain tokio task with an inner `loop` that matches on an enum
> representing the different events / messages the scheduler may handle.
> Such an event would be e.g. `NewBackupRequest` or `ConfigUpdate`.
> 
> The event loop receives events via an mpsc channel and may respond to
> them individually via oneshot channels which are set up when certain
> events are created. The benefit of tokio's channels is that they can
> also work in blocking contexts, so it is possible to completely isolate
> the scheduler in a separate thread if needed, for example.
> 
> Because users should also be able to dynamically configure the
> scheduler, configuration changes are handled via the `ConfigUpdate`
> event. That way even the type of the queue can be changed on the fly,
> which one prototype is able to do.
> 
> Furthermore, our prototypes currently run inside `proxmox-backup-proxy`
> and are reasonably decoupled from the rest of PBS, due to the scheduler
> being event-based.

Thanks for the write-up, this does sound interesting!

Do you plan to also include the notification system, e.g. by sending out notification events based on events/messages handled by the scheduler? Or will that solely be handled by the worker tasks?

What about periodic tasks that should be run at a given time, e.g. for server side alerts/monitoring tasks [0]? From you description I suppose these would simply be a different job type, and therefore be queued/executed based on their priority?

Can you already share some code (maybe of one of the prototypes), so one can have a closer look and do some initial testing or is it still to experimental for that?

Cheers,
Chris

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=5108


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel