Simple module to warmup a server application (such as an Express app) by hitting server URLs and performing various tasks. This module also allows a worker to be warmed up before it is added to a cluster.
npm install warmup
var warmup = ;;;
Simple example of warming up an Express server application:
var warmup = ;var express = ;var app = ;// ...;
Passing the warmup tasks information:
- string: as a string that contains the path of the url to make a GET request to during warmup, e.g. '/foo'
- object: as an object if you want to pass additional properties like headers to the request object. Be sure to pass a path property at the bare minimum when passing the request information in this case
The following options are supported:
- timeout - Timeout for each task (defaults to 10s)
- warmupPort - The warmup port to use (defaults to a random port in the range of [10,000-50,000])
warmup module works by starting the app on a random HTTP port. This allows the application to be started without accepting traffic.
- All of the tasks are executed in parallel
- The default timeout is 10s