Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion

[TUTORIAL]How To Speed Up Apache With Mod Pagespeed And Memcache
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

[TUTORIAL]How To Speed Up Apache With Mod Pagespeed And Memcache

this tutorial tested on debian 8 and working as well

**1 Requirements
**

Debian 8 with Apache web server installed.

Root access to the server

2 Installing mod_pagespeed

Debian 64 bit

cd /tmp wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb dpkg -i mod-pagespeed-stable_current_amd64.deb

Debian 32 bit

cd /tmp
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.deb 
dpkg -i mod-pagespeed-stable_current_i386.deb

**restart apache
**

service apache2 restart

3 Installing Memcached

apt-get install memcached

And check with the command "netstat -tap | grep memcached" if memcached is running

netstat -tap | grep memcached

The result:

root@localhost:/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
[....]

restart apache

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 127.0.0.1 11211

root@localhost:/tmp# echo stats | nc 127.0.0.1 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 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

END

Press [ctrl] + c to get back to the command prompt.

best regards

Comments

This discussion has been closed.