MODX Optimization: From Diagnostics to Production

MODX Acceleration: From Diagnostics to Production

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1414
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1285
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    982
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1241
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    982
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    995

MODX Acceleration: From Diagnostics to Production

We integrate and optimize MODX Revolution to achieve lightning-fast performance. With 10+ years of experience and 100+ successful MODX acceleration projects, our team brings load times down to 200 ms and ensures Core Web Vitals pass. Hosting resource savings after optimization typically reach 30–50%, saving clients up to $500 per month on server costs. Get a consultation on MODX optimization—contact us for a free audit.

How to Identify MODX Bottlenecks

The first step is to understand what slows down. MODX logs slow queries if you enable it in core/config/config.inc.php:

define('MODX_CONFIG_KEY', 'config'); // in System Settings: // log_level = 4 (DEBUG) // log_target = FILE 

A more precise tool is xDebug + Blackfire or just EXPLAIN in MySQL/MariaDB for queries that MODX generates during page rendering. Typical problems:

  • modResource reads all fields, including content, even when only pagetitle is needed
  • getResources without limit runs SELECT * on all child resources
  • Snippets without &cache=1 execute on every request

Experienced engineers also check PHP-FPM and OPcache settings—often the bottleneck is not MODX itself but the environment configuration. Optimization investments usually pay back within 2–3 months by lowering server load.

Caching at the MODX Level

System cache is stored in core/cache/. For production, ensure the directory has permissions 755 and is not mounted via tmpfs without sufficient size.

Optimal System Settings:

Parameter Recommended Value
cache_resource_handler xPDOFileCache (default) or Redis
cache_default_lifetime 3600–86400
cache_context_settings 1
compress_js 1
compress_css 1

Why Redis Beats File Cache

For Redis cache, install the Redis package (modmore or similar) and add to core/config/config.inc.php:

$config_options = [ 'cache_path' => MODX_CORE_PATH . 'cache/', 'cache_default_handler' => 'xPDORedisCache', 'cache_xpdo_handler' => 'xPDORedisCache', 'redis_host' => '127.0.0.1', 'redis_port' => 6379, 'redis_db' => 0, ]; 

After switching to Redis, TTFB drops by 30–50% on high-traffic sites because disk stat() operations on cache files disappear. Comparison:

Cache Type Average TTFB Disk Load
File Cache 800–1200 ms High
Redis 200–400 ms None

According to Redis, in-memory data storage significantly speeds up read operations. In practice, this cuts server resource costs by 30–40%.

Optimizing Snippets and pdoTools

Uncached calls [[!SnippetName]] are the main cause of slowness. Audit by searching templates and chunks: grep -r '\[\[!' across the elements folder. Rules:

  • If a snippet does not depend on session/cart/user — make it cacheable: [[SnippetName? &cache="1" &cacheExpires="3600"]]
  • getResources, pdoTools are cached via the built-in &cache parameter
  • FormIt and Login — always uncached, move to separate chunks

pdoTools instead of getResources is critical for sites with large catalogs. pdoTools uses JOIN instead of multiple queries, making it 3x faster than getResources on large data sets. Example call: [[pdoResources? &parents=15 &depth=2 &limit=20 &sortby=publishedon &sortdir=DESC &cache=1 &cacheExpires=1800]]

Sample OPcache Configuration

For maximum PHP-OPcache performance, use this configuration:

; /etc/php/8.1/fpm/conf.d/10-opcache.ini opcache.enable=1 opcache.memory_consumption=256 opcache.interned_strings_buffer=16 opcache.max_accelerated_files=10000 opcache.validate_timestamps=0 opcache.revalidate_freq=0 opcache.fast_shutdown=1 ; /etc/php/8.1/fpm/pool.d/modx.conf [modx] pm = dynamic pm.max_children = 20 pm.start_servers = 5 pm.min_spare_servers = 3 pm.max_spare_servers = 8 pm.max_requests = 500 request_terminate_timeout = 30s 

pm.max_requests = 500 prevents memory leaks in long-lived snippets.

How to Set Up Redis for MODX: Step-by-Step

  1. Install the Redis package via MODX Package Manager (e.g., Redis from modmore).
  2. Modify config.inc.php as shown above.
  3. In MODX System Settings, set cache_resource_handler to xPDORedisCache.
  4. Clear existing cache via the admin panel.
  5. Ensure Redis server is running and accessible at 127.0.0.1:6379.
  6. Test page load speed—TTFB typically drops 2–3x.

Nginx Configuration for MODX

server { location ~* \.(js|css|png|jpg|webp|woff2|ico|svg)$ { expires 1y; add_header Cache-Control "public, immutable"; access_log off; } location ^~ /core/ { deny all; } gzip on; gzip_types text/plain text/css application/json application/javascript image/svg+xml; gzip_min_length 1024; gzip_comp_level 5; } 

Database Indexes

MODX does not add all necessary indexes automatically. For sites with 10,000+ resources, we add:

ALTER TABLE modx_site_content ADD INDEX idx_parent_published (parent, published), ADD INDEX idx_context_published (context_key, published), ADD INDEX idx_publishedon (publishedon); 

After adding indexes, EXPLAIN SELECT on a typical getResources query shows ref instead of ALL. This reduces server load and saves up to 40% in hosting resources, lowering infrastructure costs.

What's Included in Turnkey MODX Optimization?

Basic optimization includes: configuration audit (logs, profiling, EXPLAIN), Redis cache setup and file cache migration, PHP-FPM and OPcache tuning, Nginx optimization, necessary MySQL indexes addition, CSS/JS compression and browser caching configuration, Core Web Vitals before/after measurement, and change documentation. For complex cases—refactoring uncached snippets to cached ones. We guarantee at least a 50% improvement in TTFB. Results are verified with Core Web Vitals measurements.

Timelines

Basic optimization (cache, PHP-FPM, nginx, indexes): 2–3 days. Refactoring uncached snippets to cached + template audit: 3–5 days depending on element count. Redis cache migration with testing: 1 additional day. Each stage is benchmarked.

Order a MODX Performance Audit

Leave a request—we will analyze your site for free and propose an optimization plan. We guarantee results: confirmed Core Web Vitals before and after. Contact us to start. Optimization reduces infrastructure costs and speeds up the site, positively impacting conversion rates.