标签: libketama

Memcached一致性散列不能与4个服务器中的3个一起使用

故事

我有3个memcached服务器运行,我关闭其中一个,以调查PHP-memcached在服务器无法访问时的行为方式.

我在PHP中定义了4个服务器,1个用于模拟大部分离线的服务器(备用服务器).当我关闭1台服务器(=> 2仍在线)时,第三台->get()给我一个结果.

当我再关闭一台服务器(=> 1仍在线)时,它将找不到推送到最后一台服务器的对象.

样本输出

首次运行,4台服务器中的3台:

Entity not found in cache on 1st try: NOT FOUND
Entity not found in cache on 2nd try: NOT FOUND
Entity not found in cache on 3rd try: NOT FOUND
Entity not found in cache on 4th try: NOT FOUND
Run Code Online (Sandbox Code Playgroud)

第二次运行,4台服务器中的3台:

Entity found in Cache: SUCCESS
Run Code Online (Sandbox Code Playgroud)

第三次运行,4台服务器中的2台:

Entity not found in cache on 1st try: CONNECTION FAILURE
Entity not found in cache on 2nd try: SERVER IS MARKED DEAD
Entity …
Run Code Online (Sandbox Code Playgroud)

php memcached caching consistent-hashing libketama

11
推荐指数
1
解决办法
497
查看次数

标签 统计

caching ×1

consistent-hashing ×1

libketama ×1

memcached ×1

php ×1