node-timeoutengine
Simple node module to find the 99%ile timeout value.
var wreck = ;var timeoutengine = ; var defaultTimeout = 5000;var serviceName = 'httpbin_get'; { var options = timeout: timeoutengine || defaultTimeout ; var reqStart = Date; var req = wreck;}
Problem statement
I am making a service call from node and hardcoding a fixed socketTimeout (or connectTimeout) value for the same. I am not sure that is the ideal value I can use?
TimeoutEngine
TimeoutEngine has API to feed the connect/socket durations and after let say N (default 100) request start returning the 99%ile + delta value. This is useful if you need adaptive timeout value based on the current server/network conditions.
API
configure(options)
- [Optional] Use if you want a different default config.addDuration(key, value)
- Generic addDuration APIgetTimeout(key)
- Generic getTimeout APIaddConnectDuration(key, value)
- Call this API to feed the connect duration of a service call for successful as well as failed requests.addSocketDuration(key, value)
- Call this API to feed the socket duration of a service call for successful as well as failed requests.getConnectTimeout(key)
- Returns this 99%ile + delta connect Timeout valuegetSocketTimeout(key)
- Returns this 99%ile + delta socket Timeout value