Skip to content

Commit

Permalink
Merge pull request #6822 from tylersmalley/default-node-arguments
Browse files Browse the repository at this point in the history
Limit memory overhead
  • Loading branch information
epixa committed Apr 27, 2016
2 parents 322fa9b + e8e9f58 commit 855faff
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions bin/kibana
Original file line number Diff line number Diff line change
Expand Up @@ -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" ${@}
4 changes: 3 additions & 1 deletion bin/kibana.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions docs/production.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* <<enabling-ssl, Enabling SSL>>
* <<controlling-access, Controlling Access>>
* <<load-balancing, Load Balancing Across Multiple Elasticsearch Nodes>>
* <<memory-management, Memory management>>

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
Expand Down Expand Up @@ -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`.
1 change: 1 addition & 0 deletions docs/setup.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 14 additions & 5 deletions tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -46,7 +51,8 @@ module.exports = function (grunt) {
wait: false,
ready: /Server running/,
quiet: false,
failOnError: false
failOnError: false,
env: devEnv
},
cmd: binScript,
args: [
Expand All @@ -64,7 +70,8 @@ module.exports = function (grunt) {
wait: false,
ready: /Server running/,
quiet: false,
failOnError: false
failOnError: false,
env: devEnv
},
cmd: binScript,
args: [
Expand All @@ -80,7 +87,8 @@ module.exports = function (grunt) {
wait: false,
ready: /Server running/,
quiet: false,
failOnError: false
failOnError: false,
env: devEnv
},
cmd: binScript,
args: [
Expand Down Expand Up @@ -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: [
Expand Down

0 comments on commit 855faff

Please sign in to comment.