Magento VPS Requirements: PHP OPcache Sizing, Memory Limits & OpenSearch Setup
Comprehensive production requirements for running Magento 2 on a KVM VPS, covering PHP 8.2+ settings, OPcache memory allocation, and OpenSearch integration.
Running Magento 2 (Adobe Commerce) on a production KVM VPS requires provisioning sufficient compute and memory resources to handle its multi-tier stack, including PHP-FPM, MySQL/MariaDB, and an external search engine. Official specifications mandate at least 4 GB of RAM as a minimal baseline, with 8 GB or 16 GB recommended for live merchant traffic, coupled with an external OpenSearch instance and dedicated PHP OPcache memory allocation.
Core System Architecture and Software Prerequisites
Modern versions of Magento 2 (v2.4.x and higher) have moved away from legacy hosting architectures. Key baseline software requirements include:
- PHP Runtime: PHP 8.2 or 8.3 (with PHP 8.4/8.5 support in recent release tracks). PHP must be configured with required extensions, including
ext-pdo_mysql,ext-intl,ext-bcmath,ext-soap, andext-opcache. - Mandatory Search Engine: Magento 2.4+ completely removed the legacy MySQL search adapter. A dedicated search engine, specifically OpenSearch (v2.x or v3.x depending on release) or compatible Elasticsearch, is mandatory. Without an operational search engine, the catalog indexer cannot complete.
- Database Engine: MySQL 8.0 or MariaDB 10.4 to 10.11 with adequate buffer pool sizing.
- Composer: Composer 2.x for dependency management and module deployments.
PHP Memory Limits and OPcache Optimization
Magento's dependency injection compilation (bin/magento setup:di:compile) and static asset deployment are notoriously memory-intensive operations. Insufficient memory limits will cause CLI commands and admin checkouts to crash with fatal out-of-memory errors.
Required php.ini Configuration
Configure the following directives in your /etc/php/8.2/fpm/php.ini and CLI configuration:
# Minimum recommended memory limit for production
memory_limit = 2G
# OPcache Sizing
opcache.enable = 1
opcache.memory_consumption = 512
opcache.max_accelerated_files = 60000
opcache.interned_strings_buffer = 16
opcache.validate_timestamps = 0
opcache.consistency_checks = 0
opcache.enable_cli = 1
# Realpath Cache Tuning
realpath_cache_size = 10M
realpath_cache_ttl = 7200Setting opcache.validate_timestamps = 0 in production prevents PHP from checking file modification timestamps on every incoming web request. Because Magento contains tens of thousands of PHP files across core and vendor directories, eliminating these filesystem stat calls dramatically improves page generation speed. Remember to flush OPcache or reload PHP-FPM during deployment workflows.
Database Buffer Pool and Redis Session Caching
Database and object cache performance directly dictate catalog browsing latency. For a single-node Magento VPS deployment:
- Tune MariaDB InnoDB Buffer Pool: Allocate between 50% and 70% of available memory to
innodb_buffer_pool_sizeif MySQL is the primary consumer. Ensure the entire active database index can reside in RAM to avoid disk bottlenecks during checkout queries. - Deploy Redis for Object and Session Storage: Configure Redis in
app/etc/env.phpfor default cache and session handling. Running two separate Redis instances (one on port 6379 for cache and another on port 6380 for session storage) avoids lock contention and prevents cache flushes from evicting customer shopping carts.
OpenSearch Sizing on a Virtual Private Server
OpenSearch runs on Java and requires its own dedicated heap allocation. For small-to-medium product catalogs:
- Allocate at least 1 GB to 2 GB of JVM heap to OpenSearch (configured via
/etc/opensearch/jvm.optionswith-Xms2g -Xmx2g). - Ensure that total VPS RAM accommodates both the PHP-FPM pool, MySQL buffer pool, and OpenSearch JVM simultaneously. For a single-server deployment, 8 GB of RAM is the minimum practical threshold to avoid Linux kernel OOM kills.
Cron Job Automation and Asynchronous Processing
Magento relies heavily on background cron tasks to handle asynchronous operations. Without properly scheduled cron jobs, catalog price rules, customer transactional emails, inventory re-indexing, and sitemap generation will fail to execute.
Configure the Magento crontab for the web server user (such as www-data):
# Run Magento cron every minute
* * * * * /usr/bin/php /var/www/html/bin/magento cron:run 2>&1 | grep -v "Ran jobs by plan" >> /var/www/html/var/log/magento.cron.logRunning cron jobs every minute ensures that heavy index updates are processed in the background by CLI workers rather than blocking customer web requests during checkout.
VPS Sizing Matrix for Magento 2 Merchants
| Store Scale | Catalog Size | Recommended VPS Specification | Architecture Notes |
|---|---|---|---|
| Staging / Development | < 1,000 SKUs | 4 vCPU / 8 GB RAM / RAID NVMe | Single-node stack (PHP + MySQL + OpenSearch) |
| Active Retail Store | 1,000 to 15,000 SKUs | 8 vCPU / 16 GB to 32 GB RAM / RAID NVMe | Redis for session/cache, dedicated PHP-FPM pool |
| High-Traffic E-commerce | 15,000+ SKUs | AMD Ryzen 9 9950X (16 GB to 64 GB DDR5) | Zen 5 high-frequency cores for sub-second checkout |
Deploying on VPSWala Cloud Infrastructure
E-commerce checkout funnels demand rapid transaction execution. VPSWala delivers unmanaged KVM cloud VPS instances equipped with high-speed RAID NVMe storage arrays across Mumbai, Noida, and Jaipur nodes. For stores requiring peak single-threaded performance, VPSWala's AMD Ryzen 9 9950X VPS tiers provide Zen 5 cores (up to 5.7 GHz boost) and high-speed DDR5 memory, ensuring responsive category indexing and rapid customer checkout.
Review virtual server plans on VPSWala Cloud VPS or explore high-frequency options on VPSWala AMD 9950X VPS.
Sources
Not sure which size?
Send the stack, get a size.
Tell us the operating system, application stack, current traffic, database size and where it hurts today. You get a sizing recommendation, the matching plan and a price.
Related
Deploying Next.js SSR on a Linux VPS: Standalone Build, PM2 & Nginx Proxy
Learn how to deploy a server-rendered Next.js application on a Linux KVM VPS using standalone build artifacts, PM2 cluster management, and Nginx.
VPS Firewall Setup with UFW and iptables: Port Hardening & Lockout Prevention
A hands-on sysadmin guide to securing a Linux cloud VPS with UFW and iptables, implementing strict ingress filtering while preventing accidental connection loss.
VPS Hosting for Bhopal: Which VPSWala Node to Pick and How to Test It
A practical routing and workload sizing guide for developers and businesses in Bhopal to evaluate VPSWala cloud nodes and verify network path stability.