MediaWikiFarm static analysis

De Wiki Seb35
Aller à la navigation Aller à la recherche

(explanation below - explications ci-dessous)

Time ↧

Monoversion / Multiversion
No cache / Empty / Loaded
With / Without deployment file
Web / CLI / update
(All) - As of 1b15172

Properties Files
farmDir configDir codeDir cacheDir params farmConfig variables configuration farms.yml variable.yml config.yml versions.yml deployments.php (cache) versions.php (cache) config.php (cache) LocalSettings.php main.php
'EntryPoint' 'ExtensionRegistry' 'variables' 'coreconfig' 'config' Other '$CODE' '$VERSION' Other 'settings' / 'arrays' 'extensions' / 'skins' 'execFiles'
Existence load - - - - - - - - - - - - - - - - - - - - - - - - -
__construct set set set set set set set- read- set set- read- read- set - - - - - - - - read - - -
| ↳ selectFarm - read- - - - - - set- - - - - - - - - read- - - - - - - - -
checkExistence - - - read- - - - read- read- - read read- read- - - - - - - - - set- - - -
| ↳ checkHostVariables - read- read- - - - read- set- - - - set- read- - - - - read- - - - - - - -
| ↳ setVersion - read- read- - read- - - set-- - - set- set- read- - - - - - - read-- read-- - - - -
| ↳ setOtherVariables - - - - - - - - - - - - - - - - - - - - - - - - -
getConfigFile read- - - read- - - - - - - - read- - - - - - - - - - - - - -
setVariable - - - - - - - - - read- - - set- - - - - - - - - - - - -
updateVersionAfterMaintenance - - - - - - - - - - - read - - - - - - - - - - - - -
updateVersion - read-- - - - - - - - - - - read- - - - - - - - set-- - - - -
Configuration loadMediaWikiConfig read- - read- - - read- - - - - - - - read- read- read- - - - - - - - - -
getMediaWikiConfig - - - read- - - - - - - - read- - read- read- read- - - - - - - set- set- -
  ↳ populateSettings - read- - - - - - - read- - - - read- set- set- set- - - read- - - - - - -
  ↳ extractSkinsAndExtensions - - - - - set- - - - - - - - set- set- - - - - - - - - - -
  |  ↳ detectLoadingMechanism - - - - - read- - - - - read- - - - - - - - - - - - - - -
  ↳ createLocalSettings read- - read- - - - - - - - - - - - - - - - - - - - - - -
Utility isLocalSettingsFresh - read - read- - - - - read- - - read- - - - - - - - - - - - - -
replaceVariable - - - - - - - - - - read read read - - - - - - - - - - - -
readFile - - - read - - - - - - - - - - - - - - - - - - - - -
cacheFile - - - read- - - - - - - - - - - - - - - - - - - - - -
(MediaWiki) - - - - - - - - - - - - - - - - - - - - - - - read- read-

Explanations (English)

This is a hand-made matrix describing what function read or modify what internal data for the software MediaWikiFarm, a MediaWiki "extension" to manage MediaWiki farms of wikis.

This represents the class MediaWikiFarm, which is the main class containing almost all logic. Each row is a method (roughly sorted by chronological order in a typical run) and each column is a class property (all are protected). In each cell, there is either:

  • read: the property is (only) read in the method;
  • set: the property is set in the method (and possibly read);
  • -: the property is neither read or set in the method.

In my previous games works on static analysis of this software, I created the call graph with an external software. But, to be more exact, this call graph is only an overapproximation since the exact (dynamic) call graph is a subset of this one: in a run, possibly some paths are not executed since it depends on the context.

Here, this is the "data graph", and there are different contexts: on the top left, you can choose the various main contexts in which the software can run. This depends mainly from the environment and the configuration, and the possibilities listed here are only the main ones.

The main result coming from this representation is: "the cache drastically reduces the processing". In fact this is not a surprise, it was designed for it, but such a sparse matrix is encouraging and help to visualise the inter-relations. When benchmarking the software, a no-cache run takes 10-15 milliseconds, and a with-cache run takes 85 microseconds (roughly 130 times less).

Explications (français)

Ceci est une matrice créée à la main qui décrit quels fonctions lisent ou modifient quelles données internes pour le logiciel MediaWikiFarm, une "extension" MediaWiki pour gérer des fermes de wikis.

Ceci représente la classe MediaWikiFarm qui se trouve être la classe principale contenant presque toute la logique. Chaque ligne est une méthode (grossièrement ordonnées par ordre chronologique lors d’une exécution classique) et chaque colonne est une des propriétés de la classe (toutes sont protégées). Dans chaque cellule, il y a soit :

  • read : la propriété est (seulement) lue par la méthode ;
  • set : la propriété est modifiée par la méthode (et possiblement lue) ;
  • - : la propriété n’est ni lue ni modifiée par la méthode.

Dans mes précédents jeux travaux sur l’analyse statique de ce logiciel, j’avais créé le graphe d’appels à l’aide d’un programme externe. Mais, pour être exact, ce graphe d’appels n’est qu’une sur-estimation puisque le graphe d’appels (dynamique) est un sous-ensemble de celui-ci : lors d’une exécution, certains chemins peuvent ne pas être exécutés en fonction du contexte.

Ici, nous avons le "graphe des données" et il y a différents contextes : en haut à gauche, vous pouvez choisir les différents contextes principaux dans lesquels le programme peut s’exécuter. Cela dépend principalement de l’environnement et de la configuration, et les possibilités listées ici ne sont que les principales.

Le principal résultat obtenu grâce à cette représentation est : « le cache diminue drastiquement le traitement ». En fait, cela n’est pas une surprise, le programme a été conçu dans ce but, mais une telle matrice creuse est encourageante et aide à visualiser les inter-relations. Lors de tests de performance, une exécution sans cache prend 10-15 millisecondes, et une exécution avec cache prend 85 microsecondes (environ 130 fois moins).