简体   繁体   English

缓存以减少负载 (PHP & MYSQL)

[英]Caching to reduce load (PHP & MYSQL)

im getting many hits from google, but its not like user gets always hits the same page.我从谷歌获得了很多点击,但它不像用户总是点击同一个页面。 The user gets always a different page.用户总是得到不同的页面。 So caching with memcached will not working i think cause the user reaches always a other page, which needs to generate and cached.因此,我认为使用 memcached 进行缓存将不起作用,因为用户总是到达需要生成和缓存的其他页面。

So would could i do to reduce the load from the server.那么我可以做些什么来减少服务器的负载。 I already implement sphinx search which helped me to reduce the load and the speed of the search page.我已经实现了 sphinx 搜索,它帮助我减少了搜索页面的负载和速度。

Any ideas to reduce the load?有什么减少负载的想法吗?

  • Use MySQL partitions使用 MySQL分区
  • Use opcode cacher (for example eaccelerator )使用操作码缓存器(例如eaccelerator
  • Use nginx as front-end (for all static content), apache as back-end使用 nginx 作为前端(对于所有 static 内容), apache 作为后端
  • Maybe use some NoSQL decisions也许使用一些 NoSQL 决定
  • Setup your MySQL server in the right way(for innodb )以正确的方式设置您的 MySQL 服务器(对于innodb
  • I suggest use InooDB engine for tables with many rows我建议对多行表使用 InooDB 引擎
  • Setup right index on tables在表上设置正确的索引
  • MySQL replication MySQL复制

  • You could setup some limitation for search bot's您可以为搜索机器人设置一些限制

Well there two approaches to caching web applications那么有两种缓存 web 应用程序的方法

  1. You cache the request, I mean using ob_start(), ob_flush(), etc you get the data to response, put this data to file and just response this file next time, you should take care of disk space and delete files using cron... ( benefits: decrease i/o operations and memory usage )您缓存请求,我的意思是使用 ob_start()、ob_flush() 等获取要响应的数据,将这些数据放入文件中,下次只响应此文件,您应该注意磁盘空间并使用 cron 删除文件。 ..(好处:减少 i/o 操作和 memory 使用)
  2. You can cache aggregated data in order to prevent heavy aggregation next time...您可以缓存聚合数据,以防止下次出现大量聚合...

choose))选择))

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

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