tutorials

Seven Ways to Make MODX Fly

Having a fast website today is critical, but what happens when you begin to suffer from your own success? Here's a few ways you can make MODX sites fly, resulting in better conversion and stickiness for your site visitors.

The Importance of Performance on the Web

A significant part of winning online is having a site that gets information to visitors fast. MODX has long been a leader in this due to site builders being able to control 100% of what comes out of it without hacking the core. But it doesn't matter if your site loads too slowly, or worse, crashes under load.

The following tips are the basics of what we have learned from years of helping people get the most out of MODX with our MODX commercial support services. While there's many more things you can do to optimize performance, these will usually make a noticeable improvement to any site where the following MODX best practices have not been employed.

Dealing with Image & Thumbnails

Dealing with image thumbnails happens for many sites, and for a lot of people that means phpThumb is involved. Unfortunately, while it's a very functionally-useful piece of code, it is not the most optimal when it comes to scaling even moderatly busy sites. In fact, phpThumb can crush even the largest of servers out there, especially when its evil sidekick, the Cache Manager Plug-in, is left on in production.

Tip #1: Avoid or disable phpThumb Cache Manager. While the Cache Manager Plug-in can be useful, it's also easy to fall into unintended misuse/abuse, leading to the destruction of any chance of your site performing well. Avoid it unless you really, really know what you're doing.

Tip #2: Use pThumb to generate thumbnails. Jason Grant did a great job creating this more performant alternative to generating thumbnails with scaling in mind. It is a drop in replacement for phpThumbOf so all you have to do is swap them out.

Use the latest PHP & Nginx

MODX loves updated software stacks. That's why at the time of this writing, MODX Cloud uses the latest stable branch of nginx 1.6.x and PHP 5.4.x with APC (see Tip #5). We're also in the process of validating SPDY and Pagespeed in MODX Cloud. These tools take advantage of modern browser capabilities and automatic optimization to help sites render more quickly, keeping site visitors happier and around longer.

Tip #3: The current versions of Nginx and PHP versions can improve site performance. Especially if you're coming from older versions; it can also pay to keep up with new releases, and explore optimization tools like Pagespeed and SPDY, too.

Learn Your ABCs: Always Be Caching

Caching is probably the most important thing you can do for any MODX project. It also gets into the geekier underpinnings of how the web works. Jason Coward wrote an excellent in depth article on caching. YJ Tso expanded on that one with more discussion and examples. Both should be required studies for any serious MODX site builder.

Caching also extends to the PHP server layer, via "opcode caching". In our experience, at the time of publishing this article we usually get better performance and reliability using APC compared to Xcache. But, that is likely to change over time. No matter where you are today, it's likely there will be something faster tomorrow, so it can pay to keep things up to date and evaluate options.

Tip #4: Always Be Caching (ABC). Always. Every time. Seriously. If you don't have the expertise to know if you're doing it right, get some help from someone that does.

Tip #5: Use an opcode cache. We've seen best results using APC, but any one is far better than none at all.

CDNs to the Rescue

There are more images, videos and audio files being served every day. There are also great services that do a much better job delivering these assets to end usrs called Content Delivery Networks. You should use them because they offload your server of a very specific task, and as a result make your sites perform much better.

To make it even easier, Garry Nutting will be releasing a MODX Extra that makes working with MODX users get 25% off for life, in addition to them kicking a little back to MODX for every signup there.

Tip #6: Use a Content Delivery Network. http://modx.com/maxcdn.

Throw Hardware at It

We've helped sites go from slow responseses and timeouts under load even with 96GB of RAM and 32 processor cores, to flying on 4 cores and 16GB RAM—with no outages. Similarly, we've helped build out infrastructure that uses load balancers, multiple webservers, multiple databases and Memcached or Varnish or Redis. Sometimes you just have enough traffic to justify more hardware, or the time involved in optimization is more expensive than extra boxes. When you can't squeak more out of your site using techniques like the ones above, you often need to give it more IO or processor.

Tip #7: Deploy more server resources. A quick technique would be to make more PHP workers available to your site to increase the number of maximum visitors it can sustain. Often this means getting a larger plan, bigger VPS or a dedicated box. And sometimes, it just takes multiple, highly-tuned servers.

Conclusion

There is a lot under the hood that savvy site builders can do to make MODX sites sing. There's also a lot more that can be done like creating function-specific Snippets to replace much-loved but sometimes suboptimally-performing "generic" Snippets for sites with heavy visitor load.

Making the most of MODX is a process, not a destination, that changes over time. If you ever want to reach out for help improving MODX site performance, and in the process help fund ongoing MODX Development, we're happy to talk.

Hi. We’re MODX.

We’re here to help you fix, build and grow fantastic sites. How can we help?




How can we help?

Tell us the general reason for reaching out so we can connect you with the right team.

MODX Diagnostics

MODX’s Open Source software is 100% free for anyone to download and use. As the team behind it for more than a decade, we know it inside, out, and then some.

Like any software, sometimes things break; we can usually fix them very fast. But, we do have to charge for our time to support our families and fund its ongoing development. There are almost an unlimited variety of things that can cause problems, including server upgrades, corrupt files, accidental changes, outdated software, database hiccups and more. We will save you a lot of time and frustration, and get you back in action.

With our MODX Diagnostic service, we determine the source of issues, and often fix them on the spot. For more extensive problems needing more time, like hacked sites or overdue upgrades, we provide additional estimates and guidance. MODX Diagnostics cost $99 for standard business hours support (US Central Time), or $500 for priority, rush or after-hours emergencies.

If you don’t have budget for professional support from the source, you look for answers in the MODX Forums or Documentation, or seek help from MODXers in the Community Slack, or from MODX Professionals near you.

Get Support Now

After submitting this we will contact you to collect any access credentials in a secure support ticket. We look forward to helping restore your site back to full health.

Hi! We’d love to work together.

If you have a simple problem that needs our assistance, please request quick fix help here.

What should we keep in mind?

The project involves:
(select all that apply)
What are you planning?
(select all that apply)

Some other considerations

Specific project information

Commercial Support Customers

Customers with a current Commercial Support agreeement can get help using this form. Learn more about MODX Preferred Support.

Let’s get started

What seems to be the issue?

Contact MODX

We welcome conversations, ideas, inquiries and even the occassional cold sales call, but support and requests about how to use MODX software sent via this form cannot be guaranteed a response. That said, we try to respond to everyone that reaches out to us within two business days.

To report a security issue or file a bug for MODX software, please email security [at] modx.com to reach our security team. If you are looking for help with MODX, many times you can find an answer in the MODX Forums or MODX Documentation, from MODXers in realtime at the MODX Community Slack Channel, or from a MODX Professional near you.

How can we help?