protect.rapache.memory {AnalysisPageServer} | R Documentation

## protect.rapache.memory

### Description

Set up events and handler to turn over memory-bloated worker processes

### Usage

    protect.rapache.memory(app, max.mb, app.event = "FinishAnalysis",
      memory.event = "BloatedMemory")

### Arguments

`app` | AnalysisPageRApacheApp
`max.mb` | Maximum allowed memory usage before triggering turnover.
`app.event` | Name of event which should trigger this memory check. Default: "FinishAnalysis".
`memory.event` | Name of event which excess memory usage should trigger. Default: "BloatedMemory".

### Details

Set up events and handler to turn over memory-bloated worker processes. When Rapache processes process requests that require large amounts of memory they don't return the memory to the OS. Eventually it can build up, slowing down the server when then has to turn to cache. Calling this function will add a check at each FinishAnalysis which, if the process is using more memory than the threshold specified by `max.mb`, delivers a SIGUSR1 signal to itself. This is a signal to Apache that the process should be turned over after finish the current request, thus pruning bloated workers.

### Value

Nothing

### Author(s)

Brad Friedman

[Package AnalysisPageServer version 1.21.0 Index]