#performance
18 one-liners with this tag.
All one-liners tagged performance
Analyze boot time and find slow services
$systemd-analyze && systemd-analyze blame --no-pager | head -20
Check if LiteSpeed Cache serves a page from cache
$curl -s -o /dev/null -D - https://example.com/ | grep -iE "^(server|x-litespeed-cache[a-z-]*):"
Check PHP OPcache settings
$php -i | grep -E '^opcache\.(enable|enable_cli|memory_consumption|max_accelerated_files|validate_timestamps|revalidate_freq) '
Check the browser caching headers of a file
$curl -sI https://example.com/wp-includes/css/dist/block-library/style.min.css | grep -iE "^(cache-control|expires|etag|last-modified|age):"
Check whether a website serves gzip or Brotli
$curl -s -o /dev/null -D - -H "Accept-Encoding: br, gzip" https://example.com/ | grep -i "^content-encoding"
Check whether a website supports HTTP/2
$curl -sI --http2 https://example.com/ | head -1
Compare max connections with the peak so far
#mysql -e "SHOW GLOBAL STATUS LIKE 'Max_used_connections'; SHOW GLOBAL VARIABLES LIKE 'max_connections';"
Delete expired transients from the WordPress database
$wp transient delete --expired --path=/var/www/vhosts/example.com/httpdocs
Enable the slow query log at runtime
#mysql -e 'SET GLOBAL slow_query_log = 1; SET GLOBAL long_query_time = 2; SHOW VARIABLES LIKE "slow_query_log_file";'
Find the 20 largest tables on the server
#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;'
Find the largest autoloaded options in WordPress
$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
Measure HTTP load times and TTFB with curl
$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/
Measure the HTML and header size of a page
$curl -s -o /dev/null -w 'Status: %{http_code} Header: %{size_header} Bytes HTML: %{size_download} Bytes\n' https://example.com/
Optimize the WordPress database
$wp db optimize --path=/var/www/vhosts/example.com/httpdocs
Reuse SSH connections with ControlMaster
$ssh -o ControlMaster=auto -o ControlPath=~/.ssh/cm-%C -o ControlPersist=10m webuser@server.example.com
Show running MySQL queries without idle connections
#mysql -e "SELECT id, user, db, time, state, LEFT(info, 100) AS query FROM information_schema.processlist WHERE command <> 'Sleep' ORDER BY time DESC;"
Show slow Redis commands (SLOWLOG)
$redis-cli SLOWLOG GET 10
Show the Redis cache hit rate
$redis-cli INFO stats | grep -E '^(keyspace_hits|keyspace_misses|evicted_keys|expired_keys):'