From e9c0fb454acd4605a545a5dbb33490fba9501142 Mon Sep 17 00:00:00 2001 From: Pedro Nasser Date: Wed, 2 Nov 2016 20:52:07 -0200 Subject: [PATCH] memory docs (#210) --- docs/README.md | 1 + docs/memory.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 docs/memory.md diff --git a/docs/README.md b/docs/README.md index 90ff07c2d..ecdcf485c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,6 +8,7 @@ * [Message Queues](mqs/README.md) * [Logging](logging.md) * [Metrics](metrics.md) +* [Function Memory Requirements](memory.md) * [Triggers](triggers.md) * [Extending IronFunctions](extending.md) * [Docker Configuration](docker.md) diff --git a/docs/memory.md b/docs/memory.md new file mode 100644 index 000000000..d5bb3b935 --- /dev/null +++ b/docs/memory.md @@ -0,0 +1,59 @@ +# Function Memory Requirements + +A good practice to get the best performance on your IronFunctions API is define the required memory for each function. + +## Understanding IronFunctions memory management + +When IronFunctions starts it registers the total available memory in your system in order to know during its runtime if the system has the required amount of free memory to run each function. +Every function starts the runner reduces the amount of memory used by that function from the available memory register. +When the function finishes the runner returns the used memory to the available memory register. + +By default the required memory of a function is *128 mb*. + +## Defining function's required memory + +You can define the function's required memory in the route creation or updating it. + +### Creating function memory + +``` +curl -H "Content-Type: application/json" -X POST -d '{ + "route": { + "path":"", + "image":"", + "memory": + } +}' http://localhost:8080/v1/apps//routes +``` + +Eg. Creating `/myapp/hello` with required memory as `100mb` + +``` +curl -H "Content-Type: application/json" -X POST -d '{ + "route": { + "path":"/hello", + "image":"iron/hello", + "memory": 100 + } +}' http://localhost:8080/v1/apps/myapp/routes +``` + +### Updating function memory + +``` +curl -H "Content-Type: application/json" -X POST -d '{ + "route": { + "memory": + } +}' http://localhost:8080/v1/apps//routes/ +``` + +Eg. Updating `/myapp/hello` required memory as `100mb` + +``` +curl -H "Content-Type: application/json" -X POST -d '{ + "route": { + "memory": 100 + } +}' http://localhost:8080/v1/apps/myapp/routes/hello +``` \ No newline at end of file