2012-04-26 55 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的 - -