Performance Utils API Reference
The Performance Utils provide cold start detection, streaming responses, and performance monitoring for edge applications.ColdStartDetector
Cold start detection and optimization.Constructor
options
(object): Cold start detection options
Methods
isColdStart()
Check if current execution is a cold start.getColdStartCount()
Get number of cold starts.reset()
Reset cold start counter.PerformanceMonitor
Real-time performance monitoring.Constructor
options
(object): Performance monitoring options
Methods
start(label)
Start timing an operation.label
(string): Timer label
end(label)
End timing an operation.label
(string): Timer label
getDuration(label)
Get duration of an operation.label
(string): Timer label
getMemoryUsage()
Get current memory usage.getCpuUsage()
Get current CPU usage.StreamingResponse
Efficient streaming response handling.Constructor
Methods
write(data)
Write data to stream.data
(string|Uint8Array): Data to write
end()
End the stream.getReader()
Get stream reader.CompressionManager
Response compression utilities.Constructor
options
(object): Compression options
Methods
compress(response, options)
Compress a response.response
(Response): HTTP responseoptions
(object): Compression options
shouldCompress(response)
Check if response should be compressed.response
(Response): HTTP response
ResourceMonitor
Resource usage monitoring.Constructor
options
(object): Resource monitoring options