#performance
18 Einzeiler mit diesem Stichwort.
Alle Einzeiler mit Tag performance
Abgelaufene Transients aus der Datenbank löschen
$wp transient delete --expired --path=/var/www/vhosts/example.com/httpdocs
Boot-Zeit analysieren und langsame Dienste finden
$systemd-analyze && systemd-analyze blame --no-pager | head -20
Browser-Caching-Header einer Datei prüfen
$curl -sI https://example.com/wp-includes/css/dist/block-library/style.min.css | grep -iE "^(cache-control|expires|etag|last-modified|age):"
Die 20 größten Tabellen des Servers finden
#mysql -e 'SELECT table_schema, table_name, ROUND((data_length + index_length) / 1024 / 1024, 1) AS mb, table_rows FROM information_schema.tables ORDER BY data_length + index_length DESC LIMIT 20;'
Größte automatisch geladene Optionen in WordPress finden
$wp option list --autoload=on --orderby=size_bytes --order=desc --fields=option_name,size_bytes --path=/var/www/vhosts/example.com/httpdocs | head -n 20
HTML- und Headergröße einer Seite messen
$curl -s -o /dev/null -w 'Status: %{http_code} Header: %{size_header} Bytes HTML: %{size_download} Bytes\n' https://example.com/
Ladezeit einer URL in Phasen aufschlüsseln
$curl -o /dev/null -sS -w 'DNS: %{time_namelookup}s Connect: %{time_connect}s TLS: %{time_appconnect}s TTFB: %{time_starttransfer}s Gesamt: %{time_total}s\n' https://example.com/
Langsame Redis-Befehle anzeigen (SLOWLOG)
$redis-cli SLOWLOG GET 10
Laufende MySQL-Abfragen ohne Leerlauf anzeigen
#mysql -e "SELECT id, user, db, time, state, LEFT(info, 100) AS query FROM information_schema.processlist WHERE command <> 'Sleep' ORDER BY time DESC;"
Maximale Verbindungen und bisherige Spitze vergleichen
#mysql -e "SHOW GLOBAL STATUS LIKE 'Max_used_connections'; SHOW GLOBAL VARIABLES LIKE 'max_connections';"
OPcache-Einstellungen von PHP prüfen
$php -i | grep -E '^opcache\.(enable|enable_cli|memory_consumption|max_accelerated_files|validate_timestamps|revalidate_freq) '
Prüfen, ob eine Website gzip oder Brotli ausliefert
$curl -s -o /dev/null -D - -H "Accept-Encoding: br, gzip" https://example.com/ | grep -i "^content-encoding"
Prüfen, ob eine Website HTTP/2 unterstützt
$curl -sI --http2 https://example.com/ | head -1
Prüfen, ob LiteSpeed Cache eine Seite aus dem Cache liefert
$curl -s -o /dev/null -D - https://example.com/ | grep -iE "^(server|x-litespeed-cache[a-z-]*):"
Slow-Query-Log zur Laufzeit aktivieren
#mysql -e 'SET GLOBAL slow_query_log = 1; SET GLOBAL long_query_time = 2; SHOW VARIABLES LIKE "slow_query_log_file";'
SSH-Verbindungen mit ControlMaster wiederverwenden
$ssh -o ControlMaster=auto -o ControlPath=~/.ssh/cm-%C -o ControlPersist=10m webuser@server.example.com
Trefferquote des Redis-Caches anzeigen
$redis-cli INFO stats | grep -E '^(keyspace_hits|keyspace_misses|evicted_keys|expired_keys):'
WordPress-Datenbank optimieren
$wp db optimize --path=/var/www/vhosts/example.com/httpdocs