mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
Loading...
Searching...
No Matches
request_queue.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 - 2026 by mod_tile contributors (see AUTHORS file)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; If not, see http://www.gnu.org/licenses/.
16 */
17
18#ifndef REQUEST_QUEUE_H
19#define REQUEST_QUEUE_H
20
21#include "gen_tile.h"
22#include "render_config.h"
23#include <pthread.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30#define HASHIDX_SIZE 2213
31
63
67 struct item_idx {
69 struct item_idx *next;
71 struct item *item;
72 };
73
81 struct item reqHead, reqPrioHead, reqLowHead, reqBulkHead, dirtyHead, renderHead;
87 pthread_mutex_t qLock;
89 pthread_cond_t qCond;
92 };
93
95 void request_queue_close(struct request_queue *queue);
96
97 struct item *request_queue_fetch_request(struct request_queue *queue);
98 enum protoCmd request_queue_add_request(struct request_queue *queue, struct item *request);
99
100 void request_queue_remove_request(struct request_queue *queue, struct item *request, int render_time);
101 void request_queue_clear_requests_by_fd(struct request_queue *queue, int fd);
102
104 void request_queue_copy_stats(struct request_queue *queue, stats_struct *stats);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif /* REQUEST_QUEUE_H */
protoCmd
Command opcodes exchanged over the mod_tile / renderd IPC wire protocol.
Definition protocol.h:65
#define MAX_ZOOM
Maximum supported map zoom level.
Definition render_config.h:24
int request_queue_no_requests_queued(struct request_queue *queue, enum protoCmd)
Query the current number of pending items in a specific priority sub-queue.
Definition request_queue.c:539
void request_queue_remove_request(struct request_queue *queue, struct item *request, int render_time)
Unlink a completed request from the active render list, remove it from the hash index,...
Definition request_queue.c:482
void request_queue_clear_requests_by_fd(struct request_queue *queue, int fd)
Invalidate all queued/rendering references to a disconnected client socket fd.
Definition request_queue.c:308
struct item * request_queue_fetch_request(struct request_queue *queue)
Pop the highest-priority pending request from queue and move it to the active render list.
Definition request_queue.c:246
void request_queue_copy_stats(struct request_queue *queue, stats_struct *stats)
Copy a thread-safe snapshot of the queue's cumulative render statistics.
Definition request_queue.c:580
enum protoCmd request_queue_add_request(struct request_queue *queue, struct item *request)
Enqueue a new tile render request or coalesce it with an existing pending item.
Definition request_queue.c:381
void request_queue_close(struct request_queue *queue)
Destroy the request queue mutex and free the hash index and queue structure.
Definition request_queue.c:659
struct request_queue * request_queue_init()
Allocate and initialize a new request_queue with empty circular queues and hash index.
Definition request_queue.c:596
Hash bucket chain node mapping a metatile hash key to an active or queued struct item.
Definition request_queue.h:67
struct item * item
Pointer to the indexed metatile render request item.
Definition request_queue.h:71
struct item_idx * next
Next hash collision entry in the bucket chain (NULL at end of chain).
Definition request_queue.h:69
Node representing a queued or active metatile render request in the scheduler.
Definition gen_tile.h:50
int fd
Client socket file descriptor awaiting completion notification (FD_INVALID if none).
Definition gen_tile.h:60
Thread-safe multi-priority metatile render queue with hash-based duplicate coalescing.
Definition request_queue.h:77
int reqBulkNum
Definition request_queue.h:85
stats_struct stats
Cumulative throughput and latency counters for requests processed by this queue.
Definition request_queue.h:91
pthread_mutex_t qLock
Mutex protecting all queue lists, hash buckets, counters, and stats.
Definition request_queue.h:87
struct item_idx * item_hashidx
Array of hashidxSize bucket heads indexing all queued and in-flight requests by (xmlname,...
Definition request_queue.h:83
int reqPrioNum
Definition request_queue.h:85
int reqLowNum
Definition request_queue.h:85
struct item reqHead reqPrioHead reqLowHead reqBulkHead dirtyHead renderHead
Sentinel list heads for the standard, high-prio, low-prio, bulk, dirty, and active-render queues.
Definition request_queue.h:81
pthread_cond_t qCond
Condition variable signaled when new work is enqueued to wake idle render worker threads.
Definition request_queue.h:89
int hashidxSize
Number of buckets allocated in item_hashidx (typically HASHIDX_SIZE).
Definition request_queue.h:79
int reqNum
Current item counts in the standard, high-prio, low-prio, bulk, and dirty queues.
Definition request_queue.h:85
int dirtyNum
Definition request_queue.h:85
Cumulative render request counts and elapsed render durations tracked by request_queue.
Definition request_queue.h:35
long timeReqDirty
Cumulative render duration in milliseconds for cmdDirty jobs.
Definition request_queue.h:59
long noReqBulkRender
Total number of completed bulk/batch render jobs (cmdRenderBulk).
Definition request_queue.h:45
long timeReqRender
Cumulative render duration in milliseconds for cmdRender jobs.
Definition request_queue.h:51
long noZoomRender[20+1]
Per-zoom-level count of completed metatile renders (0 through MAX_ZOOM).
Definition request_queue.h:49
long timeReqLowRender
Cumulative render duration in milliseconds for cmdRenderLow jobs.
Definition request_queue.h:55
long noReqDroped
Total number of incoming requests dropped due to full queues or shutdown.
Definition request_queue.h:47
long noDirtyRender
Total number of completed background dirty-tile re-render jobs (cmdDirty).
Definition request_queue.h:37
long timeReqBulkRender
Cumulative render duration in milliseconds for cmdRenderBulk jobs.
Definition request_queue.h:57
long noReqPrioRender
Total number of completed high-priority interactive render jobs (cmdRenderPrio).
Definition request_queue.h:41
long timeReqPrioRender
Cumulative render duration in milliseconds for cmdRenderPrio jobs.
Definition request_queue.h:53
long noReqRender
Total number of completed standard interactive render jobs (cmdRender).
Definition request_queue.h:39
long noReqLowRender
Total number of completed low-priority interactive render jobs (cmdRenderLow).
Definition request_queue.h:43
long timeZoomRender[20+1]
Per-zoom-level cumulative render duration in milliseconds (0 through MAX_ZOOM).
Definition request_queue.h:61