Skip to content

Commit 28acc43

Browse files
committed
feat(renderd): use priority queue for render requests
1 parent c3c4bea commit 28acc43

4 files changed

Lines changed: 312 additions & 69 deletions

File tree

docs/renderd-queue-tuning.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# renderd Queue Tuning
22

3-
`renderd` keeps incoming render requests in five queues:
3+
`renderd` keeps incoming render requests in a priority queue with five priority
4+
classes:
45

56
- priority request queue: missing tiles where a client is waiting
67
- request queue: stale tiles where a client is waiting
78
- low priority request queue: less urgent stale/style refresh work
89
- dirty queue: background work where no client waits for the response
910
- bulk request queue: explicit bulk rendering work
1011

11-
Requests are fetched in that priority order. When a time-critical request queue
12-
is full, new requests overflow into the dirty queue. That prevents immediate
13-
drops, but it also means the overflowed request no longer gets client-waiting
14-
priority.
12+
Requests are fetched by effective priority, preserving FIFO order within the
13+
same priority class. When a time-critical request class is full, new requests
14+
overflow into the dirty class. That prevents immediate drops, but it also means
15+
the overflowed request no longer gets client-waiting priority until a later
16+
client request for the same tile can promote it back into the appropriate
17+
priority class.
1518

1619
## Configuration
1720

@@ -44,6 +47,10 @@ Do not increase `dirty_queue_limit` blindly on an overloaded server. If the
4447
higher-priority queues are continuously non-empty, dirty work may still starve,
4548
and a larger dirty queue mainly stores more backlog. Watch queue length, queue
4649
time, render throughput, and dropped-tile metrics before and after the change.
50+
When a client requests a tile that is already queued as lower-priority work,
51+
`renderd` raises that existing item in the priority queue if the target priority
52+
class has capacity. If the target class is still full, the request remains
53+
background work and the client receives the usual not-done response.
4754

4855
Increase gradually. For example, move from the default to a limit sized for
4956
roughly 10 minutes of dirty work, then one hour, before trying day-scale values.
@@ -63,6 +70,7 @@ whether the service has predictable low-load windows.
6370
6. Roll back to the previous values if dirty queue time grows continuously or
6471
missing-tile requests appear to be delayed by old background work.
6572

66-
This setting only changes queue capacity. It does not implement bounded
67-
overtaking or fairness between queues; those would require a larger queue
73+
This setting changes per-priority capacity and works with duplicate promotion
74+
for already queued tiles. It does not implement bounded overtaking or broader
75+
fairness between unrelated queued tiles; those would require a larger queue
6876
scheduler change.

includes/request_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct request_queue {
5353
int dirtyLimit;
5454
int hashidxSize;
5555
int requestLimit;
56-
struct item reqHead, reqPrioHead, reqLowHead, reqBulkHead, dirtyHead, renderHead;
56+
struct item pendingHead, renderHead;
5757
struct item_idx *item_hashidx;
5858
int reqNum, reqPrioNum, reqLowNum, reqBulkNum, dirtyNum;
5959
pthread_mutex_t qLock;

0 commit comments

Comments
 (0)