Magento Enterprise-持续的Redis连接错误


9

Enterprise 1.14.1.0,nginx,php-fpm,solr,redis(2个实例-一个用于fpc,另一个用于其他所有功能)

我们完全处于机智的境地-我们已经对似乎合理的每个配置设置进行了调整,而且这一问题每天都持续存在。任何想法将不胜感激。

我们的网站经历了Redis锁定并倾销此类错误的情况,持续了几分钟,然后一切恢复正常。

 a:4:{i:0;s:24:"read error on connection";i:1;s:1196:"#0 /var/www/magento/lib/Credis/Client.php(440): Credis_Client->__call('select', Array)
#1 /var/www/magento/lib/Cm/Cache/Backend/Redis.php(117): Credis_Client->select(0)
#2 /var/www/magento/lib/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array)
#3 /var/www/magento/lib/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true)
#4 /var/www/magento/app/code/local/Extendware/EWCacheBackend/Model/Override/Mage/Core/Cache.php(25): Zend_Cache::factory()
#5 /var/www/magento/app/code/core/Mage/Core/Model/Config.php(1348): ExtendwareInternal_EWCacheBackend_Model_Override_Mage_Core_Cache->__construct(Array)
#6 /var/www/magento/app/Mage.php(463): Mage_Core_Model_Config->getModelInstance('core/cache', Array)
#7 /var/www/magento/app/code/core/Mage/Core/Model/App.php(401): Mage::getModel('core/cache', Array)
#8 /var/www/magento/app/code/core/Mage/Core/Model/App.php(295): Mage_Core_Model_App->_initCache(Array)
#9 /var/www/magento/app/code/core/Mage/Core/Model/App.php(337): Mage_Core_Model_App->baseInit(Array)
#10 /var/www/magento/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#11 /var/www/magento/index.php(87): Mage::run('default', 'store')
#12 {main}";s:3:"url";s:48:"/";s:11:"script_name";s:10:"/index.php";}
  • Magento支持人员已经从Magento方面确认了正确的配置(他们已登录,进行了调查,进行了测试,并声称这是“服务器问题”,而不是Magento问题)
  • 我们的主持人(Peer1)有一些Magento专家,他们花了很多时间与我们合作来诊断问题……但仍找不到与RAM,redis配置等资源有关的任何特定问题。
  • 我们的RAM已增加一倍,达到64 GB,目前我们有大约20 GB的可用RAM。
  • PHP,PHP-FPM正在消耗大量CPU
  • 这一切都在Web服务器上,数据库服务器是独立的并且运行良好

这是正常操作期间Top的快照(当未发生错误时)

top - 12:13:47 up 2 days, 16:05,  2 users,  load average: 6.51, 7.33, 7.26
Tasks: 639 total,  13 running, 625 sleeping,   0 stopped,   1 zombie
Cpu(s): 47.7%us,  1.1%sy,  0.0%ni, 50.9%id,  0.0%wa,  0.0%hi,  0.2%si,  0.0%st
Mem:  65937660k total, 41186844k used, 24750816k free,   551968k buffers
Swap:  8388604k total,        0k used,  8388604k free, 13040128k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                          
29720 nginx     20   0 1927m 553m  12m R 99.6  0.9 615:37.52 php                                                                              
 8638 nginx     20   0 1532m 146m 9236 R 98.3  0.2   4:01.43 php-fpm                                                                          
 8618 nginx     20   0 1582m 195m 8268 R 96.3  0.3   4:06.96 php-fpm                                                                          
 8664 nginx     20   0 1521m 144m 6932 S 96.0  0.2   4:12.06 php-fpm                                                                          
 8699 nginx     20   0 1582m 196m 9508 R 94.0  0.3   3:33.90 php-fpm                                                                          
 8740 nginx     20   0 1581m 194m 8188 R 94.0  0.3   4:05.63 php-fpm                                                                          
 8735 nginx     20   0 1583m 196m 9204 R 90.4  0.3   4:27.89 php-fpm                                                                          
 8634 nginx     20   0 1582m 195m 8080 R 81.4  0.3   4:07.25 php-fpm                                                                          
 8727 nginx     20   0 1529m 141m 9076 S 73.8  0.2   4:54.04 php-fpm                                                                          
 8597 nginx     20   0 1529m 143m 8020 S 62.6  0.2   3:56.57 php-fpm                                                                          
 8743 nginx     20   0 1518m 132m 9204 R 51.0  0.2   4:10.01 php-fpm                                                                          
 8601 nginx     20   0 1517m 132m 9284 S 48.7  0.2   4:04.32 php-fpm                                                                          
 8611 nginx     20   0 1530m 143m 8104 S 38.7  0.2   4:12.82 php-fpm                                                                          
 8614 nginx     20   0 1511m 124m 8216 R 28.1  0.2   3:26.96 php-fpm                                                                          
 8714 nginx     20   0 1532m 145m 8260 S 27.5  0.2   4:15.64 php-fpm                                                                          
 8684 nginx     20   0 1528m 142m 8232 R 22.8  0.2   4:01.39 php-fpm                                                                          
 8700 nginx     20   0 1519m 142m 5216 R 22.8  0.2   4:44.06 php-fpm                                                                          
 8691 nginx     20   0 1532m 146m 8208 R 19.5  0.2   4:32.76 php-fpm                                                                          
 8622 nginx     20   0 1533m 146m 8216 S 16.2  0.2   4:57.07 php-fpm                                                                          
 9134 redis     20   0  880m 175m  888 S  4.6  0.3  36:39.15 redis-server                                                                     
 9112 redis     20   0 1192m 354m  880 S  2.6  0.6  57:50.85 redis-server                                                                     
 8566 nginx     20   0 93340 5084 1784 S  1.0  0.0   0:02.75 nginx   

这是我们用于Redis的Magento配置:

<!-- redis cache -->
<cache>
    <backend>Cm_Cache_Backend_Redis</backend>
    <backend_options>
        <server>127.0.0.1</server>
        <port>6379</port>
        <database>0</database>
        <password></password>
        <force_standalone>0</force_standalone> 
        <connect_retries>1</connect_retries>
        <automatic_cleaning_factor>0</automatic_cleaning_factor>
        <compress_data>1</compress_data>
        <compress_tags>1</compress_tags>
        <compress_threshold>20480</compress_threshold>
        <compression_lib>gzip</compression_lib>
        <persistent></persistent>
        <read_timeout>10</read_timeout>
    </backend_options>
</cache>
<!-- redis full page cache -->
<full_page_cache>
    <backend>Cm_Cache_Backend_Redis</backend>
    <backend_options>
        <server>127.0.0.1</server>
        <port>6380</port>
        <database>1</database>
        <password></password>
        <force_standalone>0</force_standalone>
        <connect_retries>1</connect_retries>
        <automatic_cleaning_factor>0</automatic_cleaning_factor>
        <compress_data>0</compress_data>
        <lifetimelimit>57600</lifetimelimit>
        <persistent></persistent>
        <read_timeout>10</read_timeout>
    </backend_options>
</full_page_cache>

我查看了Redis慢日志,发现大量(看似)大量的保存需要一段时间。...请注意,只有全页缓存实例在慢日志中具有任何条目。这些正常吗? 这些是整页缓存实例。这是慢速日志中250个条目的两个示例:

 7) 1) (integer) 356
    2) (integer) 1429287105
    3) (integer) 40685
    4)  1) "DEL"
        2) "zc:k:e84_REQEST_91D0FF548C77B6F58148AF6A7F586C58"
        3) "zc:k:e84_REQEST_8212780F50033B79092F556EE14C1E6E"
        4) "zc:k:e84_REQEST_86DCFE6E580707552F38B507272FD2FA"
        5) "zc:k:e84_REQEST_FE69215CAA18AA2D33DE6DE2E31F7491"
        6) "zc:k:e84_1ED6001E13E4EEA9AB6E19EEC6742A89_1_3_745"
        7) "zc:k:e84_REQEST_45ACA3435B0016847D4B060C6436B366"
        8) "zc:k:e84_REQEST_985ED12A38AFD74402B159AF8B1B5741"
        9) "zc:k:e84_REQEST_11022B655050F20ED54B4AE51EF12CE6"
       10) "zc:k:e84_REQEST_26CA3F7EA8612325E845B3B236E0CCFE"
       11) "zc:k:e84_REQEST_646FBF4016B630643F3D06C2162721F6_METADATA"
       12) "zc:k:e84_REQEST_29C5D2EC342997382A7DB7DF7DDD2F6D"
       13) "zc:k:e84_REQEST_F8A6D1AF029997A51F3D1A4E2F3CB725"
       14) "zc:k:e84_REQEST_8DBB0D20DDFC426B089F52432757C47E"
       15) "zc:k:e84_REQEST_5EA7B23B0B309045EB6A81EF4B9E6A66_METADATA"
       16) "zc:k:e84_REQEST_EA531324268EF209504816504B114FAC"
       17) "zc:k:e84_REQEST_7C659A3F9178A62AED9B0499AEED0130"
       18) "zc:k:e84_REQEST_6807CA64C0FF1C29B4069BF3B472252B"
       19) "zc:k:e84_8C636CBFA6DB338DD11F600771E54FAC_1_3_43_288"
       20) "zc:k:e84_REQEST_E062EAC26446FACE3025FC6AE1E632A9"
       21) "zc:k:e84_7D5DE581F27790730C0E000F9D69F2E3_1_3_53_53"
       22) "zc:k:e84_REQEST_C4F854BA432A2884E49A1BA245D756A5"
       23) "zc:k:e84_REQEST_922C03E387E66DF9EBBCE0186BD67C3C"
       24) "zc:k:e84_REQEST_503B90ED3CBE43438A0C740A68B1E576_METADATA"
       25) "zc:k:e84_REQEST_7B9B9FAAE5FA78DB6934DC0658BC5D83"
       26) "zc:k:e84_REQEST_E8FE8236DDA57C9830B7843623310E86"
       27) "zc:k:e84_REQEST_5826188B159CBCD0E7E9BFBE3BB1D599"
       28) "zc:k:e84_REQEST_37F7CBE45FEF49E4D7F38ECE4B760996"
       29) "zc:k:e84_REQEST_AACD280C3AB5E27760E80A4D1888AD1F"
       30) "zc:k:e84_REQEST_47CE15DD5D5391B1413F5ECF150533DB"
       31) "zc:k:e84_REQEST_E261C23C996BC8D45111F2A23DDED93A"
       32) "... (1633 more arguments)"
