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)

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

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)