为什么 memcached 服务器运行缓慢

为什么 memcached 服务器运行缓慢

我正在使用 memcached 为我的项目进行 html 缓存,但是检索数据和响应花费了太多时间。

服务器状态:8 GB RAM,centos,php 客户端

这是我的设置:

echo“统计设置”| nc localhost 11211

STAT maxbytes 1073741824
STAT maxconns 1024
STAT tcpport 11211
STAT udpport 11211
STAT inter NULL
STAT verbosity 0
STAT oldest 0
STAT evictions on
STAT domain_socket NULL
STAT umask 700
STAT growth_factor 1.25
STAT chunk_size 48
STAT num_threads 4
STAT num_threads_per_udp 4
STAT stat_key_prefix :
STAT detail_enabled no
STAT reqs_per_event 20
STAT cas_enabled yes
STAT tcp_backlog 1024
STAT binding_protocol auto-negotiate
STAT auth_enabled_sasl no
STAT item_size_max 1048576
STAT maxconns_fast no
STAT hashpower_init 0
STAT slab_reassign no
STAT slab_automove 0
STAT lru_crawler no
STAT lru_crawler_sleep 100
STAT lru_crawler_tocrawl 0
STAT tail_repair_time 0
STAT flush_enabled yes
STAT hash_algorithm jenkins
STAT lru_maintainer_thread no
STAT hot_lru_pct 32
STAT warm_lru_pct 32
STAT expirezero_does_not_evict no
STAT idle_timeout 0
STAT watcher_logbuf_size 262144
STAT worker_logbuf_size 65536
STAT track_sizes no
END

统计数据:

STAT pid 18323
STAT uptime 1212522
STAT time 1469217836
STAT version 1.4.27
STAT libevent 1.4.13-stable
STAT pointer_size 64
STAT rusage_user 152.445824
STAT rusage_system 59.193001
STAT curr_connections 10
STAT total_connections 12001
STAT connection_structures 25
STAT reserved_fds 20
STAT cmd_get 9410
STAT cmd_set 991
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 7788
STAT get_misses 1622
STAT get_expired 400
STAT delete_misses 102299
STAT delete_hits 117
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 48695566
STAT bytes_written 322383597
STAT limit_maxbytes 1073741824
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 log_worker_dropped 0
STAT log_worker_written 0
STAT log_watcher_skipped 0
STAT log_watcher_sent 0
STAT bytes 5948426
STAT curr_items 131
STAT total_items 991
STAT expired_unfetched 188
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 340
STAT crawler_reclaimed 0
STAT crawler_items_checked 0
STAT lrutail_reflocked 0
END

答案1

您是否尝试过增加 中的内存和连接限制/etc/sysconfig/memcached。以下是我在具有 4GB RAM 的服务器上使用的方法。
对于连接,您还需要增加/etc/security/limits.confmemcached 用户的限制。

PORT="11211"
USER="memcached"
MAXCONN=2048
CACHESIZE="3584"
OPTIONS="-vv"

相关内容