简体   繁体   English

数据库何时以及如何减慢网站速度?

[英]When and How Does the Database Slow Down a Site?

I have read a book by O'Reilly that states that 70-80% of the performance of a site can be optimized via the front-end. 我读过O'Reilly的一本书,指出可以通过前端优化网站70-80%的性能。 That may mean that database queries may account to less than 20 or 30% of a site's performance. 这可能意味着数据库查询可能占网站性能的不到20%或30%。 However, I have seen huge websites like Facebook and Twitter dedicate so much time to optimizing queries (via query caching, normalizations, etc). 但是,我看到像Facebook和Twitter这样的大型网站投入了大量时间来优化查询(通过查询缓存,规范化等)。 When does the database become so critical for a site's performance that it can account to more than the aforementioned percentage? 数据库何时对网站的性能变得如此重要,以至于它可以超过上述百分比? Oh, and by performance I mean in the context of speed, loading speed in particular. 哦,性能我的意思是在速度,特别是加载速度的背景下。

Don't trust such figures to be so accurate. 不要相信这些数字是如此准确。 The role of the DB in each website varies: in some web sites there's no RDBMS, and in others it's all about queries and the DB dictates the entire performance of the system. 数据库在每个网站中的作用各不相同:在某些网站中没有RDBMS,而在其他网站中,所有这些都与查询有关,数据库决定了系统的整体性能。 In other words, such statistics are meaningless to you for any practical purpose. 换句话说,就任何实际目的而言,此类统计数据对您来说毫无意义。 You need to analyze your system's particular performance by profiling it (measuring performance) and finding out exactly how much time/resources the DB part takes. 您需要通过分析系统的特定性能(测量性能)来分析系统的特定性能,并确切了解数据库部件需要多少时间/资源。

When does the database become so critical for a site's performance that it can account to more than the aforementioned percentage? 数据库何时对网站的性能变得如此重要,以至于它可以超过上述百分比?

After you have already optimized the front-end to the max, the relative impact of the back-end will become much larger. 在将前端优化到最大值之后,后端的相对影响将变得更大。

Also, very big sites face the problem of scalability. 此外,非常大的网站面临可扩展性问题。 They might be able to serve a single user very fast, but as the load grows, it gets slower for everyone. 他们可能能够非常快地为单个用户提供服务,但随着负载的增长,每个人的速度都会变慢。 The client-side part is spread across the users' machines, so scales very well. 客户端部分分布在用户的机器上,因此可以很好地扩展。 But the back-end is shared by everyone, and will become the bottleneck. 但后端是每个人共享的,并将成为瓶颈。

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

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