如何将joomla加速到1秒以下?
我激活了 joomla debug 并得到了以下信息。我不明白为什么生成页面需要将近 2 秒?
Application 0.000 seconds (+0.000); 0.99 MB (+0.989) - afterLoad
Application 0.145 seconds (+0.145); 6.75 MB (+5.758) - afterInitialise
Application 0.751 seconds (+0.605); 7.05 MB (+0.305) - afterRoute
Application 0.766 seconds (+0.015); 9.62 MB (+2.565) - afterDispatch
Application 1.376 seconds (+0.609); 10.04 MB (+0.426) - beforeRenderModule mod_search (Search)
Application 1.379 seconds (+0.003); 10.11 MB (+0.070) - afterRenderModule mod_search (Search)
Application 1.704 seconds (+0.325); 10.06 MB (-0.058) - beforeRenderModule mod_languages (Language)
Application 1.706 seconds (+0.002); 10.08 MB (+0.022) - afterRenderModule mod_languages (Language)
Application 1.993 seconds (+0.287); 10.15 MB (+0.077) - beforeRenderModule mod_menu (Main Menu EN)
Application 1.997 seconds (+0.004); 10.30 MB (+0.145) - afterRenderModule mod_menu (Main Menu EN)
Application 2.233 seconds (+0.236); 10.39 MB (+0.087) - afterRender
细节: - 网站托管在 debian 上,使用 nginx+php-fpm+APC+mysql,流量低,每天 1-2 个访问者
正如您在输出中看到的,生成页面需要 2.233 秒,我认为它有一些事情要做与数据库,但我不明白为什么......我什至使用unix套接字连接到mysql服务器:|
图像和其他静态文件加载速度非常快(使用 firebug 测试)
I activated joomla debug and got the following. and i can not understand why it takes almost 2 seconds to generate the page?
Application 0.000 seconds (+0.000); 0.99 MB (+0.989) - afterLoad
Application 0.145 seconds (+0.145); 6.75 MB (+5.758) - afterInitialise
Application 0.751 seconds (+0.605); 7.05 MB (+0.305) - afterRoute
Application 0.766 seconds (+0.015); 9.62 MB (+2.565) - afterDispatch
Application 1.376 seconds (+0.609); 10.04 MB (+0.426) - beforeRenderModule mod_search (Search)
Application 1.379 seconds (+0.003); 10.11 MB (+0.070) - afterRenderModule mod_search (Search)
Application 1.704 seconds (+0.325); 10.06 MB (-0.058) - beforeRenderModule mod_languages (Language)
Application 1.706 seconds (+0.002); 10.08 MB (+0.022) - afterRenderModule mod_languages (Language)
Application 1.993 seconds (+0.287); 10.15 MB (+0.077) - beforeRenderModule mod_menu (Main Menu EN)
Application 1.997 seconds (+0.004); 10.30 MB (+0.145) - afterRenderModule mod_menu (Main Menu EN)
Application 2.233 seconds (+0.236); 10.39 MB (+0.087) - afterRender
details:
- Website hosted on debian with nginx+php-fpm+APC+mysql with low traffic 1-2 visitors a day
as you can see in the output it takes 2.233 seconds to generate the page, i think it has somenthing to do with the database, but I do not understand why...i even made the connection to mysql server using unix sockets:|
images and other static files load pretty fast(tested with firebug)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Berndinox 所说,有很多方法可以帮助优化。你的图片优化了吗?你的模板优化了吗?它是一个轻量级模板吗?它是否承载了大量的查询?如果不知道发生了什么,就很难排除故障。
如果您要加载大量大图像,则可能需要一些时间才能加载。有很多工具(例如,谷歌页面速度)可以帮助分析事物,并让您更好地了解可以修改的区域、可能运行缓慢(或已弃用等)的规则、未优化等。它确实可以帮助您使您的模板/网站变得时尚。
此外,托管是必须的。你绝对需要一个好的主人。不良主机会无缘无故地导致长时间延迟,除了服务器超载之外。你没有提到你的主人是谁 - 所以再说一次,只是我们不知道其他事情,所以很难回答。
希望这个东西有帮助。
As Berndinox said - there are plenty of ways to help optimize. Are your images optimized? Is your template optimized? Is it a lightweight template? Is it loaded down with tons of queries? Without knowing what's going on with it - it's difficult to troubleshoot.
If you're loading tons of large weight images, it can take a bit to load. There are a lot of tools out there (for example, google page speed) that help to analyze things and give you a better idea of areas where you can modify, rules that may be running slowly (or are deprecated, etc), images that aren't optimized, etc. It can really help to make your template/site sleek.
Also, hosting is a MUST. You absolutely NEED a good host. A bad host will cause long delays for no reason other than an overloaded server. You didn't mention who your host is - so again, just something else we don't know so it's tough to answer.
Hope this stuff helps.
不知道您是否仍在为此苦苦挣扎 - 但最好的猜测是数据库。您的调试输出是否计算了 sql 查询的数量?
您是否调整了 MySQL - 使用开箱即用的 my.cnf 以外的设置设置 my.cnf - 可能使用 large.cnf 或巨大的.cnf?
你记录慢速查询吗?如果没有,那么就这样做,如果是,那么检查日志。可能需要向数据库表添加一些额外的索引以加快某些查询的速度。
您尝试过mysqltuner.pl 或tuning-primer.sh 吗?这些可以帮助发现错误配置,并提供有关调整缓存大小、连接数量等的建议。您是否使用 MySQLi 或 PHP 中的普通 MySQL 连接进行连接?
PHP 的内存限制也起到了一定作用 - 请在 php.ini 中检查这些限制。
我相信如果需要的话我可以提出更多建议。
Don't know if you are still struggling with this - but best guess is the database. Did your debug output count the number of sql queries?
Have you tuned MySQL - set up the my.cnf with settings other than the out of the box my.cnf - perhaps using large.cnf or huge.cnf?
Do you log slow queries? If not then do so, if you do then check the log. It might be necessary to add a few additional indexes to the db tables to speed up some queries.
Have you tried mysqltuner.pl or tuning-primer.sh? These can help spot misconfigurations and provide advice about tuning cache sizes the number of connections etc. Are you connecting using MySQLi or plain MySQL connections from PHP?
PHP's memory limits can also play a part - check these in php.ini.
I'm sure I can come up with many more suggestions if needed.