简体   繁体   English

使用共享和专用托管服务器时的数据库查询性能

[英]Database querying performance when using shared and dedicated hosting servers

I would like to know how many database requests per page view (that is, every page that an user browses will start multiple requests to retrieve data from the database) should be made in order to have an "optimum" performance when I am using shared or dedicated hosting servers whose hardware is the most "commonly" provided (for example that that offer HostMonster or Bluehost providers). 我想知道每个页面视图有多少个数据库请求 (也就是说,用户浏览的每个页面将启动多个请求以从数据库中检索数据),以便在使用共享时获得“最佳”性能或专用的托管服务器,其硬件是最“常见”的(例如,提供HostMonsterBluehost提供程序的服务器)。 For both cases, I would like to know that when 对于这两种情况,我想知道

  • I use MySQL or another database system 我使用MySQL或其他数据库系统
  • The database size is 1, 10, 100, 1000 Megabyte 数据库大小为1、10、100、1000 MB
  • I don't or I do use cache optimization 我不使用缓存优化
  • Users browsing pages are 10, 100, 1000, 10000 per second 浏览页面的用户每秒10、100、1000、10000

In few word, under what conditions (considering the above cases) the server will begin to slow down and the user experience will be affected in a negative way? 简而言之,在什么情况下(考虑以上情况),服务器将开始变慢,并且会对用户体验产生负面影响? I appreciate some statistics... 我感谢一些统计信息...

PS: At this time I am using Ruby on Rails 3, so it is "easy" to increase requests! PS:目前,我正在使用Ruby on Rails 3,因此增加请求很“容易”!

I've had Facebook apps hosted on a shared host that did about a million pages per month without too many issues. 我已经将Facebook应用托管在一个共享主机上,该主机每月执行大约一百万页,而没有太多问题。 I generally did 5-8 queries per page request. 我通常每个页面请求5-8个查询。 The number of queries isn't usually the issue, it's how long each query takes. 查询的数量通常不是问题,而是每个查询花费的时间。 You can have a small data set that is poorly indexed and you'll start having issue. 您可能有一个索引编制不正确的小型数据集,然后开始出现问题。 The hosting provider usually kills your query after a certain length of time. 托管服务提供商通常会在一定时间后终止您的查询。

If you are causing the CPU on the server to spike, for whatever reason, then they may start killing processes on you. 如果由于某种原因导致服务器上的CPU出现峰值,则它们可能会开始杀死您的进程。 That is usually the issue. 通常这就是问题所在。

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

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