In this article, Ronald Heft talks about GPU,
specifically what it is, the problem he personally encountered, the fix
for that problem, and the fix for common problems most developers would
run into.
What Makes Up a GPU?
Before I could lower my usage, I had to first understand whta a GPU is.
Since the GPU, or Grid Performance Unit, is a new form of measurement
in hosting, there are a number of misconceptions surrounding the unit.
Even my original understanding of a GPU was wrong.
GPUs reflect the amount of processing power a site uses on the Grid. The key point here is processing on the Grid. MySQL queries take place on the SmartPool or GridContainer system and are excluded from GPU measurements. GPUs will contain PHP scripts, Perl scripts, and other CPU related tasks.
Tracking GPU Usage
To find out exactly what was consuming my GPUs, Media Temple
provided me with an itemized GPU report. To get a GPU report, just send
in a ticket to support. In the future, GPU reports will be available in
the Account Center with a click of a button.
My GPU Report Results
Once I had my GPU numbers, I was surprised with the results. My
site’s feed consumed around 50% of my hourly GPU usage.
Not only did WordPress have to generate my feed on every request, Bird
Feeder had to acquire information about the subscriber and store it in
a database. Since feed readers tend to request a site’s feed in short
intervals, my feed was constantly being accessed.
If a
person would visit the incorrect permalink URL, Permalink Redirect
would not run until after the page had already been pulled from the
database. Then, the person would have to fetch the correct page’s
contents, wasting even more resources.
I found that odd since I
did not have a robots.txt file on my site. Wouldn’t you know, WordPress
automatically generates a robots.txt if the file is missing, wasting
resources.
How I Solved the Usage Problems
Addressing my feed issue was simple. I just moved my feed to Feedburner. The Feedburner Plugin
insured that all my subscribers would not have to change anything to
continue receiving my content. More importantly, the Feedburner Plugin
moves the feed without any heavy PHP processing, a factor which could
contribute to GPUs.
Fixing my Permalink Redirect issue left me feeling stupid. I knew I
needed .htaccess rules instead of using PHP processing, but I didn’t
expect the results. In my search for .htaccess rules,
Finally, I solved the robots.txt access issue by simply creating a
robots.txt file. WordPress stopped creating one for me, and my site
served up a static file instead.
How to Lower Your Usage
Obviously, my specific optimization are not going to work for
everyone, so here are some simple general optimization you can try on
your site:
- Cache your site’s content with WP-Cache.
- Uninstall plugins which are unnecessary.
- Look for cached version of existing plugins.
- Look into enabling persistent MySQL connections in your PHP apps.
Hopefully by following this advice, you too can lower your GPU usage.
|