Performance Tuning

From Server rental store
Revision as of 18:22, 15 April 2025 by Admin (talk | contribs) (Automated server configuration article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  1. Performance Tuning

This article details performance tuning strategies for a MediaWiki 1.40 installation. Optimizing your server configuration is crucial for a responsive wiki, especially as content and user base grow. We will cover database optimization, PHP settings, caching, and server-level adjustments. This guide is intended for system administrators and those with moderate technical experience.

Understanding Bottlenecks

Before making changes, it’s essential to identify where performance bottlenecks exist. Common areas include:

  • **Database:** Slow queries, insufficient indexing, and database server resource constraints.
  • **PHP:** Insufficient memory, slow code execution, and improper configuration.
  • **Caching:** Lack of effective caching mechanisms leading to repeated database queries.
  • **Web Server:** Insufficient resources (CPU, memory) or improper configuration of the web server (Apache, Nginx).

Tools like `top`, `htop`, `mysqladmin processlist`, and MediaWiki's own Statistics page can help diagnose these issues. Consider using a dedicated monitoring system for long-term performance tracking.

Database Optimization

The database is often the biggest performance bottleneck. MySQL/MariaDB are the most common choices.

Key Configuration Parameters

The following parameters in `my.cnf` (or equivalent) are crucial:

Parameter Description Recommended Value (Example)
`innodb_buffer_pool_size` Amount of memory dedicated to caching InnoDB data and indexes. 50-80% of available RAM
`query_cache_size` Size of the query cache. Consider disabling in newer MySQL versions (8.0+) as it can be a source of contention. 64M (or 0 to disable)
`innodb_log_file_size` Size of the InnoDB transaction log files. Larger sizes can improve write performance. 256M - 1G
`max_connections` Maximum number of simultaneous client connections. 150-300 (adjust based on expected concurrency)

Indexing

Proper indexing is *critical*. Ensure indexes exist for:

  • `page.page_title`
  • `page.page_namespace`
  • `revision.rev_page`
  • `revision.rev_user`
  • `category.cat_title`
  • `categorylink.cat_page`

Use `EXPLAIN` in MySQL to analyze query performance and identify missing indexes. Regularly run database vacuum and database repair tasks.

Slow Query Log

Enable the slow query log to identify problematic queries. Analyze these queries and optimize them by adding indexes, rewriting the query, or improving the database schema.

PHP Configuration

Adjusting PHP settings can significantly impact MediaWiki performance. Modify `php.ini`.

Important PHP Settings

Setting Description Recommended Value
`memory_limit` Maximum amount of memory a script can consume. 256M - 512M (or higher, depending on wiki size)
`max_execution_time` Maximum time a script can run. 30-60 seconds
`opcache.enable` Enables the OPcache extension for caching precompiled PHP code. 1 (enabled)
`opcache.memory_consumption` Amount of memory allocated to OPcache. 128M - 256M
`session.save_handler` How PHP stores session data. Consider using database or memcached. database or memcached

Ensure the PHP extensions required by MediaWiki are installed and enabled.

Caching

Caching reduces database load and improves response times.

MediaWiki Caching

  • **Parser Cache:** MediaWiki automatically caches parsed wikitext. Ensure sufficient disk space is available for this cache.
  • **Object Cache:** Use a caching system like Memcached or Redis to cache database query results. Configure `$wgMainCacheType` in `LocalSettings.php`.
  • **TransformCache:** This caches the output of expensive transform functions, such as those used in extensions.

Web Server Caching

Configure your web server (Apache or Nginx) to cache static content (images, CSS, JavaScript). Use appropriate cache headers to control caching behavior.

Server-Level Tuning

Operating System

  • **Filesystem:** Use a fast filesystem like ext4 or XFS.
  • **Kernel Parameters:** Tune kernel parameters for optimal network performance and memory management.
  • **Disk I/O:** Use fast storage (SSD) to reduce disk I/O latency.

Web Server Configuration

Web Server Setting Description
Apache `MaxRequestWorkers` Maximum number of concurrent requests. Adjust based on available memory and CPU.
Apache `KeepAlive` Enables persistent connections. On
Nginx `worker_processes` Number of worker processes. Equal to the number of CPU cores.
Nginx `worker_connections` Maximum number of connections per worker process. Adjust based on expected concurrency.

Load Balancing

For high-traffic wikis, consider using a load balancer to distribute traffic across multiple servers.

Monitoring and Maintenance

Regularly monitor your server's performance and proactively address any issues. Schedule regular maintenance tasks like database vacuuming, index optimization, and log rotation. Review Special:Version regularly to stay informed about MediaWiki updates and security patches. Finally, consult the official MediaWiki documentation for the most up-to-date information.


Intel-Based Server Configurations

Configuration Specifications Benchmark
Core i7-6700K/7700 Server 64 GB DDR4, NVMe SSD 2 x 512 GB CPU Benchmark: 8046
Core i7-8700 Server 64 GB DDR4, NVMe SSD 2x1 TB CPU Benchmark: 13124
Core i9-9900K Server 128 GB DDR4, NVMe SSD 2 x 1 TB CPU Benchmark: 49969
Core i9-13900 Server (64GB) 64 GB RAM, 2x2 TB NVMe SSD
Core i9-13900 Server (128GB) 128 GB RAM, 2x2 TB NVMe SSD
Core i5-13500 Server (64GB) 64 GB RAM, 2x500 GB NVMe SSD
Core i5-13500 Server (128GB) 128 GB RAM, 2x500 GB NVMe SSD
Core i5-13500 Workstation 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000

AMD-Based Server Configurations

Configuration Specifications Benchmark
Ryzen 5 3600 Server 64 GB RAM, 2x480 GB NVMe CPU Benchmark: 17849
Ryzen 7 7700 Server 64 GB DDR5 RAM, 2x1 TB NVMe CPU Benchmark: 35224
Ryzen 9 5950X Server 128 GB RAM, 2x4 TB NVMe CPU Benchmark: 46045
Ryzen 9 7950X Server 128 GB DDR5 ECC, 2x2 TB NVMe CPU Benchmark: 63561
EPYC 7502P Server (128GB/1TB) 128 GB RAM, 1 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (128GB/2TB) 128 GB RAM, 2 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (128GB/4TB) 128 GB RAM, 2x2 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (256GB/1TB) 256 GB RAM, 1 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (256GB/4TB) 256 GB RAM, 2x2 TB NVMe CPU Benchmark: 48021
EPYC 9454P Server 256 GB RAM, 2x2 TB NVMe

Order Your Dedicated Server

Configure and order your ideal server configuration

Need Assistance?

⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️