Entries Tagged with: Performance
Showing PHP Memory Usage through your Template
Ever been deep in troubleshooting performance issues in your ExpressionEngine site and wondered what kind of memory is a certain plugin/weblog tag, etc is taking up? Unless you're holding out from blogging about it, there's absolutely no way I'm aware of that you're getting that info from shell on the server. So, here's a quick and dirty hack to EE's template parser that will show you this info.
Pop open system/expressionengine/libraries/Template.php and look for:
Now, a quick addition in there and you're good to ...
Get your SQL on
Harnessing the Power of ExpressionEngine's Query Module
The Query Module in ExpressionEngine is one of my most favorite, and I think one of the most underutilized gems of the product. As I have previously discussed, it's almost always better to use a Plugin or Module rather than turning on PHP in your templates. If the weblog/channel module is overkill, the query module is where it's at.
You need to know how to write MySQL queries, and need to study the ExpressionEngine schema a bit. After getting that under your belt, you'll have a new weapon in your arsenal to attack content layout issues ...
For the performance minded
Aaron over at Causing Effect released a little gem of a plugin to help find trouble spots in your templates. This should be standard in your arsenal while developing ExpressionEngine sites. Let's all be performance minded.
Nice work, Aaron.
Think before you turn it on
The catch 22 of caching in EE
ExpressionEngine's caching in both 1.x and 2.x are as misused as nesting exp:channel:entries tags inside each other.
First thing's first. What kind of environment are you in? Is this a high performance, load balanced setup with network-based storage and your database on its own server? Is this a cheap VPS, or perhaps a "dedicated" server that's nothing more than a 4-5 year old tower sitting on a bread rack? (ohh, but it's got RAID) :: cough ::
Okay, let's go over the assumption that we're smart enough to not go the cheap ...
What's Your .htaccess?
I don't use a whole lot of Apache anymore for my personal stuff, but when I do, here's my basic .htaccess.
Some people might say:
"Woah Greg, what the heck, you aren't gzipping your static content you hosehead!"
Well, I have an answer for you. See, gzipping can be a CPU-intensive operation on the web servers. If you're on a Cheap VPS, a la Linode, Rackspace Cloud, Slicehost, etc you're trying to squeeze every bit of CPU power out of it. Or on the flip side, an awesome host like EngineHosting (yes, I do work ...
With Great Power Comes Great Responsibility
How the decisions you make in your ExpressionEngine templates affect site performance.
A lot of us are drawn to ExpressionEngine because PHP isn't pre-requisite knowledge to make a kick-ass dynamic website. If we need to roll our own PHP we can if absolutely needed. PHP directly in the templates is fantastic for small chunks. I do want to illustrate the kind of issues that may arise if you are putting too much PHP into your templates, and show alternatives.
First, I need to do a custom query and want to use some CodeIgniter Helpers and Libraries too. If we were in straight CI, this would look pretty simple if broken between ...
Are you running APC?
Given the plethora of tutorials out there on how to run your own VPS, and the number of hosts offering DIY VPSs for super cheap, many developers find themselves becoming sys-admins. So securely configuring your stack, and tuning/configuring to offer optimal performance out of low resources is key.
For these cases, I totally prefer Nginx, and I'm waffling on the proper way to configure PHP, whether it is proxying to Apache, or running php-cgi. The only thing no one can argue with is APC.
If you know, and talk with sysadmins, you'll quickly realize that most good ...