小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

php-css和JS文件下載時間太長

 印度阿三17 2019-05-19

我有一個在linux服務器上用cakephp編寫的網(wǎng)站.我的css和js文件的下載時間非常慢,我遇到了問題.例如,在加載我的主頁時,這就是chrome中的網(wǎng)絡選項卡:

enter image description here

如您所見,我的一個css文件花了59秒下載!重要的是要注意它并不總是相同的css文件.有時它的JS文件,有時是其他css,但它們必須在顯示頁面的其他內(nèi)容之前下載,因此它們會阻止頁面加載.由于等待下載該文件,因此網(wǎng)站不會顯示59秒.

我檢查了我的服務器,它的負載非常低,cpu運行10%,并且使用的ram不到20%.它是一個帶有以下prefork設置的apache服務器:

StartServers       10
MinSpareServers    10
MaxSpareServers    20
ServerLimit        256
MaxClients         256
MaxRequestsPerChild  10000

這提到的下載時間很慢,網(wǎng)站上可能有3-4個同時用戶.我在AppM下使用appdynamics我的應用程序,沒有任何可疑的顯示在那里.我用服務器管理員檢查了php.ini文件,一切似乎都很好.我可以使用哪些其他軟件來查找此問題的來源? apache日志中的信息也不多.

任何建議將不勝感激

編輯:

我將所有資產(chǎn)都移到了webroot,并在另一個使用同一服務器的域上獲得了這些結果:

enter image description here

正如您所看到的,這次它的jquery文件需要27秒才能下載.它存儲在app / webroot中

解決方法:

Ill take a look at serving assets from webroot

始終將公共資產(chǎn)放在webroot中.

From the book(重點補充):

It’s a well known fact that serving assets through PHP is guaranteed to be slower than serving those assets without invoking PHP. And while the core team has taken steps to make plugin and theme asset serving as fast as possible, there may be situations where more performance is required. In these situations it’s recommended that you either symlink or copy out plugin/theme assets to directories in app/webroot with paths matching those used by CakePHP.

  • app/Plugin/DebugKit/webroot/js/my_file.js becomes app/webroot/debug_kit/js/my_file.js
  • app/View/Themed/Navy/webroot/css/navy.css becomes app/webroot/theme/Navy/css/navy.css

根據(jù)許多因素,“較慢”可以介于幾乎不可察覺到幾乎無法使用的任何地方.

此建議不是特定于版本的,并且?guī)缀蹩偸沁m用.為了加快資產(chǎn)加載速度,讓網(wǎng)絡服務器為您處理這些問題.

來源:http://www./content-1-197951.html

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多