Rates & Capacity Planning

Rate expressions, accumulation with ‘over’, rate conversion, and capacity planning with ‘at…per’.

From testdata/eval/success/features/rates.cm, testdata/eval/success/features/rate_functions.cm, and testdata/eval/success/features/capacity_at.cm.

Rate Expressions #

CalcMark supports rates with any time unit. Both / and per syntaxes work.

# Bandwidth rates
r1 = 100 MB/s
r2 = 1 GB/sec
r3 = 10 TB per second

# Cost rates
r4 = $0.10/h
r5 = $100 per hour
r6 = $50/mo
r7 = $10000 per year

# Request rates
r8 = 1000 req/min
r9 = 50000 requests per minute
r10 = 1500000 req/s

# Custom units
r11 = 20 apples/sec
r12 = 100 widgets per minute
r13 = 1000 cars/day
Results
r1 = 100 MB/s100 MB/s
r2 = 1 GB/sec1 GB/s
r3 = 10 TB per second10 TB/s
r4 = $0.10/h0.1 $/h
r5 = $100 per hour100 $/h
r6 = $50/mo50 $/month
r7 = $10000 per year10K $/year
r8 = 1000 req/min1K req/min
r9 = 50000 requests per minute50K requests/min
r10 = 1500000 req/s1.5M req/s
r11 = 20 apples/sec20 apples/s
r12 = 100 widgets per minute100 widgets/min
r13 = 1000 cars/day1K cars/day

Accumulate: rate over time #

Calculate totals from a rate over a time period.

100 MB/s over 1 day
5 GB/day over 1 year
$0.10/hour over 30 days
1000 req/s over 1 hour
50 KB/s over 1 hour
100 widgets/hour over 1 week
$5/day over 365 days
Results
100 MB/s over 1 day8.24 TB
5 GB/day over 1 year1.78 TB
$0.10/hour over 30 days$72.00
1000 req/s over 1 hour3.6M req
50 KB/s over 1 hour176 MB
100 widgets/hour over 1 week16.8K widgets
$5/day over 365 days$1,825.00

Convert Rate: rate per target_unit #

Convert a rate to a different time unit.

5 million/day per second
10 TB/month per second
1000 req/s per minute
100k/hour per second
Results
5 million/day per second0.000058 million/s
10 TB/month per second4.05 MB/s
1000 req/s per minute60K req/min
100k/hour per second27.777778/s

Rate Unit Conversion with in #

Convert both quantity and time units.

speed1 = 10 m/s in inch/s
speed2 = 100 km/h in mile/h
rate1 = 60 m/s in m/min
speed3 = 1 km/h in m/s
data_rate = 10 MB/day in seconds
Results
speed1 = 10 m/s in inch/s10.9 yd/s
speed2 = 100 km/h in mile/h62.1 mi/h
rate1 = 60 m/s in m/min3.6 km/min
speed3 = 1 km/h in m/s27.8 cm/s
data_rate = 10 MB/day in seconds121 bytes/s

Capacity Planning: X at Y per unit #

Calculate how many units are needed.

# Basic capacity planning
storage_disks = 10 TB at 2 TB per disk
web_servers = 10000 req/s at 450 req/s per server
network_connections = 100 MB/s at 10 MB/s per connection
fruit_crates = 100 apples at 30 per crate
production_batches = 100 at 25 per batch
Results
storage_disks = 10 TB at 2 TB per disk5 disk
web_servers = 10000 req/s at 450 req/s per server23 server
network_connections = 100 MB/s at 10 MB/s per connection10 connection
fruit_crates = 100 apples at 30 per crate4 crate
production_batches = 100 at 25 per batch4 batch

Capacity with Buffer Percentages #

buffered_disks = 10 TB at 2 TB per disk with 10% buffer
buffered_servers = 10000 req/s at 450 req/s per server with 20% buffer
large_buffer = 100 at 50 per unit with 100% buffer
Results
buffered_disks = 10 TB at 2 TB per disk with 10% buffer6 disk
buffered_servers = 10000 req/s at 450 req/s per server with 20% buffer27 server
large_buffer = 100 at 50 per unit with 100% buffer4 unit

Capacity with Slash Syntax #

slash_disks = 10 TB at 2 TB/disk
slash_batches = 100 at 25/batch
slash_with_buffer = 10 GB/day at 2 GB/disk with 30% buffer
Results
slash_disks = 10 TB at 2 TB/disk5 disk
slash_batches = 100 at 25/batch4 batch
slash_with_buffer = 10 GB/day at 2 GB/disk with 30% buffer7 disk

Edge Cases #

# Demand less than capacity (minimum 1 unit)
minimum_units = 5 at 10 per unit

# Exact division
exact_division = 100 at 50 per container
Results
minimum_units = 5 at 10 per unit1 unit
exact_division = 100 at 50 per container2 container

What This Demonstrates #

  • Rate expressions with / and per syntax
  • All time units: seconds, minutes, hours, days, weeks, months, years
  • over keyword for accumulation
  • per keyword for rate conversion
  • at...per syntax for capacity planning
  • Buffer percentages with with X% buffer
  • Slash syntax alternative: 2 TB/disk instead of 2 TB per disk
  • Ceiling division (always rounds up)