您如何进行网站容量规划? [英] How do you do website capacity planning?

查看:89
本文介绍了您如何进行网站容量规划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚读过这本书容量规划的技巧(顺便说一句,我喜欢它),作者在其中解释了衡量服务,确定上限,预测需求,确保轻松进行部署等的重要性.等等.但是通过这本书,他解释了他的观点.经验丰富的Flickr,他必须一直面对相同的产品.

我们当中很多人,我们在其他公司面临中小型项目规模的公司中工作.我们必须了解他们的业务,他们的需求,计划架构,模型等.

然后,客户说我需要支持1000个用户".那么,一个用户每秒有多少个请求?他们的课程多长时间?他们传输多少数据?他们执行哪些操作?他们多久了?

有时可以知道这些数字(监视其现有应用程序,或者因为它们已经进行了测量),有时则是不可能的(因为它们没有当前网站,或者只是可能知道) ).

您如何猜测服务器的数量,带宽,存储空间等...您使用哪些参考数字?

致谢.

解决方案

制定计划需要知道一些要点

  1. 每天有多少用户.
  2. 您要控制多少数据.
  3. 您要向每个用户显示多少数据.
  4. 可能需要的平均用户带宽.
  5. 使用您的网站的平均用户时间.

平均数量可以使您每月了解一些需求.当然,您还需要考虑峰值-但是,当它们攻击Web服务器计算机和站点时,它们会按月提供带宽,并按硬盘提供几GB的带宽,因此峰值在开始时就不是问题.在那里,您必须认为,如果运行需要太多内存的sql查询,或者与许多其他站点共享计算机.

测量

没有站点,没有经验,您实际上没有措施. 如果没有采取措施,您实际上不能确定,但​​是可以遵循一些指南

  • 您做什么,try to make the grow of your data/features/runs linear and not logarithmic.
  • The speed of your site is not (only) depend from the capacity and the speed of your computer.仅在计算机受限时才取决于.如果计算机达到极限,则添加其他资源.但是在设计软件时必须注意速度,而且良好的速度软件也会造成成本.
  • 您每天在数据库中有数百万个数据吗?您需要更多RAM和硬盘
  • 您有要发送的视频和许多大文件吗?您需要更多带宽.
  • 您有使用该网站工作的人吗?您需要更高的速度和稳定性
  • 您还会再建立一个电子商务网站吗?您需要具有稳定性的更高的安全性

目标是全部拥有它们,而您首先关注的重点的优先级实际上发生了变化.

计划速度.

Performance and Capacity: Two diffident animals*.性能基于更多的人工工作,容量基于更多的计算机资源.要提高速度,您首先需要知道如何使计算机流畅,快速地运行,然后要了解使程序快速运行的一般技巧,尤其是在网络上运行的技巧,然后您实际上需要花费更多的时间来实际运行.程序运行后,以提高其在关键区域的性能.

计划扩展.

进行良好的软件设计,并在可能需要更多扩展的情况下谨慎进行扩展,以便使您的客户有机会从少做起,并仅在他需要时支付更多.因此,当您设计软件时,就像在网络池中使用它一样,要注意同步,要注意公用资源,要有能力从不同的服务器等获取数据.

有限制的计划

好吧,让我们说客户说只有1000个用户,对于扩展,提高速度并没有兴趣,只需要一个具有成本效益的网站来完成他的工作即可.在这种情况下,您还应在此限制下进行设计.这有什么限制.您无需对同步进行数十次检查,而是使它像单线程单池程序一样工作.当您有2个池或2台运行同一应用程序的计算机时,您不会使用任何互斥锁,任何重复检查或任何认为的事情.您只注意到需要升级的代码点即可更改.

您也没有编写任何使用多计算机资源的代码.而且,当您运行它时,请注意只能在一个池中运行才能正常工作.

这种单池设计更易于开发,更易于调试,易于控制,易于更新错误代码,并且成本更低,但速度较快(一个用户在一个线程池上等待另一个)扩大资源,而这实际上也与速度有关.

查找统计信息

如果您不知道自己可能拥有多少用户,则可以使用alexa查看与您的网站相似的网站以及他们每月的平均用户/和平均页面浏览量.然后,您可能知道可能的带宽.

在需要之前不要购买

从对硬件的预测开始,但是从第一天开始就不要租用2台计算机.从第一个开始,进行测量,查看数据如何增长,并仅在需要时进行扩展.

