Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Sv translation
languageen
Remarque

This page is no longer being updated. From BlueMind 4.8, please refer to the new BlueMind documentation

Introduction

Default memory allocation for Java components is readjusted automatically when BlueMind starts-up.

Volet

On this page:

Sommaire
maxLevel2

Related:


How memory allocation works

A program "/usr/share/bm-pimp/bm-pimp" runs before the "init bluemind" scripts and reconfigures the components.

On start-up, this program displays the following outputs:

Bloc de code
root@prec:~/bm-pimp# ./bm-pimp
newrelic support is not enabled
2014-06-12 20:16:42,789 [main] n.b.p.PimpMyRam INFO - 2176MB is allocated for all heaps.
2014-06-12 20:16:42,791 [main] n.b.p.PimpMyRam INFO - 93% of spare memory will be allocated to java components
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO - Total from JMX: 8181MB
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO - 3063MB will be distributed between JVMs
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO -   * bm-core gets +459MB for a total of 715MB
2014-06-12 20:16:42,831 [main] n.b.p.PimpMyRam INFO -   * bm-node gets +0MB for a total of 128MB
2014-06-12 20:16:42,832 [main] n.b.p.PimpMyRam INFO -   * bm-eas gets +306MB for a total of 434MB
2014-06-12 20:16:42,832 [main] n.b.p.PimpMyRam INFO -   * bm-elasticsearch gets +1225MB for a total of 1353MB
2014-06-12 20:16:42,833 [main] n.b.p.PimpMyRam INFO -   * bm-mq gets +153MB for a total of 281MB
2014-06-12 20:16:42,833 [main] n.b.p.PimpMyRam INFO -   * bm-tika gets +0MB for a total of 128MB
2014-06-12 20:16:42,833 [main] n.b.p.PimpMyRam INFO -   * bm-xmpp gets +0MB for a total of 128MB
2014-06-12 20:16:42,834 [main] n.b.p.PimpMyRam INFO -   * ysnp gets +0MB for a total of 128MB
2014-06-12 20:16:42,834 [main] n.b.p.PimpMyRam INFO -   * bm-lmtpd gets +153MB for a total of 409MB
2014-06-12 20:16:42,834 [main] n.b.p.PimpMyRam INFO -   * bm-milter gets +153MB for a total of 409MB
2014-06-12 20:16:42,835 [main] n.b.p.PimpMyRam INFO -   * bm-dav gets +0MB for a total of 128MB
2014-06-12 20:16:42,835 [main] n.b.p.PimpMyRam INFO -   * bm-locator gets +0MB for a total of 128MB
2014-06-12 20:16:42,835 [main] n.b.p.PimpMyRam INFO -   * bm-hps gets +153MB for a total of 281MB

Spare memory is calculated as follows:

Usable memory is calculated by subtracting 4Gb to total machine memory.

60% of the resulting usable memory is then distributed between Java components. This portion is called spare memory.

Info

From BlueMind version 3.0.10, usable memory is calculated by subtracting 5Gb to total machine memory.

Spare memory is then 50% of usable memory.

In the previous example, (based on version 3.0.9) spare memory is then 3063Mb:

Bloc de code
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO - 3063MB will be distributed between JVMs


Redistribution is done in a rules files "rules.json". Default rules contained in the "rules.json" file can be overloaded by the administrator.

Configuration

To customize memory allocation rules on BlueMind start-up, you need to create a file "/etc/bm/local/rules.json" in which you specify product-specific rules.

Example of a "rules.json" file:

Bloc de code
[
	{
		"product":"bm-core",
		"defaultHeap":256,
		"defaultDirect":256,
		"sparePercent":15
	},
	{
		"product":"bm-node",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":0
	},
	{
		"product":"bm-eas",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":10
	},
	{
		"product":"bm-mapi",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":8
	},
	{
		"product":"bm-elasticsearch",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":40
	}
]

In this example:

  • bm-core gets 256Mb + 15% of spare memory, i.e. 459Mb:

    Bloc de code
    2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO -   * bm-core gets +459MB for a total of 715MB
  • bm-node will not be increased and will always get 128Mb, regardless of available memory.

  • elasticsearch gets 128 + 40% of spare memory.

At the end of execution, bm-pimp writes a file "/etc/bm/default/<produit>.ini" with the new value for each product.

This file's content can be overloaded locally via the file "/etc/bm/local/<produit>.ini".

Logs

Logback configuration for each component is automatically extracted and saved in the file "/etc/bm/default/<composant>.log.xml" on component start-up.

This configuration can be overloaded (e.g. to be sent to a logstash / graylog2) by modifying a copy of this file in the folder "/etc/bm/local/<composant>.log.xml".

Sv translation
languagede
Remarque

Diese Seite ist nicht mehr aktuell. Ab der Version BlueMind 4.8 finden Sie alle Infos in der neuen Dokumentation

Präsentation

Der Standardspeicher der Java-Komponenten wird beim Start von BlueMind automatisch angepasst.

Volet

Auf dieser Seite:

Sommaire
maxLevel2

Verwandt:

