MediaWiki/Performance: Unterschied zwischen den Versionen
K Dirkwagner verschob die Seite MediaWiki:Performance nach MediaWiki/Performance, ohne dabei eine Weiterleitung anzulegen |
Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
'''MediaWiki/Performance''' | |||
== Beschreibung == | |||
== Installation == | |||
<syntaxhighlight lang="bash" highlight="1" line copy> | |||
</syntaxhighlight> | |||
== Aufruf == | |||
<syntaxhighlight lang="bash" highlight="1" line copy> | |||
</syntaxhighlight> | |||
=== Optionen === | |||
{| class="wikitable sortable options gnu big" | |||
|- | |||
! Unix !! GNU !! Parameter !! Beschreibung | |||
|- | |||
| || || || | |||
|- | |||
|} | |||
=== Parameter === | |||
=== Umgebungsvariablen === | |||
=== Exit-Status === | |||
{| class="wikitable options col1center big" | |||
|- | |||
! Wert !! Beschreibung | |||
|- | |||
| 0 || Erfolg | |||
|- | |||
| >0 || Fehler | |||
|} | |||
== Anwendung == | |||
<syntaxhighlight lang="bash" highlight="1" line copy> | |||
</syntaxhighlight> | |||
<!-- output --> | |||
<syntaxhighlight lang="bash" highlight="" line> | |||
</syntaxhighlight> | |||
=== Problembehebung === | |||
== Konfiguration == | |||
=== Dateien === | |||
{| class="wikitable options big" | |||
|- | |||
! Datei !! Beschreibung | |||
|- | |||
| || | |||
|- | |||
| || | |||
|} | |||
<noinclude> | |||
== Anhang == | |||
=== Siehe auch === | |||
<div style="column-count:2"> | |||
<categorytree hideroot=on mode="pages">{{BASEPAGENAME}}</categorytree> | |||
</div> | |||
---- | |||
{{Special:PrefixIndex/{{BASEPAGENAME}}/}} | |||
=== Dokumentation === | |||
<!-- | |||
; Man-Page | |||
# [https://manpages.debian.org/stable/procps/pgrep.1.de.html prep(1)] | |||
; Info-Pages | |||
--> | |||
=== Links === | |||
==== Projekt ==== | |||
==== Weblinks ==== | |||
<!-- | |||
{{DEFAULTSORT:new}} | |||
{{DISPLAYTITLE:new}} | |||
--> | |||
[[Kategorie:MediaWiki/Verwaltung]] | |||
* Stellen Sie sicher, dass Ihrem Webserver und PHP genügend Arbeitsspeicher zugewiesen ist. | * Stellen Sie sicher, dass Ihrem Webserver und PHP genügend Arbeitsspeicher zugewiesen ist. | ||
* Es gibt eine Vielzahl von Caching-Tools | * Es gibt eine Vielzahl von Caching-Tools | ||
| Zeile 7: | Zeile 91: | ||
* Die Verwendung von Nginx oder Lighttpd als Webserver anstelle von Apache kann die Leistung für stark frequentierte Websites erheblich verbessern. | * Die Verwendung von Nginx oder Lighttpd als Webserver anstelle von Apache kann die Leistung für stark frequentierte Websites erheblich verbessern. | ||
To reduce MediaWiki CPU load, offload server processing by enabling robust '''PHP OPcache''', installing '''APCu/Memcached''' object caching, and blocking resource-intensive bot crawlers. These changes prevent your server from constantly re-rendering pages and recompiling scripts on every visit. [[https://www.mediawiki.org/wiki/Manual:Varnish_caching<nowiki> 1], </nowiki>[[mediawikiwiki:Manual:Performance_tuning|2]], [https://serverfault.com/questions/397482/need-help-trouble-shooting-high-cpu-usage-by-php-fpm 3]] | |||
1. Enable PHP Caching (Essential) | |||
PHP natively recompiles code on every page request. Caching these scripts drastically reduces CPU usage. [[https://www.mediawiki.org/wiki/Manual:Varnish_caching<nowiki> 1], [</nowiki>https://www.mediawiki.org/wiki/Manual:Performance_tuning 2]]* '''OPcache:''' Ensure OPcache is enabled in your <code>php.ini</code> file. Set <code>opcache.enable=1</code> and allocate adequate memory (e.g., <code>opcache.memory_consumption=128</code>). | |||
* '''APCu:''' Install the APCu PHP extension for fast, local object caching. [[https://www.mediawiki.org/wiki/Manual:Performance_tuning/ca<nowiki> 1], </nowiki>[https://wiki.centos-webpanel.com/improve-website-performance 2], [https://www.mediawiki.org/wiki/Manual:Varnish_caching 3]] | |||
2. Configure MediaWiki Object & Main Cache | |||
[[ | Stop MediaWiki from repeatedly hitting the database for frequently accessed data. [[https://hexshift.medium.com/step-by-step-guide-to-optimizing-mediawiki-performance-with-caching-and-profiling-391b5203d166 1]]* Open your <code>LocalSettings.php</code> file and add: | ||
php | |||
$wgMainCacheType = CACHE_ACCEL; | |||
$wgParserCacheType = CACHE_ACCEL; | |||
$wgSessionCacheType = CACHE_ACCEL; | |||
Verwende Code mit Vorsicht. | |||
[[https://www.mediawiki.org/wiki/Manual:$wgMainCacheType<nowiki> 1], </nowiki>[https://hexshift.medium.com/step-by-step-guide-to-optimizing-mediawiki-performance-with-caching-and-profiling-391b5203d166 2], [https://lists.wikimedia.org/hyperkitty/list/mediawiki-l@lists.wikimedia.org/thread/S7YWAMM6BHTZBOK7ZPQ2ZBKRSML42OPP/ 3]] | |||
3. Optimize Bots & Crawlers | |||
Aggressive search engine bots can index dynamic pages (like <code>api.php</code> or <code>index.php?action=history</code>) and overwhelm your CPU. [[https://github.com/bitnami/charts/issues/3138<nowiki> 1], [</nowiki>https://serverfault.com/questions/397482/need-help-trouble-shooting-high-cpu-usage-by-php-fpm 2]]* Create or update a strict <code>robots.txt</code> file in your main directory to block non-canonical URLs and system pages. | |||
* Example rules: text User-agent: * Disallow: /wiki/Special: Disallow: /w/api.php Disallow: /w/index.php Verwende Code mit Vorsicht. [[https://serverfault.com/questions/397482/need-help-trouble-shooting-high-cpu-usage-by-php-fpm 1]] | |||
4. Adjust Heavy Extensions | |||
Complex extensions like '''Semantic MediaWiki (SMW)''' can add significant server overhead during page loads. [[https://hexshift.medium.com/step-by-step-guide-to-optimizing-mediawiki-performance-with-caching-and-profiling-391b5203d166 1]]* If using SMW, enable '''query caching''' to prevent re-calculating complex semantic queries every visit. Add this to <code>LocalSettings.php</code>: | |||
php | |||
$smwgEnableCache = true; | |||
Verwende Code mit Vorsicht. | |||
5. Disable Unnecessary Counters | |||
Tracking page views can spike CPU usage on busier sites. [<nowiki/>[[mediawikiwiki:Topic:Rncjbh4poqojjt9k|1]]]* If you do not need site statistics, you can disable the page counter by adding the following to <code>LocalSettings.php</code>: | |||
php | |||
$wgDisableCounters = true; | |||
Verwende Code mit Vorsicht. | |||
6. Fine-Tune PHP-FPM / FastCGI | |||
If your PHP-FPM processes are consuming excessive CPU due to heavy traffic, limit how long each process runs before being recycled to clear memory. [[https://www.mediawiki.org/wiki/Topic:U1sl12b4w1gkbh2k<nowiki> 1], [</nowiki>https://serverfault.com/questions/397482/need-help-trouble-shooting-high-cpu-usage-by-php-fpm 2]]* In your <code>php-fpm.conf</code> or pool config, configure <code>pm.max_requests</code> to refresh processes (e.g., <code>pm.max_requests = 500</code>). | |||
For a more comprehensive guide on scaling, consult the official [[mediawikiwiki:Manual:Performance_tuning|MediaWiki Performance Tuning Manual]]. [<nowiki/>[[mediawikiwiki:Manual:Performance_tuning|1]]] | |||
If you would like, tell me more about your setup:* Are you using '''Apache or Nginx'''? | |||
* What '''extensions''' (like Semantic MediaWiki) are currently active? [[https://hexshift.medium.com/step-by-step-guide-to-optimizing-mediawiki-performance-with-caching-and-profiling-391b5203d166 1]] | |||
</noinclude> | |||
Version vom 16. Juni 2026, 08:03 Uhr
MediaWiki/Performance
Beschreibung
Installation
Aufruf
Optionen
| Unix | GNU | Parameter | Beschreibung |
|---|---|---|---|
Parameter
Umgebungsvariablen
Exit-Status
| Wert | Beschreibung |
|---|---|
| 0 | Erfolg |
| >0 | Fehler |
Anwendung
Problembehebung
Konfiguration
Dateien
| Datei | Beschreibung |
|---|---|
Anhang
Siehe auch
Dokumentation
Links
Projekt
Weblinks
- Stellen Sie sicher, dass Ihrem Webserver und PHP genügend Arbeitsspeicher zugewiesen ist.
- Es gibt eine Vielzahl von Caching-Tools
- die in Verbindung mit MediaWiki (und miteinander) verwendet werden können, wie Varnish und Memcached.
Sie können alle Optionen für das Caching hier sehen:
- Die Verwendung von Nginx oder Lighttpd als Webserver anstelle von Apache kann die Leistung für stark frequentierte Websites erheblich verbessern.
To reduce MediaWiki CPU load, offload server processing by enabling robust PHP OPcache, installing APCu/Memcached object caching, and blocking resource-intensive bot crawlers. These changes prevent your server from constantly re-rendering pages and recompiling scripts on every visit. [ 1], 2, [https://serverfault.com/questions/397482/need-help-trouble-shooting-high-cpu-usage-by-php-fpm 3]
1. Enable PHP Caching (Essential)
PHP natively recompiles code on every page request. Caching these scripts drastically reduces CPU usage. [ 1], [https://www.mediawiki.org/wiki/Manual:Performance_tuning 2]* OPcache: Ensure OPcache is enabled in your php.ini file. Set opcache.enable=1 and allocate adequate memory (e.g., opcache.memory_consumption=128).
- APCu: Install the APCu PHP extension for fast, local object caching. [ 1], [https://wiki.centos-webpanel.com/improve-website-performance 2, 3]
2. Configure MediaWiki Object & Main Cache
Stop MediaWiki from repeatedly hitting the database for frequently accessed data. [1]* Open your LocalSettings.php file and add:
php
$wgMainCacheType = CACHE_ACCEL;
$wgParserCacheType = CACHE_ACCEL;
$wgSessionCacheType = CACHE_ACCEL;
Verwende Code mit Vorsicht.
[ 1], [https://hexshift.medium.com/step-by-step-guide-to-optimizing-mediawiki-performance-with-caching-and-profiling-391b5203d166 2, 3]
3. Optimize Bots & Crawlers
Aggressive search engine bots can index dynamic pages (like api.php or index.php?action=history) and overwhelm your CPU. [ 1], [https://serverfault.com/questions/397482/need-help-trouble-shooting-high-cpu-usage-by-php-fpm 2]* Create or update a strict robots.txt file in your main directory to block non-canonical URLs and system pages.
- Example rules: text User-agent: * Disallow: /wiki/Special: Disallow: /w/api.php Disallow: /w/index.php Verwende Code mit Vorsicht. [1]
4. Adjust Heavy Extensions
Complex extensions like Semantic MediaWiki (SMW) can add significant server overhead during page loads. [1]* If using SMW, enable query caching to prevent re-calculating complex semantic queries every visit. Add this to LocalSettings.php:
php
$smwgEnableCache = true;
Verwende Code mit Vorsicht.
5. Disable Unnecessary Counters
Tracking page views can spike CPU usage on busier sites. [1]* If you do not need site statistics, you can disable the page counter by adding the following to LocalSettings.php:
php
$wgDisableCounters = true;
Verwende Code mit Vorsicht.
6. Fine-Tune PHP-FPM / FastCGI
If your PHP-FPM processes are consuming excessive CPU due to heavy traffic, limit how long each process runs before being recycled to clear memory. [ 1], [https://serverfault.com/questions/397482/need-help-trouble-shooting-high-cpu-usage-by-php-fpm 2]* In your php-fpm.conf or pool config, configure pm.max_requests to refresh processes (e.g., pm.max_requests = 500).
For a more comprehensive guide on scaling, consult the official MediaWiki Performance Tuning Manual. [1]
If you would like, tell me more about your setup:* Are you using Apache or Nginx?
- What extensions (like Semantic MediaWiki) are currently active? [1]