汽车或一级方程式赛车?

程序运行时,如果您遵循该程序,会发现许多需要纠正的想法.我只能说你一生只有两个.

将程序在线放置后,我们的客户开始添加数据.几个月后,我们注意到数据库增长太多了,这是我们从数据输入中所无法预期的.我们花了将近一周的时间来找出原因并加以解决,这是一个设计错误,使一些统计数据成对数,我们对其进行了纠正并继续进行.

运行两年后,我们注意到我们对SQL Server进行了太多不必要的调用.我们对其进行跟踪,然后再次发现设计错误,我们对其进行了纠正,然后继续进行.

实际上,我们每个月都发现并修复了许多性能小问题.对我来说,它就像一级方程式.您决定自己拥有哪种汽车,需要始终进行校正才能获得最大收益的方程式赛车,或者仅需要每年服务的简单汽车?

客户观点

Then, the customer says "I need to support 1000 users"嗯,客户不了解编程,因此尝试从他的观点中寻找一种方法来比较提案.实际上,这里还有更多因素,而1000个用户不是正确的参数.是每天每分钟或每月1000个用户吗?是否需要通过实时聊天进行支持,还是需要查看大量数据,还是需要快速工作?因此,也许您有责任通过向他解释正确的程序向客户以太坊来向客户解释,好的程序对于一百万个用户中的一个用户来说是一样好的,而实际上它的开始是由开发而不是由开发引起的.用户.

现在,如果这是实际计划站点的问题,那么简单的终点答案就是开始做,其余的将揭晓.如果这是因为您要寻找客户的答案而引起的问题,那么您必须问自己:为什么一级方程式赛车只能坐一个,而汽车却可以容纳五个?还是看一部电影要花多少钱?还是我们都知道怎么写,但是为什么我们所有人都不写和出版一本书呢?我的观点是,成本实际上是从您花费在制作项目上的时间中获得的,而用户自己无法确定这一点.

猜测,知识还是预测?

How do you make a guess about the number of servers, bandwidth, storage, etc...实际上,我们没有猜测,我们有很多站点,我们每天自动收集许多统计信息,有多年的经验,并且从站点的内容中我们知道每天可以有多少用户以及有多少带宽可以吃.我们的服务器上还运行着许多数据库,我们可以看到它们使用了多少数据.对于我们99%的网站而言,这些数字都是很小的.这就是知识和经验,还有真实的实时统计信息.通过监视流量和流量的使用来进行预测,我们试图使流量变得更好,获得更多流量,更多用户,并且通过归档,我们尝试预测它们将来是否需要更多资源.另外,有99%的站点是运行非常简单的演示文稿的单个池.

'*从书中

I just read the book The Art of Capacity planning (BTW, I liked it), and in it the author explains how important is measuring your services, finding out your ceilings, forecasting your needs, ensure a easygoing deployment, etc.. etc.. But through the book he explains his experience in Flickr, where he has to face all the time the same product.

Lot of us, we work in companies where we face small-medium project sizes for other companies. We have to understand their business, their needs, plan an architecture, a model, etc.. etc..

Then, the customer says "I need to support 1000 users". Well, and how many requests per second is a user? how long are their sessions? how much data do they transfer? which operations do they execute? how long are they?

Sometimes it is possible to know those figures (monitoring their existing applications or because they have already done that measurements), sometimes it is not possible (because they do not have a current web site, or it is just to possible to know).

How do you make a guess about the number of servers, bandwidth, storage, etc... which figures of reference do you use?

Regards.

解决方案

Some points that you need to know to make this planning

  1. How many users per day.
  2. How many data you going to control.
  3. How many data you going to show to each user.
  4. Average user bandwidth that may need.
  5. Average user time using your site.

The average numbers can give some idea what you need monthly. Of cource you need to think also the peak numbers - but when they rend web server computers and site they give bandwidth by the month and some gigabytes on hard disk, so the peak is not an issue at the start point. There you must think that if you run sql query that need too much ram, or if you share the computer with many other sites.

Measure