10) 1) (integer) 353
    2) (integer) 1429285945
    3) (integer) 37193
    4)  1) "DEL"
        2) "zc:k:e84_REQEST_92BAB7E07D28861B459120B0CDCF0AD7"
        3) "zc:k:e84_REQEST_32FC6F43EABA88A2E665630C189A751C"
        4) "zc:k:e84_REQEST_55E596F3198540E5E249CB2A4C2690D1"
        5) "zc:k:e84_REQEST_B5F8BD16ED9D77245DC1FE0201FE1B1B"
        6) "zc:k:e84_REQEST_CBBFFAEAABE47237EF465B6D00BE39F7"
        7) "zc:k:e84_REQEST_D5BD191B4E0389F1C60271CCD33163BE"
        8) "zc:k:e84_1ED6001E13E4EEA9AB6E19EEC6742A89_1_3_745"
        9) "zc:k:e84_REQEST_E498601DC7D6D799B358A8B5A86FC783"
       10) "zc:k:e84_REQEST_6A6D07696354D06F1414F3F7A5A3967A"
       11) "zc:k:e84_REQEST_EB6E820EA5D8598C008BA4A94C2AC904"
       12) "zc:k:e84_REQEST_EEACD0C782C80044325B4E04D32E0F34"
       13) "zc:k:e84_REQEST_8CD8334B055C58AD92208DB9BE0F9D1D_METADATA"
       14) "zc:k:e84_REQEST_70EFDB6D70BE88D367B0C48629E561FE"
       15) "zc:k:e84_REQEST_B9FF6FA7A3CFE8B1F1521A73DF71D308"
       16) "zc:k:e84_REQEST_14310D5749525D4828E6B6D2F090A366"
       17) "zc:k:e84_REQEST_0CE5E095669A57D17FD780A3BA72A84F_METADATA"
       18) "zc:k:e84_REQEST_28B2C39A828640D0B1A49E77A56F6A09"
       19) "zc:k:e84_REQEST_17EF76BC89E5EE5DDDB0D752514BBCC4"
       20) "zc:k:e84_REQEST_76B91839CA4F29C45E4628C67A8FEFDE"
       21) "zc:k:e84_REQEST_F4D7B7D455BF29C8A281D6CC387A86D9"
       22) "zc:k:e84_7878AC51A7ECCF1F57E2E74B6FF3CD20_1_3_10_750"
       23) "zc:k:e84_REQEST_90B19F2BBC6EA90C7AC1F91242C316A8"
       24) "zc:k:e84_8C636CBFA6DB338DD11F600771E54FAC_1_3_43_288"
       25) "zc:k:e84_REQEST_0C95AC5E87D3F74F62A1FBE5B822A9B2"
       26) "zc:k:e84_7D5DE581F27790730C0E000F9D69F2E3_1_3_53_53"
       27) "zc:k:e84_REQEST_3B852462504D3226F5F73D387C0C250F"
       28) "zc:k:e84_REQEST_5A5403A3603FD208332F9CBD631C8B4B_METADATA"
       29) "zc:k:e84_REQEST_B8152798A9D1F3C4C45C876FC9F2942A"
       30) "zc:k:e84_REQEST_2E12C5B2DD8B55BB5D4343DF9241EA29"
       31) "zc:k:e84_REQEST_B241A180FBB7E511A74C2129667C2BAD"
       32) "... (3272 more arguments)"


