32 private links
Speedy Sites: Nginx and PHP
20
FEB
In the previous article in this series, we looked at using Apache with mod_pagespeed to perform on-the-fly enhancements to decrease page load times. Getting an optimised page is only half the battle however; we need to ensure that our backend is doing as little work as possible in order to be highly scalable. In this article, we look at how we can achieve this while improving performance – all with nginx.
What is nginx?
For those unfamiliar with nginx, it describes itself as “a free, open-source, high-performance HTTP server and reverse proxy”, first released publicly in 2004, and becoming one of the most successful webservers in the past few years – their wiki has an impressive list of sites powered by it. The biggest advantage it has over the tried-and-tested Apache webserver is that it uses an event-driven, asynchronous architecture – so it doesn’t rely on threads to handle requests. What does this mean in real terms? Well, apart from predictable increases in memory usage under load, the key point for us at the moment is that it can serve static content fast. Really fast.
Unless you continually monitor page weight, you won’t know how your diet is progressing. The average page now exceeds 1.7Mb and increased by 32% in 2013 alone. If your developers are secretly gorging themselves on fattening widgets, any of the following assessment tools will highlight their gluttony. They’re all free and take a few seconds to run — what are you weighting for…
Imagine that you have just written a post on your blog, tweeted about it and watched it get retweeted by some popular Twitter users, sending hundreds of people to your blog at once. Your excitement at seeing so many visitors talk about your post turns to dismay as they start to tweet that your website is down — a database connection error is shown.
Czasami transfery w sieci są podejrzanie niskie i zachodzi konieczność wykrycia wąskiego gardła.
Najłatwiej zrobić to przy użyciu narzędzia iperf, dostępnego na wszystkie popularne platformy.
Użytkowanie narzędzia jest bardzo proste
Swiftfox is an optimized build of Mozilla Firefox. Swiftfox has builds for both AMD and Intel processors and is based on the most cutting edge Firefox source code available.
Help is available in the Swiftfox Forum. If you have questions or are having difficulty with any aspect of using Swiftfox please leave a post on the forum and I or one of the forum members will provide assistance.
There is now an installer available that is distro independent. It is a script that downloads and installs Swiftfox in the /opt directory and attempts to use existing Firefox plugins. The installer is probably the best way for most users to install Swiftfox. If your distro is Debian based you will want to install using the deb files as the apt repository will provide automatic updating. More info is available at the deb file page.
Existing Firefox plugins should work with no additional configuration if you use the installer or deb file. If you install using the tarball or your plugins are not working you will want to make sure plugins are located in the directory ~/.mozilla/plugins or swiftfox/plugins. If you need any help please visit the Swiftfox Forum.
Test a website's performance
How fast does your webpage load?
The goal of any great website is to provide quality content for its readers and clients, though no website can be truly successful if it cannot provide the content in a timely manner. How much time is acceptable isn’t always up to you though. It’s in the eyes of the beholder, hence the readers.
If you have a flash based website that is media heavy, and your users knows is, they will probably be ok waiting a minute or two while your page loads. Though, if on the other hand you have a mostly text based website and it takes two minutes to load, there is 99.99% chance the person will not wait. These days, people want information and websites to be practically instantaneous.