我正在使用 Centos 6.5 64 位内核 2.6.32 和 64 GB RAM 以及 12 个线程核心的服务器,并且无法增加 memcache 中使用的当前连接数。
这是我的统计输出:
# echo stats | nc 127.0.0.1 11211
STAT pid 356091
STAT uptime 440
STAT time 1409760961
STAT version 1.4.20
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 1.747734
STAT rusage_system 3.660443
STAT curr_connections 64
STAT total_connections 133
STAT connection_structures 64
STAT reserved_fds 60
STAT cmd_get 123537
STAT cmd_set 63080
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 73162
STAT get_misses 50375
STAT delete_misses 8979
STAT delete_hits 1090
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 68155115
STAT bytes_written 181284445
STAT limit_maxbytes 17179869184
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 12
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT bytes 20493483
STAT curr_items 17980
STAT total_items 63080
STAT expired_unfetched 145
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 147
STAT crawler_reclaimed 0
END
我的 ulimit 输出(我不知道是否达到某些系统配置)
# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 515008
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 999999
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 65535
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
我的 memcached 配置
# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="2048"
CACHESIZE="16384"
OPTIONS="-t 12 -l 127.0.0.1"
当前服务器每秒的访问量超过6k-7k,因此用户少没有问题,并且只连接了64个memcache连接。
我应该更改哪个参数才能将 STAT curr_connections 64 增加到上限?
答案1
尝试查看 memcached 用户的 ulimit。类似这样的内容:
su memcached -s /bin/bash ulimit -a