(gs):Reduce GPU use

  • This page was last modified on August 25, 2011, at 14:11.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

Contents


This is an INCOMPLETE article.

For more information, please read: (gs):GPU Usage Reports

Find & block incoming traffic

To figure out where your traffic is coming from, you can log into your (gs) Grid-Service via SSH and run the following command in your logs directory ( /home/00000/logs/ ):

cat access_log-2010-10* | grep example.com | awk '{print $1}' | sort -n | uniq -c | sort -nr | head

This command shows the top 10 visiting IPs to example.com. The first number listed is the number of times the IP visited since Oct 1, 2010:


14608 12.34.56.78
12700 34.56.78.12
3107 56.78.12.34
2833 78.12.34.56
2453 12.33.45.67
2440 12.34.55.67
2235 34.56.77.89
2157 34.56.78.99
1974 56.78.99.12
1812 78.99.12.23

If you believe some of those IP addresses are not coming from legitimate users, you can block them via an .htaccess file on your server, by adding lines like the following:

.htaccess

order deny,allow
deny from all
allow from 12.34.56.78
While this can help with blocking visitors, it can also stop legitimate visitors to your website. Use carefully.

Install a caching plugin for your CMS

A caching plugin works by making static (pre-compiled) pages of your site, instead of making the (gs) Grid-Service compile the page each time. It is always more efficient to have your website serve visitors static pages, and a properly configured caching plugin can have an effect on reducing GPU usage.

Due to the number of caching plugins available for CMS applications, it is left up to the user to compare and choose the right one for the job.

Identify problem WordPress plugins

Many (gs) Grid-Service websites use WordPress, and there are over 15,000 plugins listed on the WordPress site. Often, a faulty plugin can be responsible for increasing the GPU use of your service. You can log into your (gs) Grid-Service via SSH, navigate to your WordPress folder, and run the following command to get an idea of how many times WordPress calls to a plugin for a single page:

strace php5 index.php 2>&1 | perl -ne 'if (/plugins\/([\w\d-_]*)/ ) { print "$1\n" }' | sort | uniq -c | sort -n

You will receive output like the following:

6 changelogger
14 google-sitemap-generator
21 wp-polls
23 akismet
28 simple-coming-soon-and-under-construction
30 all-in-one-seo-pack
53 wp-recaptcha
64 promotion-slider
196 wp-pagenavi
223 wptouch-pro
400 like-button-plugin-for-wordpress

In this example, you would want to investigate the "like-button-plugin-for-wordpress", since it is one of the top troublemakers.

Notes/Supplemental