NewCode CLOUD — 20% off your first month on all cloud VPSClaim

WooCommerce Performance on Hong Kong VPS: Speed Optimisation Guide (2026)

· 4 min read

WooCommerce powers 28% of global e-commerce stores, but its default configuration is far from optimal — PHP runs without opcode caching, every product page hits MySQL, and sessions generate write-heavy database load. On a Hong Kong VPS serving Asia-Pacific customers, optimising WooCommerce from the stack up delivers 3–8× faster page loads and checkout flows that convert, rather than abandon. This guide covers every layer from MySQL to Nginx.


Performance Baseline First

<code"># Measure before you optimise
curl -w "TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" \
  -o /dev/null -s https://yourstore.com/shop/

# Run with Apache Bench to get requests/sec:
ab -n 100 -c 10 https://yourstore.com/

# MySQL: find slow queries (run this for 24h)
SET GLOBAL slow_query_log = ON;
SET GLOBAL long_query_time = 0.5;   # Log queries > 500ms
SET GLOBAL slow_query_log_file = '/var/log/mysql/slow.log';

Layer 1: PHP OPcache

<code"># /etc/php/8.3/fpm/conf.d/10-opcache.ini
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256      # MB — increase for large WooCommerce stores
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 20000
opcache.revalidate_freq = 0           # Never revalidate in production
opcache.validate_timestamps = 0       # Don't check file modification times
opcache.save_comments = 1
opcache.fast_shutdown = 1
opcache.jit_buffer_size = 64M
opcache.jit = on                      # PHP 8+ JIT compilation

# After changing: systemctl restart php8.3-fpm
# Verify:
php -r "var_dump(opcache_get_status()['opcache_enabled']);"
# bool(true)

Layer 2: Redis Object Cache

<code"># Install Redis and WP Redis Object Cache plugin
apt install -y redis-server
# In redis.conf: set maxmemory 256mb, maxmemory-policy allkeys-lru

# wp-config.php additions:
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DATABASE', 0);
define('WP_REDIS_TIMEOUT', 1);
define('WP_REDIS_READ_TIMEOUT', 1);

// WooCommerce: separate DB for sessions to prevent session cache invalidating product cache
define('WP_REDIS_SELECTIVE_FLUSH', true);
define('WP_CACHE_KEY_SALT', 'mystore_');

# WP-CLI: enable object cache drop-in
wp redis enable --allow-root

# Verify: wp redis info --allow-root
# Confirms: Status: Connected, Cache hits: XX%

Layer 3: Nginx FastCGI Page Cache

<code">cat > /etc/nginx/sites-available/woocommerce << 'EOF'
fastcgi_cache_path /var/cache/nginx/woocommerce
    levels=1:2
    keys_zone=woo_cache:100m
    inactive=60m
    max_size=4g;

map $request_uri $skip_cache {
    default 0;
    # Never cache cart, checkout, account, admin
    ~*(cart|checkout|my-account|wp-admin|wp-login) 1;
}

map $http_cookie $skip_cache_cookie {
    default 0;
    ~*woocommerce_cart 1;      # User has items in cart
    ~*woocommerce_session 1;   # Active WooCommerce session
    ~*wordpress_logged_in 1;   # Logged in user
    ~*comment_author 1;
}

server {
    listen 443 ssl http2;
    server_name yourstore.com;
    ssl_certificate /etc/letsencrypt/live/yourstore.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourstore.com/privkey.pem;

    root /var/www/woocommerce;
    index index.php;

    # Combine skip conditions
    set $no_cache 0;
    if ($skip_cache)        { set $no_cache 1; }
    if ($skip_cache_cookie) { set $no_cache 1; }
    if ($request_method = POST) { set $no_cache 1; }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.3-fpm-woo.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_cache woo_cache;
        fastcgi_cache_valid 200 301 302 10m;
        fastcgi_cache_bypass $no_cache;
        fastcgi_no_cache $no_cache;
        fastcgi_cache_key "$scheme$request_method$host$request_uri";
        fastcgi_cache_lock on;
        add_header X-Cache $upstream_cache_status;
    }

    # Aggressively cache static assets
    location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|webp|woff|woff2)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
        access_log off;
    }
}
EOF

