Frequently Asked Questions

How do I improve the performance of Magento? 如何設定提升Magento的軟件效能?
Last Updated 7 months ago

Magento has most of its functionality turned on by default, but some will not be applicable to your store, you can disable those functions to speed up your Magento website.

Especially, Magento designs the log saving in the MySQL database which consumes lots of resources (e.g. CPU load, memory, storage), this logging is completely useless and redundant because all Nethub's servers have full logging and website statistics of your website.

Enable this logging also slows down your website as well as the server, so that logging function should be turned off while you are using Magento.

To turn off the logging function in Magento:
  1. Use Notepad to edit the source file /app/code/core/Mage/Log/Model/Visitor.php in your Magento.
  2. Find the below coding in the visitor.php .
    protected $_skipRequestLogging = false;
    modify as
    protected $_skipRequestLogging = true;
  3. Use Notepad to edit the source file /app/code/core/Mage/Reports/etc/config.xml in your Magento
  4. Delete the below coding in the config.xml
    [catalog_controller_product_view]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]catalogProductView[/method]
    [/reports]
    [/observers]
    [/catalog_controller_product_view]
    [sendfriend_product]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]sendfriendProduct[/method]
    [/reports]
    [/observers]
    [/sendfriend_product]
    [catalog_product_compare_add_product]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]catalogProductCompareAddProduct[/method]
    [/reports]
    [/observers]
    [/catalog_product_compare_add_product]

    [wishlist_add_product]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]wishlistAddProduct[/method]
    [/reports]
    [/observers]
    [/wishlist_add_product]

  5. Upload the visitor.php and config.xml via FTP and overwrite the original file.
If you database has already grown to big size, you can login to your MySQL database and run commands to delete log data:
TRUNCATE log_customer;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;




預設地Magento把它的大部分功能開啟了, 但有些是不適用您的商店的, 你可以停用那些功能以提升你的Magento網站.

尤其Magento設計時把網頁訪客存取紀錄儲存到MySQL資料庫內, 這會消耗很多的資源 (如: CPU負載, 記憶體, 硬磁容量), 這種紀錄是完全沒有用處並且是累贅的, 因為網匯在線的所有伺服器都有您的網站的完整紀錄和詳盡網站流量統計表.

啟用這種紀錄更會令你的網站和伺服器變得緩慢, 因此當你使用Magento時應該把紀錄功能關掉.

要關掉網頁訪客存取紀錄儲存於數據庫內的功能:

  1. 使用記事本開啟Magento的原始檔 /app/code/core/Mage/Log/Model/Visitor.php 進行編輯
  2. 於 visitor.php 檔案內尋找以下句子
    protected $_skipRequestLogging = false;
    改成
    protected $_skipRequestLogging = true;
  3. 使用記事本開啟Magento的原始檔 /app/code/core/Mage/Reports/etc/config.xml 進行編輯
  4. 於 config.xml 檔案內把以下內容刪除
    [catalog_controller_product_view]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]catalogProductView[/method]
    [/reports]
    [/observers]
    [/catalog_controller_product_view]
    [sendfriend_product]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]sendfriendProduct[/method]
    [/reports]
    [/observers]
    [/sendfriend_product]
    [catalog_product_compare_add_product]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]catalogProductCompareAddProduct[/method]
    [/reports]
    [/observers]
    [/catalog_product_compare_add_product]

    [wishlist_add_product]
    [observers]
    [reports]
    [class]reports/event_observer[/class]
    [method]wishlistAddProduct[/method]
    [/reports]
    [/observers]
    [/wishlist_add_product]


  5. 使用FTP上載 visitor.php 和 config.xml 至伺服器上及取代原來檔案.
如果你的數據庫已增長至非常大, 你可以登入你的MySQL數據庫並執行以下指令刪除紀錄數據:
TRUNCATE log_customer;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;

Please Wait!

Please wait... it will take a second!