With out site, with out experience you do not have actually measures. With out measures, you actually can not be sure but you can follow some guides

  • What ever you do, try to make the grow of your data/features/runs linear and not logarithmic.
  • The speed of your site is not (only) depend from the capacity and the speed of your computer. Is depend only when the computer is on his limits. If the computer is reach his limit, you add additional resource. But the speed must be take care when you design the software and the good speed software is costing also.
  • Do you have millions of data every day in the database ? you need more ram and hard disk
  • Do you have video and many big files to send ? you need more bandwidth.
  • Do you have people that using the site to work ? you need more speed and stability
  • Do you make one more e-commerce site ? you need more security with stability

The goal is to have them all, and the priority on what you focus first actually change.

Planning for speed.

Performance and Capacity: Two diffident animals*. The Performance is base on more human work, and the capacity is base on more computer resources. To make it speed you need first to know how to make the computer run smooth and fast, then to know how general tricks to make programs runs fast, especial the one on the web, and then you actually need to spend more time to the actually program after its run, to improve it for performance in the critical areas.

Planning for expand.

Make good software design and take care the possibility of expand in case that you may need more so to give to your client the opportunity to start with little, and pay more only if he needed it. So when you design your software think like you going to use it in a web pool, take care of the synchronization, take care of common resource, give the ability to get data from different servers etc.

Planning with limits

Ok, let say that the customer say that have only 1000 users and did not interesting nether for expand, nether for speed, and just need a cost effective site that do his job. In this case you also design it with this limits. What are this limits. You do not place tens of checks for synchronizations, and you make it work like a single thread, single pool program. You do not use any mutex, any double checks, any thinks that happens when you have 2 pools or 2 computers running the same application. You only note that points of code to change them in case that needs upgrade.

You also not made any code that use multicomputer resources. And when you run it you take care that is run only under one pool to work correctly.

This single pool design is more easy to develop, more easy to debug, easy to control, easy to update buggy code, and cost less, but suffer from speed (one user wait the other on one thread pool) and can not be expand in resource, that actually have to do also with speed.

Finding Statistics

If you do not know how many users you may have, you can use alexa to see similar sites with yours and the average users/ and average page views they have per month. Then you may know the possible bandwidth.

Don't buy before you needed it

Start with your prediction to hardware, but do not go and rent 2 computers from the day one. Start with the first, make your measures, see how data grow, and only expand it when you need it.

Car or Formula One ?

When the programs runs, if you follow it you can find many many thinks that need correction. I can say you only two from my life.

After we place the program online our customer starts to add data. After some months we notice the database grow too much - something that we did not expect it from the data enter. We spend almost one week to find why and fix it, it was a design error that make some statistics data grow logarithmic, we correct it and move on.

After two years of running we notice that we make too many un-necessary calls to SQL server. We trace it down and found again a design error, we correct it and we move on.

Actually we have found and fix many small points for performance every month. For me its like the formula one. You decide what car you have, a formula one that needs all the time correction to gain the maximum of it, or a simple car that only needs a yearly service ?

Customer Point of View

Then, the customer says "I need to support 1000 users" Well the customer did not know programming and try to find a measure from his point of view to compare proposals. Actually there are many more factor here and the 1000 users is not a correct parameter. Is 1000 users per day per minute or per month ? Are needed to suport with live chat, or needed to see large amount of data, or needed to work fast ? So maybe its up to you to sell correctly your program to the customer ether by explain to him that the good program is good the same for one user of for one million users, and actually the start of it is cost by the development and not by the users.

Now if this is a question for actually planning a site, then the simple end point answer is to start do it, and the rest will be reveal. If this is a question because you search answers for your client, then you must ask your self: why the Formula One have sit only for one and your car can fit five ? or how much a movie cost ? or we all knows how to write but why not all of us have write and publishes a book ? My point is that the cost is actually get from the time you spend to make the project, and the users by him self can not be determine that.

Guess, Knowledge or Prediction ?

How do you make a guess about the number of servers, bandwidth, storage, etc... We actually do not guess, we have many sites, we collect every day many statistics automatically, many years experience, and we know from the content of the site, how many users can have per day and how many bandwidth can eat. We also have many databases that runs on our servers and we can see how many data they use. For 99% of our sites all that are low numbers. So this is knowledge and experience, with real live statistics. The prediction come by monitoring the traffic and the use of them, we try to make them better, to get more traffic, more users, and from what we archive we try to predict if they need more resource in the future. Also 99% of the sites are single pool running very simple presentations.

'* From the book

这篇关于您如何进行网站容量规划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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