dtuqxb3884
2015-06-23 14:48
浏览 52

如何在Magento中找到memcached密钥的来源

We run Magento EE 1.13 with memcached as our "fast" cache and redis for the "slow" cache. We have a certain memcached key that is getting approximately 70 get requests per second, but 0% hits. This only happens on our production site, which has multiple front end servers and a separate database server.

It seems this particular key is never set, but we can't find where the key is originating from. The key uses a md5 hash "AA_B1B5D70089938E5C32F61E616FD3908D", so that doesn't help to narrow it down.

Where can I look to track down where this key is coming from?

图片转代码服务由CSDN问答提供 功能建议

我们运行Magento EE 1.13,将memcached作为我们的“快速”缓存,并使用redis作为“慢”缓存。 我们有一个特定的memcached密钥,每秒获得大约70个get请求,但是0%命中。 这只发生在我们的生产站点上,该站点有多个前端服务器和一个单独的数据库服务器。

似乎从未设置此特定密钥,但我们找不到密钥的位置 起源于。 密钥使用md5哈希“AA_B1B5D70089938E5C32F61E616FD3908D”,因此无法缩小范围。

我在哪里可以查找此密钥的来源?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duagfgfn1981 2015-06-25 13:57
    已采纳

    I was able to figure this out. In app/code/core/Mage/Core/Model/App.php, look for:

    public function loadCache($id)
    {
        return $this->_cache->load($id);
    }
    

    Inside this function is where you want to add your temporary check:

    public function loadCache($id)
    {
        if (strstr($id, 'b1b5d70')) {
            $currentUrl = Mage::helper('core/url')->getCurrentUrl();
            $cacheId = $this->_cache->load($id);
            $stack = Varien_Debug::backtrace(true, true);
            Mage::log("Mage_Core_Model_App: " . $id, null, "memcacheKeys.log", true);
            Mage::log($currentUrl, null, "memcacheKeys.log", true);
            Mage::log($cacheId, null, "memcacheKeys.log", true);
            Mage::log($stack, null, "memcacheKeys.log", true);
        }
        return $this->_cache->load($id);
    }
    

    We are checking for the partial memcached key here, 'b1b5d70'. The key has not yet been converted to uppercase at this point. The prefix defined in local.xml, 'AA_', has also not been added yet.

    The backtrace that gets saved to your log should tell you where the key is getting generated. In my case, it traced to 'app/code/core/Mage/Catalog/Block/Product/Price.php'.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题