首先-升级redis和phpredis,然后将压缩lib更改为lzf或snappy,然后由于错误的代码,PHP-FPM消耗了大量CPU,或者您的某个地方运行了恶性循环,运行了探查器或数据库监视,并且仅供参考-在PEER1,没有专家,不幸的是,他们能做的一切都是强迫客户购买昂贵的昂贵服务器,以希望大量内存可以解决这些问题……

我可以看看你/etc/php-fpm.d/www.conf吗?
DarkMukke '16

这就是为什么在生产环境中运行时,人们通常拥有多于一台服务器。通常情况下,1个具有大量CPU的WEB,1个具有大量RAM的DB和1个具有大量CPU和大量RAM的CACHE(redis,清漆...)。
Toan Nguyen

您是否尝试将<connect_retries> 1 </ connect_retries>提高到更高的数字,例如3?
AnnaVölkl'17

Answers:


1

您可以尝试检查网络连接限制。我们已经看到这种情况发生在某些东西打开与Redis的大量连接,并停止进一步的连接,然后自行消失之前。错误消息具有欺骗性,因为它们不会说出来,并且需要花一些时间才能真正弄清楚。

即Redis只能有那么多打开的连接,就像您在特定设置中的给定服务一样,因此如果您单击它,它将不会直接出现在任何Magento / Redis日志中。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.