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.
Commentaire: Published by Scroll Versions from space DA and version BM-3.5
Sv translation
languagefr

Présentation

À partir de BlueMind 3.0.8, la mémoire par défaut des composants java est réajustée automatiquement lors du démarrage de BlueMind.

Volet

Sur cette page :

Sommaire
maxLevel2

En rapport :

Fonctionnement

Un programme /usr/share/bm-pimp/bm-pimp est lancé avant les scripts d'init bluemind et viens reparamétrer les composants.

Lors de son lancement, il affiche les sorties suivantes :

Bloc de code
root@prec:~# /etc/init.d/bm-pimp restart
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-ips 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 -   * 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

Le calcul effectué est le suivant :

La mémoire utilisable est calculée en retirant 4Go à la mémoire totale de la machine.

60% de cette mémoire utilisable est alors distribuée entre les différents composants Java. Cette portion est appelé le spare.

Info

À partir de la version 3.0.10, la mémoire utilisable est calculée en retirant 5Go à la mémoire totale de la machine.

Le spare est ensuite de 50% de la mémoire utilisable.

Dans notre exemple précédent (basé sur une version 3.0.9) le spare est donc de 3063Mo :

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


La redistribution se fait à partir d'un fichier de règles, rules.json. Les règles que contient le fichier rules.json par défaut peuvent être surchargées par l'administrateur.

Paramétrage

Afin de personnaliser les règles d'attribution de la mémoire a démarrage de BlueMind, créer un fichier /etc/bm/local/rules.json afin d'y inscrire les règles à appliquer par produit.

Exemple de fichier 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-ips",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":8
	},
	{
		"product":"bm-elasticsearch",
		"defaultHeap":128,
		"defaultDirect":128,
		"sparePercent":40
	}
]

Dans cet exemple :

  • bm-core va ici obtenir 256Mo + 15% du spare, soit 459Mo :

    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 ne sera pas augmenté et aura toujours 128Mo, quelle que soit la mémoire disponible.

  • elasticsearch obtiendra 128 + 40% du spare.

A la fin de son exécution, bm-pimp écrit pour chaque produit un fichier /etc/bm/default/<produit>.ini avec la nouvelle valeur.

Le contenu de ce fichier peut être surchargé localement via un /etc/bm/local/<produit>.ini.

Logs

La configuration de logback pour chaque composant est extraite et enregistrée automatiquement dans le fichier /etc/bm-conf/logs/<composant>.log.xml au démarrage des composants.

Cette configuration peut être surchargée (pour les envoyer vers un logstash / graylog2 par exemple) en modifiant une copie de ce fichier dans le dossier /etc/bm/local/<composant>.log.xml

Sv translation
languageen

Introduction

With BlueMind v.3.0.8 and above, 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-ips 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 -   * 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-ips",
		"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".