在PHP中,每页可以执行多少个DB调用? [英] In PHP, how many DB calls per page is okay?

查看:73
本文介绍了在PHP中,每页可以执行多少个DB调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在LAMP设置上共享了主机.显然,每页对Db的调用越少越好.但是多少是多少?二?十?一百?很好奇人们的想法.

I've got shared hosting on a LAMP set up. Obviously the fewer calls to the Db per page the better. But how many is too many? Two? Ten? A hundred? Curious what people think.

推荐答案

这确实取决于您(db)服务器的设置.尝试尽可能多地缓存大多数信息,并将数据库调用减至最少.数据库(几乎在每种情况下)将成为您服务的瓶颈-网站的使用率越高.因此,无论您采取什么措施,都尽量避免触发查询,即使这并非真正必要.

That really depends on your (db)servers setup. Try to cache most of information as possible and reduce db calls to a minimum. A database will (almost in every case) be the bottleneck of your service - the higher the usage of your site. So whatever you do try to avoid fireing a query as if not really necessary.

我尝试每页使用的数据库调用不超过10个,但这实际上取决于您的基础结构和要提供的信息.

I try not to use more than 10 db calls per page, but that really depends on your infrastructure and the information you want to provide.

这篇关于在PHP中,每页可以执行多少个DB调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