Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to go about estimating the hardware required to support X number of users/transactions?

Tags:

architecture

I am curious as to how do everyone approach the question of the following nature:

'we need to create Application A (eg. ecommerce site). It will use technology B (eg. java). It has to support C (eg. 200) number of concurrent users. What kind of hardware do we need?'

Hardware specification would involve the number of CPU required, and perhaps amount of memory for a basic answer.

To simplify my example, I will stick with Java technology in my question, but I really would like a technology-neutral advice.

I understand that such a question involves many additional factors. Eg, a different framework (Wicket vs Struts vs Spring vs pure EJB J2EE architecture), number of distributed tiers (one box setup or 3 tier setup).

But given that a person might have no prior experience with the given technology (or maybe no opportunity to do a load test of finding out what the required hardware is), and such a question always comes up during an initial project discussion (and an answer is essential as a baseline to move forward), how do you go about giving an answer?

I had thought about solving the memory required problem by estimating the amount of memory each user session might take, but there will definitely be framework/virtual machine overhead.

But in general, I just cannot seem to reason out a good solution to this question, which always seem to pop up. A load test would definitely help solve it, but then by that point the project is already ready, and this is a question a client would usually want an answer to before committing to a project.

Do hope that the community can advise on good approaches to this.

Thanks.

like image 681
Kent Lai Avatar asked Jun 16 '09 02:06

Kent Lai


2 Answers

You really have to make some assumptions about your user experience to make an initial non-load-tested estimate of concurrent users. Start with some assumptions about a users session. Decent ballpark assumptions could be (this may not hold depending on the complexity or simplicity of your site):

  • Each user hits a new page or resource every 5 seconds (assuming AJAXy)
  • Each request takes an average of 200ms to process.
  • It's generally good to have an average usage that is 25% of capacity to allow for spikes, even more for social network sites where the spikes could be larger.

Then you would say:

200 users ( 200ms / 5s ) => 8 CPUs average need * 4 (for 25% load) => 32 CPUs.

I don't think this is particularly language centric. Memory isn't expensive, have enough.

like image 106
stevedbrown Avatar answered Dec 13 '22 18:12

stevedbrown


Personally, I think anyone who tells you there's a general solution to this problem is lying to you. That's especially true if they're a hardware vendor.

You can only make estimates like this based on similar loads to the load you expect. You will later learn that you were mistaken because the real load really isn't that similar to the "similar" load you used as an estimate.

Hopefully, you'll learn from that and do a better estimate next time.

like image 38
John Saunders Avatar answered Dec 13 '22 18:12

John Saunders