Funktionsweise

Ein Programm /usr/share/bm-pimp/bm-pimp wird vor den bluemind-Init-Skripten gestartet und parametriert die Komponenten.

Wenn es gestartet wird, zeigt es die folgenden Ausgaben an:

Bloc de code
root@prec:~# /etc/init.d/bm-pimp restart
2014-06-12 20:16:42,789 [main] n.b.p.PimpMyRam INFO - 2176MB is allocated for all heaps.
2014-06-12 20:16:42,791 [main] n.b.p.PimpMyRam INFO - 93% of spare memory will be allocated to java components
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO - Total from JMX: 8181MB
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO - 3063MB will be distributed between JVMs
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO -   * bm-core gets +459MB for a total of 715MB
2014-06-12 20:16:42,831 [main] n.b.p.PimpMyRam INFO -   * bm-node gets +0MB for a total of 128MB
2014-06-12 20:16:42,832 [main] n.b.p.PimpMyRam INFO -   * bm-eas gets +306MB for a total of 434MB
2014-06-12 20:16:42,832 [main] n.b.p.PimpMyRam INFO -   * bm-mapi gets +245MB for a total of 373MB
2014-06-12 20:16:42,832 [main] n.b.p.PimpMyRam INFO -   * bm-elasticsearch gets +1225MB for a total of 1353MB
2014-06-12 20:16:42,833 [main] n.b.p.PimpMyRam INFO -   * bm-mq gets +153MB for a total of 281MB
2014-06-12 20:16:42,833 [main] n.b.p.PimpMyRam INFO -   * bm-tika gets +0MB for a total of 128MB
2014-06-12 20:16:42,833 [main] n.b.p.PimpMyRam INFO -   * bm-xmpp gets +0MB for a total of 128MB
2014-06-12 20:16:42,834 [main] n.b.p.PimpMyRam INFO -   * bm-ysnp gets +0MB for a total of 128MB
2014-06-12 20:16:42,834 [main] n.b.p.PimpMyRam INFO -   * bm-lmtpd gets +153MB for a total of 409MB
2014-06-12 20:16:42,834 [main] n.b.p.PimpMyRam INFO -   * bm-milter gets +153MB for a total of 409MB
2014-06-12 20:16:42,835 [main] n.b.p.PimpMyRam INFO -   * bm-dav gets +0MB for a total of 128MB
2014-06-12 20:16:42,835 [main] n.b.p.PimpMyRam INFO -   * bm-locator gets +0MB for a total of 128MB
2014-06-12 20:16:42,835 [main] n.b.p.PimpMyRam INFO -   * bm-hps gets +153MB for a total of 281MB

Die Berechnung ist wie folgt:

Der nutzbare Speicher wird berechnet, indem 5 GB vom Gesamtspeicher des Rechners abgezogen werden.

50 % dieses nutzbaren Speichers werden dann auf die verschiedenen Java-Komponenten verteilt. Dieser Teil wird als sparebezeichnet.

In unserem vorherigen Beispiel beträgt spare 3063 MB:

Bloc de code
2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO - 3063MB will be distributed between JVMs


Die Weiterverteilung erfolgt über die Regeldatei rules.json. Die in der Datei rules.json enthaltenen Regeln können vom Administrator überladen werden.

Parametrierung

Um die Regeln für die Speicherzuweisung beim Start von BlueMind anzupassen, erstellen Sie eine Datei /etc/bm/local/rules.json , in die Sie die Regeln schreiben, die vom Produkt angewendet werden sollen.

Beispiel für die Datei rules.json:

Bloc de code
[
	{
		"product":"bm-core",
		"defaultHeap":256,
		"defaultDirect":256,
		"sparePercent":15
	},
	{
		"product":"bm-node",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":0
	},
	{
		"product":"bm-eas",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":10
	},
	{
		"product":"bm-mapi",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":8
	},
	{
		"product":"bm-elasticsearch",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":40
	}
]

In diesem Beispiel:

  • bm-core erhält 256 MB + 15 % von spare, d.h. 459 MB:

    Bloc de code
    2014-06-12 20:16:42,792 [main] n.b.p.PimpMyRam INFO -   * bm-core gets +459MB for a total of 715MB
  • bm-node wird nicht erhöht und beträgt immer 128 MB, unabhängig vom verfügbaren Speicher.

  • elasticsearch erhält 128 + 40 % von spare.

Am Ende seiner Ausführung schreibt bm-pimp für jedes Produkt eine /etc/bm/default/<product>.ini Datei mit dem neuen Wert.

Der Inhalt dieser Datei kann lokal über eine /etc/bm/local/<product>.iniüberladen werden.

Protokolle

Die Logback-Konfiguration für jede Komponente wird extrahiert und beim Start der Komponente automatisch in der Datei /usr/share/bm-conf/logs/<composant>.log.xml gespeichert.

Diese Konfiguration kann überschrieben werden (um sie z. B. an eine Logstash / graylog2 zu senden), indem eine Kopie dieser Datei im Ordner /etc/bm/local/<component>.log.xml geändert wird