Zum Inhalt springen

MediaWiki/Performance

Aus Foxwiki

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

Projekt


  • 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).

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]