Category Archives: Metrics

google pagespeed / gtmetrix – how to improve results

gtmetrix - results

Check if we have enabled mod_headers.c and mod_expires.c

First we need to check if we have enabled mod_headers.c and mod_expires.c.

sudo apache2 -l

If we don’t have it, we need to enable then

sudo a2enmod headers

Then we need to restart apache

sudo apache2 restart
Leverage browsers caching

By adding the following lines on .htaccess Leverage Browsers Caching has simply disappeared! I got the solution from http://stackoverflow.com/questions/6878427/leverage-browser-caching-how-on-apache-or-htaccess

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType text/css A86400
ExpiresByType text/javascript A86400
ExpiresByType application/x-shockwave-flash A2592000
#
<FilesMatch "\.(gif¦jpe?g¦png¦ico¦css¦js¦swf)$">
Header set Cache-Control "public"
</FilesMatch>

It went from a global score of 53% to 72%.
And F(1) to A(98).

Enable gzip compression
<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
 AddOutputFilterByType DEFLATE application/x-font
 AddOutputFilterByType DEFLATE application/x-font-opentype
 AddOutputFilterByType DEFLATE application/x-font-otf
 AddOutputFilterByType DEFLATE application/x-font-truetype
 AddOutputFilterByType DEFLATE application/x-font-ttf
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE font/opentype
 AddOutputFilterByType DEFLATE font/otf
 AddOutputFilterByType DEFLATE font/ttf
 AddOutputFilterByType DEFLATE image/svg+xml
 AddOutputFilterByType DEFLATE image/x-icon
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE text/plain
 # Remove browser bugs (only needed for really old browsers)
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4\.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 Header append Vary User-Agent
</IfModule>
<IfModule mod_gzip.c>
 mod_gzip_on Yes
 mod_gzip_dechunk Yes
 mod_gzip_item_include file .(html?|txt|css|js?|php|pl)$
 mod_gzip_item_include handler ^cgi-script$
 mod_gzip_item_include mime ^text/.*
 mod_gzip_item_include mime ^application/x-javascript.*
 mod_gzip_item_exclude mime ^image/.*
 mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
Defer parsing of JavaScript

To solve this issue I’v installed Asynchronous Javascript WordPress plugin.
It went from a score of F (19) to B (85).

 

 

Google Chrome 53

 

I strongly recommend to install Google PageSpeed module.
Small tutorial https://www.digitalocean.com/community/tutorials/how-to-get-started-with-mod_pagespeed-with-apache-on-an-ubuntu-and-debian-cloud-server

Prometheus, open-source service monitoring system and time series database from SoundCloud

I LOVE SOUNDCLOUD!

From time to time I read their tech blog…
Today I’v found Prometheus! Hooray SoundCloud! Hooray!

Prometheus

An open-source service monitoring system and time series database.
Prometheus is developed in the open and has a growing community outside of SoundCloud.

 

Continue reading Prometheus, open-source service monitoring system and time series database from SoundCloud

Apache or nginx real-time log analysis

Real-time log analysis through a Dashboard

GoAccess‘ dashboard gives you an overview of server metrics by displaying summaries of different reports as panels on a single scrollable view.

 

Logstalgia is a website traffic visualization that replays or streams web-server access logs as a pong-like battle between the web server and an never ending torrent of requests.

Requests appear as colored balls (the same color as the host) which travel across the screen to arrive at the requested location. Successful requests are hit by the paddle while unsuccessful ones (eg 404 – File Not Found) are missed and pass through.

The paths of requests are summarized within the available space by identifying common path prefixes. Related paths are grouped together under headings. For instance, by default paths ending in png, gif or jpg are grouped under the heading Images. Paths that don’t match any of the specified groups are lumped together under a Miscellaneous section.

 

 

 

Logstash+ElasticSearch+Kibana

Some references for Logstash+ElasticSearch+Kibana

These log files are still hard to use on their own. They are made by a computer for a computer and I am human trying to understand other humans. Logstash, ElasticSearch and Kibana to the rescue! Logstash is a tool for managing events and logs. You can use it to collect logs, parse them, and store them for later use (statement humbly borrowed fromhttp://logstash.net). ElasticSearch is a distributed restful search and analytics engine (yet again borrowed, but fromhttp://www.elasticsearch.org/overview/). Kibana is a GUI tool to visualize logs and time-stamped data in realtime (yet again borrowed, but from http://www.elasticsearch.org/overview/kibana/). These three tools make up a pretty good toolkit for creating some graphs and dashboards.

Read more at  http://nhhagen.wordpress.com/2013/11/28/query-log-analysis-using-logstash-elasticsearch-and-kibana/

 

Continue reading Logstash+ElasticSearch+Kibana