@hapi/heavy v8.0.1
console
npm install @hapi/heavy@8.0.1console
yarn add @hapi/heavy@8.0.1console
pnpm add @hapi/heavy@8.0.1Measure process load.
Compatibility
| Major version | License | Node.js |
|---|---|---|
| 8 | BSD | >= 16 |
Methods
new Heavy(options)
Creates a new heavy instance where:
optionssampleInterval- frequency of load sampling in milliseconds. Defaults to0(no sampling).maxHeapUsedBytes- maximum V8 heap size bytes. Defaults to0(no limit).maxRssBytes- maximum process RSS size bytes. Defaults to0(no limit).maxEventLoopDelay- maximum event loop delay duration in milliseconds. Defaults to0(no limit).maxEventLoopUtilization- maximum event loop utilization value. Defaults to0(no limit).
Returns a new Heavy object.
heavy.start()
Starts the sampling operation with sampleInterval frequency. When sampleInterval is 0, this operation does nothing.
heavy.stop()
Stops the sampling operation.
heavy.check()
Verifies the current process load and throws a server unavailable error when any of the configured limits is exceeded. The current process load is assigned to error.data. When sampleInterval is 0, this operation does nothing.
heavy.load
Object with the current process load:
eventLoopDelay- current event loop delay milliseconds.eventLoopUtilization- current event loop utilization value.heapUsed- current V8 heap size bytes.rss- current process RSS size bytes.