summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_router.h
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-01-29 16:17:36 +0300
committerMax Romanov <max.romanov@nginx.com>2018-01-29 16:17:36 +0300
commit9cd4fdbdb78e035254e8094b5cff2155857ab764 (patch)
tree6de4ee721996740cbeda8647e11b8b2aa18e704f /src/nxt_router.h
parenta36babddef203d79dc37736661e1a042df4064f8 (diff)
downloadunit-9cd4fdbdb78e035254e8094b5cff2155857ab764.tar.gz
unit-9cd4fdbdb78e035254e8094b5cff2155857ab764.tar.bz2
Introducing extended app process management.
- Pre-fork 'processes.spare' application processes; - fork more processes to keep 'processes.spare' idle processes; - fork on-demand up to 'processes.max' count; - scale down idle application processes above 'processes.spare' after 'processes.idle_timeout'; - number of concurrently started application processes also limited by 'processes.spare' (or 1, if spare is 0).
Diffstat (limited to 'src/nxt_router.h')
-rw-r--r--src/nxt_router.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nxt_router.h b/src/nxt_router.h
index 1370262c..a904901c 100644
--- a/src/nxt_router.h
+++ b/src/nxt_router.h
@@ -83,18 +83,29 @@ struct nxt_app_s {
nxt_thread_mutex_t mutex; /* Protects ports queue. */
nxt_queue_t ports; /* of nxt_port_t.app_link */
+ nxt_queue_t spare_ports; /* of nxt_port_t.idle_link */
+ nxt_queue_t idle_ports; /* of nxt_port_t.idle_link */
+ nxt_timer_t idle_timer;
+ nxt_work_t adjust_idle_work;
+ nxt_event_engine_t *engine;
+
nxt_queue_t requests; /* of nxt_req_app_link_t */
nxt_queue_t pending; /* of nxt_req_app_link_t */
nxt_str_t name;
- uint32_t pending_workers;
- uint32_t workers;
- uint32_t max_workers;
+ uint32_t pending_processes;
+ uint32_t processes;
+ uint32_t idle_processes;
+
+ uint32_t max_processes;
+ uint32_t spare_processes;
+ uint32_t max_pending_processes;
uint32_t max_pending_responses;
uint32_t max_requests;
nxt_msec_t timeout;
nxt_nsec_t res_timeout;
+ nxt_msec_t idle_timeout;
nxt_app_type_t type:8;
uint8_t live; /* 1 bit */