Skip to main content

Website Performance Optimization #WebsiteDevelopment #performance

Category: IT-Stuff

I've spent a lot of time in improving my website's performance. Somehow I've made it down to about 120ms to completely render the page with Google Chrome. In this post I would like to explain what I've done exactly.


1. Update to PHP 7
With the release of Debian 9 "Stretch" in June 2017 I've decided immediately to update my server's OS. The update involved the migration to PHP 7 leading to a significant boost of performance:

2. Activation of OPcache
As shown here the activation of OPcache will result in a considerable decrease of script's response times.

3. Enabling of HTTP/2
HTTP/2 will handle requests and responses more efficiently especially because of Multiplexing and Header Compression:

4. Gzip-Compression
Reduce the size of files sent from your server to increase the speed to which they are transferred to the browser:

5. Request reduction

5.1 Browser Cache Control
Setting expiration periods for web content enables web browsers to cache content for specific periods of time. As a result, you can reduce the number of HTTP requests that the web server must process, which helps improves web site speed and performance:

5.2 Directly serve "above the fold" related CSS & JS
I've wrote a gulp buildscript for compressing and injecting all relevant CSS directly into my template:

5.3 Usage of sprites
Merging several images to one is a common way for reducing requests:

6. Javascript- & CSS-Minification

6.1 Minifying Javascript
Normally a simple gulp buildscript as mentioned above will do the trick. But because I am using Drupal and some core and module Javascript is not compressed by default, I've installed the Advanced CSS/JS Aggregation module using the jsmin php extension for compressing those files before delivery.

Using pecl (for installation of jsmin) didn't work with PHP 7. I had to compile it on my own from the php7-branch as described in the repository's readme. 

6.2 Minifying CSS
The gulp buildscript mentioned above is simply doing the trick.

7. Image Compression
PNGs saved by Photoshop are everything than well compressed. I suggest to use optipng.

optipng -o7 file.png

8. Providing static content via CDN
All static files (png, jpg, css, js etc.) of my website are delivered by a CDN using the "Premium Verizon" Microsoft Azure CDN product.

I had to choose the premium option, because some fonts used by the slick slider where causing some "CORS trouble":

This product is also providing SSL-certificates for custom domain endpoints.


gtmetrix score of

Monthly archive


Debian (2)

Git (4)

Jira (1)

jQuery (1)

Linux (2)

MySQL (1)

PHP (1)