can be created before reaching the limit */
#define MASTER_PROCESS_LIMIT_ENV "PROCESS_LIMIT"
+/* getenv(MASTER_PROCESS_MIN_AVAIL_ENV) specifies how many processes of this
+ type are created at startup and are kept running all the time */
+#define MASTER_PROCESS_MIN_AVAIL_ENV "PROCESS_MIN_AVAIL"
+
/* getenv(MASTER_SERVICE_COUNT_ENV) specifies how many client connections the
process can finish handling before it should kill itself. */
#define MASTER_SERVICE_COUNT_ENV "SERVICE_COUNT"
unsigned int service_count_left;
unsigned int total_available_count;
unsigned int process_limit;
+ unsigned int process_min_avail;
unsigned int idle_kill_secs;
struct master_status master_status;
count > 0)
service->process_limit = count;
+ value = getenv(MASTER_PROCESS_MIN_AVAIL_ENV);
+ if (value != NULL && str_to_uint(value, &count) == 0 &&
+ count > 0)
+ service->process_min_avail = count;
+
/* set the default service count */
value = getenv(MASTER_SERVICE_COUNT_ENV);
if (value != NULL && str_to_uint(value, &count) == 0 &&
return service->process_limit;
}
+unsigned int master_service_get_process_min_avail(struct master_service *service)
+{
+ return service->process_min_avail;
+}
+
unsigned int master_service_get_idle_kill_secs(struct master_service *service)
{
return service->idle_kill_secs;
/* Returns how many processes of this type can be created before reaching the
limit. */
unsigned int master_service_get_process_limit(struct master_service *service);
+/* Returns service { process_min_avail } */
+unsigned int master_service_get_process_min_avail(struct master_service *service);
/* Returns the service's idle_kill timeout in seconds. Normally master handles
sending the kill request when the process has no clients, but some services
with permanent client connections may need to handle this themselves. */
service->client_limit));
env_put(t_strdup_printf(MASTER_PROCESS_LIMIT_ENV"=%u",
service->process_limit));
+ env_put(t_strdup_printf(MASTER_PROCESS_MIN_AVAIL_ENV"=%u",
+ service->set->process_min_avail));
env_put(t_strdup_printf(MASTER_SERVICE_IDLE_KILL_ENV"=%u",
service->idle_kill));
if (service->set->service_count != 0) {