dongshai8330 2015-07-10 12:09
浏览 99
已采纳

找不到缓慢的opencart网站的原因

I have an opencart site which Ive been tasked to make faster. It takes approx 3.5 seconds to load, sometimes longer

I can rule out the following causes through trial and error.

  • It is not javascript or CSS, in fact I removed everything in header.tpl except for opening the <head> and <body> tags
  • I can be fairly sure it is not an issue with the server. I have other sites working perfectly fine, and the admin is also very fast for the same site.
  • Caching DOES work but its causing a head ache for the client and there are so many products it tends not to be effective. The client needs to clear the cache alot too. To be honest its not getting to the root of the problem either way, its more putting a plaster over it.
  • It is happening on all pages, product, category , information
  • I have tested just to make sure the issue isnt in the SQL so I change getProducts() for instance to $query = "SELECT * FROM oc_products WHERE id = 100000000000000000";. As expected it produced an empty array but still a slow load.
  • I can confirm it is NOT a slow connection to the database. I ran breakpoints (die;) throughout the system process and there is no slow down in connecting to the DB.

Finally, I began to run breakpoints through the controller itself (e.g. category.php). All was fine and fast until right after

$this->response->setOutput($this->render());die;

So putting die; before this is there is no lag, straight after there is. Keeping mind I have tried this with header.tpl, footer.tpl, column_left.tpl and column_right.tpl cleared of everything expect empty divs, not to mention I emptied the tpl files that would have been loaded, e.g. category.tpl, I am now out of ideas as to what is causing such a slow load time.

  • 写回答

1条回答 默认 最新

  • dongtu0088 2015-07-10 14:20
    关注

    Content Download, according to this is the time spent downloading the data, meaning your rendered html.

    Analyze the size of the overall html document, and see why do you spend that much time actually downloading the document.

    Regarding caching, I suggest you enable it back on since it will reduce a lot of the processing time. Learn how to deal with this, ex. clear the template cache after making changes, priming the cache after doing changes.

    If you break or die before rendering the content, the response won't be so big therefore you will get a lower "Content Download" time.

    Take the following into consideration: - your network speed - the size of the document - enable gzip encoding (this will drastically decrease the size of the response)

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

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端