Channels ▼
RSS

Design

Tough Apps: How Much Hardware Should I Buy?


Solution:

    
searchtraffic = T + (0.4 * searchtraffic) + (0.2 * specifytraffic) + (0.6 * addtraffic) 
   
specifytraffic = (0.2 * searchtraffic) + (0.3 * specifytraffic)
   
addtraffic = (0.1 * specifytraffic)
   
specifytraffic = 0.2/0.7 * searchtraffic
   
addtraffic = 0.1 * 0.2/0.7 * searchtraffic

Thus, searchtraffic=T+(0.4*searchtraffic)+(0.2*0.2/0.7*searchtraffic)+(0.6*0.02/0.7*searchtraffic)=T+(0.4+0.057+0.017)*searchtraffic.

So searchtraffic=T/(1-(0.4+0.057+0.017))=T/0.526=10000/0.526 =19,011.41 arrivals per second. We'll call this 20,000 arrivals per second to give us some wiggle room.

specifytraffic=20,000*0.2/0.7=5,714 arrivals per second, which we'll call 6,000 arrivals per second.

addtraffic=20,000*0.1*0.2/0.7=571.4 arrivals per second, which we'll call 600.

Because each task requires 0.1 seconds on a single server, we want an arrival rate of roughly 9 per second (we could actually deal with more since 2.9/3=9 2/3). we need roughly 2955 servers with 2220 going to search, 660 to specify, and the remaining 75 going to add. If you got any numbers like this, you are on the right track.

In the case of a service time that is appreciable, e.g. 2 seconds, a slightly more complex analysis is required (see http://cs.nyu.edu/courses/fall09/G22.2434-001/capplanrulethumb.html, but the idea is simple. There are two components to response time waiting time + service time. Buying N servers decreases waiting time by a factor of N, but doesn't decrease service time whenever each task must be handled by one server. Therefore, to derive the response time, compute waiting time as if you had a single server that was N times as fast and then add in service time. The notes should make it clear.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video