Memcached のインストールと設定
Nid: 819
インストール
$ sudo apt install memcached php-memcached $ systemctl status memcached ● memcached.service - memcached daemon Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2016-12-01 07:40:08 EST; 14s ago Main PID: 5243 (memcached) CGroup: /system.slice/memcached.service └─5243 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1
$ sudo systemctl restart memcached $ sudo systemctl restart php7.0-fpm
Drupal 設定例
$ sudo vim sites/default/settings.php // Memcache $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc'; $conf['cache_default_class'] = 'MemCacheDrupal'; $conf['cache_class_cache_form'] = 'DrupalDatabaseCache'; $conf['page_cache_without_database'] = TRUE; $conf['page_cache_invoke_hooks'] = FALSE; $conf['memcache_key_prefix'] = 'somethingunique';
モニタリング
$ watch "echo stats | nc 127.0.0.1 11211" Every 2.0s: echo stats | nc 127.0.0.1 11211 Thu Dec 1 08:13:21 2016 STAT pid 5647 STAT uptime 1644 STAT time 1480598001 STAT version 1.4.25 Ubuntu STAT libevent 2.0.21-stable STAT pointer_size 64 STAT rusage_user 0.072000 STAT rusage_system 0.180000 STAT curr_connections 5 STAT total_connections 46 STAT connection_structures 7 STAT reserved_fds 20 STAT cmd_get 3457 STAT cmd_set 2901 STAT cmd_flush 0 STAT cmd_touch 0 STAT get_hits 566 STAT get_misses 2891 STAT delete_misses 34 STAT delete_hits 14 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 11465158 STAT bytes_written 17350774 STAT limit_maxbytes 67108864 STAT accepting_conns 1 STAT listen_disabled_num 0 STAT time_in_listen_disabled_us 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 9273749 STAT curr_items 2839 STAT total_items 2901 STAT expired_unfetched 0 STAT evicted_unfetched 0 STAT evictions 0 STAT reclaimed 0 STAT crawler_reclaimed 0 STAT crawler_items_checked 0 STAT lrutail_reflocked 0 END
Ref Link: