Installation of mod_pagespeed

Google provides Debian packages for mod_pagespeed for 32 and 64-bit installations.

Debian 64 bit (this should be the right for most current servers)

cd /tmp
dpkg -i mod-pagespeed-stable_current_amd64.deb

Debian 32 bit (this should be the right for most current servers)

cd /tmp
dpkg -i mod-pagespeed-stable_current_i386.deb

finally restart apache to activate the pagespeed module

service apache2 restart

Installation of Memcached
The Memcached package is available in the Debian repositories, so we can install it with apt directly

apt-get install memcached

Now check with the command “netstat -tap | grep memcached” if memcached is running

netstat -tap | grep memcached

The result shall look similar to this:

root@server1:/tmp# netstat -tap | grep memcached
tcp 0 0 localhost:11211 *:* LISTEN 35396/memcached

In the output, we see the port were Memcached is listening on: 11211, we need that port for the next step.

Configure mod_pagespeed to use memcached

nano /etc/apache2/mods-available/pagespeed.conf

find the line

# ModPagespeedMemcachedServers localhost:11211

and remove the #, so that it looks like this:

ModPagespeedMemcachedServers localhost:11211

If you have plenty of memory in your server, then you can get a further speedup by removing the # in front of this line:

ModPagespeedCreateSharedMemoryMetadataCache “/var/cache/mod_pagespeed/” 51200

Finally restart apache to apply the changes:

service apache2 restart

Now mod_pagespeed will use memcached as storage backend. You can get usage statistics from memcached with the following command:

echo stats | nc 11211

root@server1:/tmp# echo stats | nc 11211
STAT pid 35396
STAT uptime 72
STAT time 1458293309
STAT version 1.4.21
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 0.008000
STAT rusage_system 0.000000
STAT curr_connections 5
STAT total_connections 6
STAT connection_structures 6
STAT reserved_fds 20
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 6
STAT bytes_written 0
STAT limit_maxbytes 67108864
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 0
STAT crawler_reclaimed 0
STAT lrutail_reflocked 0

Leave a Reply

Your email address will not be published. Required fields are marked *