Layer 4: MySQL Performance Tuning

<code"># /etc/mysql/mysql.conf.d/performance.cnf
[mysqld]
# InnoDB buffer pool (70% of available RAM for DB-only server)
innodb_buffer_pool_size = 1G      # Adjust for your VPS RAM
innodb_buffer_pool_instances = 4

# Query cache (disable in MySQL 8 — it's removed, but ensure it's off)
query_cache_type = 0
query_cache_size = 0

# Write performance
innodb_flush_log_at_trx_commit = 2   # Slight risk, big perf gain for WooCommerce
sync_binlog = 0

# Connection handling
max_connections = 100
thread_cache_size = 20

# Temp tables (reduce disk I/O for complex WooCommerce queries)
tmp_table_size = 64M
max_heap_table_size = 64M

# Index statistics for better query plans
innodb_stats_on_metadata = 0

WooCommerce Database Maintenance

<code"># WooCommerce accumulates transients, sessions, and old orders — clean weekly
wp transient delete --all --allow-root
wp db optimize --allow-root

# Or use WP-Sweep plugin via WP-CLI
# Remove expired WooCommerce sessions (major source of table bloat):
wp db query "DELETE FROM wp_options WHERE option_name LIKE '_wc_session_%' \
  AND option_value < UNIX_TIMESTAMP(NOW() - INTERVAL 48 HOUR)" --allow-root

# Add to weekly cron:
# 0 3 * * 0 /usr/local/bin/wp --path=/var/www/woocommerce transient delete --all --allow-root

Layer 5: WooCommerce-Specific Settings

<code"># wp-config.php — critical WooCommerce performance settings

// Disable post revisions (massive DB bloat source)
define('WP_POST_REVISIONS', 3);

// Increase memory limit for WooCommerce operations
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');

// Disable WordPress cron (use real system cron)
define('DISABLE_WP_CRON', true);
// Add to system cron: */5 * * * * curl -s https://yourstore.com/wp-cron.php

// Disable file edit in admin (security)
define('DISALLOW_FILE_EDIT', true);

WooCommerce Admin Settings

<code"># WooCommerce → Settings → Advanced → WooCommerce.com:
# - Disable Usage Tracking
# - Disable Marketplace Suggestions

# WooCommerce → Settings → Products → Search:
# - Disable "Include product variations in search results" if you have many variations

# Enable HPOS (High-Performance Order Storage) — major performance improvement
# WooCommerce → Settings → Advanced → Features → Order data storage:
# Enable "High-performance order storage (COT)"

Layer 6: CDN for Product Images

<code"># Offload product images to BunnyCDN or Cloudflare (accessible from China)
# Plugin: WP Offload Media Lite + BunnyCDN

# Configure BunnyCDN pull zone from your HK VPS:
# Pull Zone URL: https://yourstore.com
# CDN URL: https://cdn.yourstore.com

# Update uploads URL in wp-config.php:
define('AS3CF_SETTINGS', serialize([
  'provider' => 'bunnycdn',
  'pull_zone_url' => 'https://cdn.yourstore.com',
]));

Performance Results After Optimisation

Metric Before (default WooCommerce) After (all optimisations)
Shop page TTFB 800ms–2s 50–200ms (Nginx cache hit)
Product page load 3–6s 800ms–1.5s
Checkout page load 2–4s 600ms–1.2s
Concurrent users (4 GB VPS) 10–20 100–200+
DB queries per page load 80–150 5–20 (Redis cache hits)

Conclusion

WooCommerce performance on a Hong Kong VPS improves dramatically through layered optimisation: OPcache eliminates PHP compilation overhead, Redis object cache serves WordPress queries from memory, Nginx FastCGI cache serves cached product pages without touching PHP at all, and MySQL tuning handles complex order queries efficiently. Asia-Pacific customers experience sub-200ms product page loads and a checkout flow fast enough to complete on mobile 4G before impatience sets in.

Host your WooCommerce store: Browse Server.HK Hong Kong VPS plans — a 4 GB NVMe plan with CN2 GIA routing is the recommended starting point for WooCommerce stores targeting mainland China and Asia-Pacific.

Related articles

More in VPS & ServersServer setup guides