From 0865c55e7d0258f139329470481477ab83bfa3d3 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Fri, 8 Apr 2016 10:09:20 -0700 Subject: [PATCH 1/2] Limits memory usage V8 will not trigger a full mark-sweep & mark-compact until there is memory pressure for the max-old-space-size, which is 1.6GB on a 64bit system. This means that Kibana will, at times, consume over 1.6GB of RSS memory. Bypassing this can be done by starting with `--dev` or explicitally setting `max-old-space-size`. For example: `NODE_OPTIONS="--max-old-space-size=1024" ./bin/kibana` Signed-off-by: Tyler Smalley --- bin/kibana | 5 +++++ bin/kibana.bat | 4 +++- tasks/config/run.js | 19 ++++++++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/bin/kibana b/bin/kibana index 1606ad2813025..bacfc0c8a986f 100755 --- a/bin/kibana +++ b/bin/kibana @@ -21,4 +21,9 @@ if [ ! -x "$NODE" ]; then exit 1 fi +# sets V8 defaults while still allowing them to be overridden +if echo "${@}" | grep -qv "\-\-dev"; then + NODE_OPTIONS="--max-old-space-size=256 $NODE_OPTIONS" +fi + exec "${NODE}" $NODE_OPTIONS "${DIR}/src/cli" ${@} diff --git a/bin/kibana.bat b/bin/kibana.bat index 2c39d080bf0ad..145a7e08a78c1 100644 --- a/bin/kibana.bat +++ b/bin/kibana.bat @@ -21,8 +21,10 @@ If Not Exist "%NODE%" ( ) ) +echo.%* | findstr /V /C:"--dev" && set NODE_OPTIONS=--max-old-space-size=256 %NODE_OPTIONS% + TITLE Kibana Server -"%NODE%" %NODE_OPTIONS% "%DIR%\src\cli" %* +call "%NODE%" %NODE_OPTIONS% "%DIR%\src\cli" %* :finally diff --git a/tasks/config/run.js b/tasks/config/run.js index e98bfe894e725..db0ee386595b3 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -25,13 +25,18 @@ module.exports = function (grunt) { return flags; }, []); + const devEnv = Object.assign(process.env, { + NODE_OPTIONS: '--max-old-space-size=1024' + }); + return { testServer: { options: { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -46,7 +51,8 @@ module.exports = function (grunt) { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -64,7 +70,8 @@ module.exports = function (grunt) { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -80,7 +87,8 @@ module.exports = function (grunt) { wait: false, ready: /Server running/, quiet: false, - failOnError: false + failOnError: false, + env: devEnv }, cmd: binScript, args: [ @@ -148,7 +156,8 @@ module.exports = function (grunt) { options: { wait: false, ready: /Optimization .+ complete/, - quiet: true + quiet: false, + env: devEnv }, cmd: './build/kibana/bin/kibana', args: [ From e8e9f589a26b0e3a1d5770d878d0fb71812cbea2 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Fri, 8 Apr 2016 10:12:08 -0700 Subject: [PATCH 2/2] Adds documentation for memory requirements Signed-off-by: Tyler Smalley --- README.md | 2 +- docs/production.asciidoc | 8 ++++++++ docs/setup.asciidoc | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a6fd89da74c2..593477e7f1ea1 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Kibana is an open source ([Apache Licensed](https://github.com/elastic/kibana/bl - Elasticsearch master - Kibana binary package +- 512 MB of available RAM ## Installation @@ -14,7 +15,6 @@ Kibana is an open source ([Apache Licensed](https://github.com/elastic/kibana/bl * Run `bin/kibana` on unix, or `bin\kibana.bat` on Windows. * Visit [http://localhost:5601](http://localhost:5601) - ## Upgrade from previous version * Move any custom configurations in your old kibana.yml to your new one diff --git a/docs/production.asciidoc b/docs/production.asciidoc index f911770e236c6..bf238d6147925 100644 --- a/docs/production.asciidoc +++ b/docs/production.asciidoc @@ -4,6 +4,7 @@ * <> * <> * <> +* <> How you deploy Kibana largely depends on your use case. If you are the only user, you can run Kibana on your local machine and configure it to point to whatever @@ -132,3 +133,10 @@ cluster.name: "my_cluster" # The Elasticsearch instance to use for all your queries. elasticsearch_url: "http://localhost:9200" -------- + +[float] +[[memory-management]] + +=== Memory management + +Kibana is built on Node.js which doesn't tune its heap size based on the amount of memory available. To combat this, we set defaults based on the requirements of Kibana needs, while allowing overhead for additional plugins. These defaults can be overridden at runtime, for example `NODE_OPTIONS="--max-old-space-size=512" bin/kibana`. diff --git a/docs/setup.asciidoc b/docs/setup.asciidoc index 74b87345bfb21..7ecc11f3f41c3 100644 --- a/docs/setup.asciidoc +++ b/docs/setup.asciidoc @@ -5,6 +5,7 @@ All you need is: * Elasticsearch {esversion} * A modern web browser - http://www.elastic.co/subscriptions/matrix#matrix_browsers[Supported Browsers]. +* 512 MB of available RAM * Information about your Elasticsearch installation: ** URL of the Elasticsearch instance you want to connect to. ** Which Elasticsearch indices you want to search.