FlowFuse / FlowFuse/flowfuse

Scalability: Broker ACL checks

Open
#2,794 2 comments 0 reactions 0 assignees View on GitHub
size:L task
Dominant language
JavaScript
Stars
400
Forks
89
Avg merge
1d 20h
Merged PRs (30d)
149

Description

### Description

Part of #2782

Unlike the other items under the scalability banner, this item is more about easing some pressure on the forge app, rather than improving its scalability.

The main 'background' load on the forge app is handling the Device Agent check-ins. There are two parts to this:

1. The ACL check made by the broker to verify the device is allowed to publish
2. Handling the status update - updating database

We already have request caching in the broker auth plugin to try to minimise the load here - but given the load we are observing in production, there could be room for tuning here to easy some of the pressure. We still need to do the acl checks, but by increasing some of the caching settings in the broker we can reduce some of the pressure. We do have a bit of a 'thundering herd' issue as the work is driven by the devices when they connect, and the recurring checkins happen at an interval from that point.

We have added some jitter to the device-agent checkin times - we should look at increasing the jitter range to improve the spread of time the messages arrive in.

There are some other options such as creating a custom auth plugin for mosquitto that can do *some* more localised checking without having to hit the forge app. For example, the Project nodes publish to a topic structure of `ff/v1//p//out/+/#`. If a project node publishes to `ff/v1//p//out/foo/1` and `ff/v1//p//out/foo/2` that will drive two ACL checks. In reality, we only need to do a check for the stem of the topic (`ff/v1//p//out/`) - a custom auth plugin could deal with that locally and allow the local caching to match for both requests. (I've described this badly... but I know what I mean...).

### Epic/Story

#2782

### Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.