Whitelabel Nameservers on Route53
This is a quick(ish) how to that you can do to utilize one of your registered domains on Amazon's Route53 service. Required: A registered Domain An account with Amazon's AWS, in particular, their Route53 service An IAM account, with API access to allow the creation, reading, and updating Route53 Domain…DNS Propagation
Have you ever updated your domain's A record and noticed that, for at least several hours, your new domain displayed the new site on one device (such as your smartphone), but the old site on another device, such as your home computer? Have you ever updated your domain's MX records…SSL and Your Wordpress Site
Many people think securing a website with SSL (SSL encryption) is necessary only if they're selling products or services via their website and collecting credit card or payment information. What many website owners do not realize is that SSL encryption has other very important benefits for small business owners. To…High Performance Wordpress and Server - Part II - Theme Development
In part I, I walked you through my server setup to achieve a 1 second load time for my site. It is a Wordpress site, with a custom theme I developed. I gandered at the possibility of by-passing Wordpress's front-end engine, however, I found myself needing some of the built-in…Cookie Notice
This site utilizes cookies to improve your browsing experience, analyze the type of traffic we receive, and serve up proper content for you. If you wish to continue browsing, you must agree to allow us to set these cookies. If not, please visit another website.
High Performance Wordpress and Server - Part II - Theme Development
In part I, I walked you through my server setup to achieve a 1 second load time for my site. It is a WordPress site, with a custom theme I developed.
I gandered at the possibility of by-passing WordPress’s front-end engine, however, I found myself needing some of the built-in functionality WordPress offers. Items like custom posts, pages, and even posts are simple sql queries, however; widgets, shortcodes, and most plugins then become unavailable.
So, I delved into the realm of research and found WordPress core functionality offered the functionality I required, with very little performance hit; so I decided to simply extend some memcached functionality when pulling my pages/posts/widget/etc…
The only thing I found that I lost was time, and in the end drastically improved the load time of my site, as well as drastically improved the number of concurrent connections to it.
I managed to keep this 1 second load time with 250 concurrent users per minute. Of course, load time increased as the numbers grew, and in the end I found that my server/site setup was able to effectively handle 1238 concurrent connections per minute before I hit the 7 second load time mark. At this point I called it a viable project, implemented my code… here we are 🙂
Now I won’t get into the details of theme design and development here, however, have a look over at the codices for the how-to’s you will need to read through to go further here.
Once you get the basics down pat and your site is running how you like, add a little more code to force your templates to utilize memcached and cache your theme pages in server memory for lightning fast transfer and rendering.
At the top of each of my theme files, I have put the following code:
<?php // Fire up an instance of Memcached $mc = new Memcached(); // If it's not already done, set the server if(!$mc->getStats()) $mc->addServer('127.0.0.1', 11211); // Start our output buffer ob_start(); // Load up our sidebar dynamic_sidebar('blogsidebar'); // Grab the content from it $sidebar = ob_get_contents(); // End our buffer so we can process the rest of the page ob_end_clean(); get_header();
As you can see above, this is far from complete. You will want to add in anything that pre-fires/pre-loads after the start of our output buffer. This way we can catch it, and cache it before it renders
The rest is basically up to you, as the rest of the code is pretty basic… check for the cached object, if it’s there, present it, if not present the page and cache the object.
For instance:
$ret = ''; $m = $mc->get('YOURKEY'); if($m) { echo $m; } else { $ret = 'Your stuff here...'; $mc->set('YOURKEY', $ret); echo $ret; } get_footer();
You will want to name your KEY accordingly, for instance, for my posts, the key name is set to “post_the-post-title”. This way Memcached knows what to present, and there will be no collisions.
Of course, if you do not follow the basics of web design, this may be a moot point. Make sure you are concatenating and minifying where you can, optimizing all your images where you can to get the best optimal results, and setting the proper browser caching/gzipping on all static resources.
Now, as much as I hate to admit it, there are a couple of plugins I am going to go out on a limb and recommend to you all. All are caching related, and all are the ones I have used extensively with great success.
Plugins
Some of the configuration options will depend on your setup, however, if you followed along with Part 1, and set your server up like that, you should be good 😉
- Nginx Cache
- Plugin Homepage: https://wordpress.org/plugins/nginx-cache/
- Settings: Change the cache path to your location, and make sure the “Automatic flush” is checked off
- WP Super Cache
- Plugin Homepage: https://wordpress.org/plugins/wp-super-cache/
- Settings:
- Easy Tab: Turn on Caching
- Rest of settings defaults are fine, though I did up the timeout to 3600 for everything
- WP-FFPC
- Plugin Homepage: https://wordpress.org/plugins/wp-ffpc/
- Settings:
- Cache Type Tab:
- Select backend: PHP Memcached
- Timeouts: 3600
- Backend Settings Tab:
- Hosts: add your memcached server ip adress and port; ie… 127.0.0.1:11211
- accepts a comma-delimited list of servers…
- Hosts: add your memcached server ip adress and port; ie… 127.0.0.1:11211
- Cache Type Tab:
- Notable Mentions 🙂
- WP Smush – helps reduce image file sizes
- WP Clean Up – keeps your database clean and optimized
- Lazy Load – hooks into your images and only loads them into the page when they enter the viewport
- WP Performance Score Booster – removes the versioning querystring on static resources