2012-04-26 52 views
0

誰能告訴我magento如何創建會話? 我有每天有600個用戶的magento,session/coockie TTL是1周。這個用戶的60%是日常用戶的復出。 會話目錄有285580個會話文件。所有文件的日期不超過1周。Magento會話

從那裏,我們有600個用戶這麼多的會議文件

所以呢?

回答

0

只是一種理論,性能欠佳機器人都(不持久Cookie IE)抓取您的網站和Magento的正在爲每個頁面視圖中創建新的會話。

比較你的Apache日誌與你會話文件確認,然後在你的/robots.txt的文件禁止違規的機器人。

+0

已經Magento的日誌(沒有阿帕奇)看它是真實的客戶資料,我可以看到 – Kudja 2012-04-26 20:11:11

+0

你的理論是:第一,我鑫卡特)))謝謝 – Kudja 2012-04-26 20:11:43

+0

我認爲這對我自己的Magento站點,大量的小會話文件通過單頁訪問「聚集」,通常在很短的時間內聚集在一起。機器人。 http://www.magentocommerce.com/boards/viewthread/265668/#t359093 – 2012-04-26 21:26:27

0

會話是PHP的會議,沒有特別的Magento。

你有幾個選擇這裏:

  1. 使用某些類型的代理爲您的服務器一樣的CloudFlare(https://www.cloudflare.com/),這有DDoS防護,因此如果問題是惡意的,這將提供對此的某種保護。

  2. 瀏覽你的apache日誌文件,並根據你的linux發行版來確定流量的來源,這將會在/ var/log/httpd/access_log之類的地方。

我用這樣的東西來得到最後20行,但是如果找不到它,就需要grep。

$ tail /var/log/httpd/access_log -n20 

然後設置一個robots.txt來限制機器人,或一個防火牆規則來阻止惡意流量。

  1. Magento允許(並鼓勵)使用Redis進行會話和緩存管理。以下local.xml示例具有10.0.0.2作爲db服務器,10.0.0.3作爲redis服務器。

    <?xml version="1.0"?> 
    <!-- 
    /** 
    * Magento 
    * 
    * NOTICE OF LICENSE 
    * 
    * This source file is subject to the Academic Free License (AFL 3.0) 
    * that is bundled with this package in the file LICENSE_AFL.txt. 
    * It is also available through the world-wide-web at this URL: 
    * http://opensource.org/licenses/afl-3.0.php 
    * If you did not receive a copy of the license and are unable to 
    * obtain it through the world-wide-web, please send an email 
    * to [email protected] so we can send you a copy immediately. 
    * 
    * DISCLAIMER 
    * 
    * Do not edit or add to this file if you wish to upgrade Magento to   newer 
    * versions in the future. If you wish to customize Magento for your 
    * needs please refer to http://www.magentocommerce.com for more   information. 
    * 
    * @category Mage 
    * @package Mage_Core 
    * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien   (http://www.varien.com) 
    * @license http://opensource.org/licenses/afl-3.0.php Academic Free   License (AFL 3.0) 
    */ 
    --> 
    <config> 
        <global> 
         <install> 
          <date><![CDATA[Wed, 18 Jan 2012 06:19:25 +0000]]></date> 
         </install> 
         <crypt> 
          <key><![CDATA[{some crypt key}]]></key> 
         </crypt> 
         <disable_local_modules>false</disable_local_modules> 
         <resources> 
          <db> 
           <table_prefix><![CDATA[]]></table_prefix> 
          </db> 
          <default_setup> 
           <connection> 
            <host><![CDATA[10.0.0.2]]></host> 
            <username><![CDATA[dbusername]]></username> 
            <password><![CDATA[dbpassword]]></password> 
            <dbname><![CDATA[dbschema]]></dbname> 
            <initStatements><![CDATA[SET NAMES utf8]]></initStatements> 
            <model><![CDATA[mysql4]]></model> 
            <type><![CDATA[pdo_mysql]]></type> 
            <pdoType><![CDATA[]]></pdoType> 
            <active>1</active> 
           </connection> 
          </default_setup> 
         </resources> 
         <session_save><![CDATA[db]]></session_save> 
         <redis_session> 
          <host>10.0.0.3</host> 
          <port>6379</port> 
          <password>redispassword</password> 
          <timeout>2.5</timeout> 
          <persistent></persistent> 
          <db>2</db> 
          <compression_threshold>2048</compression_threshold> 
          <compression_lib>gzip</compression_lib> 
          <log_level>1</log_level> 
          <max_concurrency>6</max_concurrency> 
          <break_after_frontend>5</break_after_frontend> 
          <break_after_adminhtml>30</break_after_adminhtml> 
          <bot_lifetime>7200</bot_lifetime> 
         </redis_session> 
        <cache> 
         <backend>Mage_Cache_Backend_Redis</backend> 
         <backend_options> 
          <server>10.0.0.3</server> 
          <port>6379</port> 
          <persistent></persistent> 
          <database>1</database> 
          <password>redispassword</password> 
          <force_standalone>0</force_standalone> 
          <connect_retries>3</connect_retries>    
          <read_timeout>10</read_timeout>       
          <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> 
          <use_lua>0</use_lua> 
         </backend_options> 
        </cache>  
    </global> 
        <admin> 
         <routers> 
          <adminhtml> 
           <args> 
            <frontName><![CDATA[admin]]></frontName> 
           </args> 
          </adminhtml> 
         </routers> 
        </admin> 
    </config> 
    

除此之外,你總是可以看看你的會話超時,看到他們都一週了下,好像有一些會議的清潔事,但至於爲什麼有這麼很多會話,它可能來自設置不良的負載平衡器(可能會在客戶端看到會話/購物車問題),或類似PHP的超時問題。無外掛,無掃描IP的 - -