简体   繁体   English

哪种类型的缓存更适合用来提高网站的性能?

[英]What type of cache better to use to improve performance of website?

I have high-load informative website with 10 000+ hits/day. 我的网站内容丰富,每天的点击量超过1万次。 It was rewritten on Symfony 2 Framework with Doctrine2 ORM . 已使用Doctrine2 ORMSymfony 2 Framework上对其进行了重写。 Site have heavy informative pages, each load on development server 0.5 - 1.5 seconds approximately. 网站上有大量的信息页面,每个在开发服务器上的负载大约为0.5-1.5秒。 Note, that it time on development server , so it has minimal load. 请注意,它的时间在开发服务器上 ,因此负载最小。

I know there are many cache providers such as Varnish, Memcached, APC, HTTP, etc... Please, suggest me on what layer ( DB , HTTP , etc...) and what type of cache better to use for improve performance of this site? 我知道有很多缓存提供程序,例如Varnish,Memcached,APC,HTTP等...,请向我建议在哪一层( DBHTTP等)以及哪种类型的缓存更适合用于提高性能。这个网站?

Like @Mark said in the comment, " there is no best answer to such an open-ended question ". 就像@Mark在评论中说的那样,“ 对这样一个开放性问题没有最佳答案 ”。 At first, let's find the what : which component is the system bottleneck, DB, HTTP response, javascript...? 首先,让我们找到什么 :系统瓶颈,数据库,HTTP响应,javascript ...是哪个组件?

And in each component, there are other questions: 在每个组件中,还有其他问题:

  • DB : Which queries slow the system down (Hint: using Log Slow Query)? DB :哪些查询会降低系统速度(提示:使用Log Slow Query)? Can we refator those? 我们可以反驳那些吗? (This is often the key factor, given that it's informative website) What is the result of MySQL Explain or other alternatives? (鉴于它是信息丰富的网站,所以这通常是关键因素) MySQL Explain或其他替代方法的结果是什么?
  • HTTP response : Does it take unreasonably much time to transport rendered content to client machine? HTTP响应 :将渲染的内容传输到客户端计算机是否花费不合理的时间? (Hint: using Web Developer Tools or even cUrl). (提示:使用Web Developer Tools甚至使用cUrl)。 Does it load the static files over and over again without utilizing the HTTP cache? 是否不使用HTTP缓存一遍又一遍地加载静态文件? Does using Nginx caching help? 使用Nginx缓存有帮助吗?
  • Javascript : Are there any scripts that block browser from rendering the page? Javascript :是否有任何脚本阻止浏览器呈现页面? Are there any errors caused by conflicts of scripts (which will add up the waiting time for sure)? 是否有由于脚本冲突引起的错误(肯定会增加等待时间)?

.... ....

Let's have the checklist, which list those questions <--> answers. 让我们看一下清单,其中列出了这些问题<->答案。 The answer for " what type of cache better to use for improve performance of this site " TOTALLY DEPENDS on those. 答案是“ 哪种类型的缓存更好地用于提高本网站的性能完全取决于这些。

Somewhere to reference: 参考的地方:

And I recommend a very very good book: Scale PHP Application , in which you can learn real use cases, how to debug, how to profile.. 而且我推荐一本非常非常好的书: Scale PHP Application ,在其中您可以学习实际的用例,如何调试,如何进行概要分析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM