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?

  • 写回答

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'.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化