New for 2.2.1: Session-less Contexts

One of the common arguments I hear is that using MODX Revolution for small or simple sites is simply overkill and that pages do not perform near as well as they did in Evolution. But with some recent improvements in the 2.2.1-pl release, I can show you how to improve the front-end performance of your Revolution site by more than 40 times.

Session-less Contexts

One of the drawbacks of MODX has historically been that it requires a PHP session in order for a visitor to access a page. This means users have to allow PHP session cookies, and that every user has a session record which is stored on the server. However, many times, you just want to present information anonymously and you don’t need access to PHP session data. This is why I added a new feature to disable session-handling via Context Settings: session_enabled.

Just add this Yes/No setting to the Context you want to disable sessions in, set the value to 0 (No), and that’s it. Since the Resources in this Context no longer have to start, access, and write the PHP session, performance of these Resources is improved by an average of more than 40 times (60 reqs/sec vs. 1.5 reqs/sec using ab -n 100 -c 10).

Screenshot of adding session_enabled to Context Settings

Gotchas

Presenting a Context without session-handling should work in most simple sites that do not present personalized content. However, if you need to provide secure access to Resources in this Context based on user session data (i.e. permission, group membership, etc.), or you have any scripts that use or require access to PHP’s $_SESSION global, this is not an option you can take advantage of without isolating those Resources into their own Context.

BE WARNED! NEVER set session_enabled to 0 (Off) in the MODX System Settings as this will prevent access to the mgr Context altogether. This is why it is not included as a System Setting in the core.

About
Jason is one of the founding members of MODX, and now holds the title of Chief Architect. Because of his love for wilderness and mountains, he resides in Pagosa Springs, Colorado, with his wife, daughter, son, pets, and too many plants. From this remote outpost, he enjoys hiking, camping, snowshoeing, exploring, and photographing the American West with his family. Jason is also an avid drummer and capable pool player. Author of xPDO and architect of MODX Revolution, he leads the development and innovation team for the MODX Content Management System.

http://www.jasoncoward.com/