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/dayResults
| r1 = 100 MB/s | → | 100 MB/s |
| r2 = 1 GB/sec | → | 1 GB/s |
| r3 = 10 TB per second | → | 10 TB/s |
| r4 = $0.10/h | → | 0.1 $/h |
| r5 = $100 per hour | → | 100 $/h |
| r6 = $50/mo | → | 50 $/month |
| r7 = $10000 per year | → | 10K $/year |
| r8 = 1000 req/min | → | 1K req/min |
| r9 = 50000 requests per minute | → | 50K requests/min |
| r10 = 1500000 req/s | → | 1.5M req/s |
| r11 = 20 apples/sec | → | 20 apples/s |
| r12 = 100 widgets per minute | → | 100 widgets/min |
| r13 = 1000 cars/day | → | 1K 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 daysResults
| 100 MB/s over 1 day | → | 8.24 TB |
| 5 GB/day over 1 year | → | 1.78 TB |
| $0.10/hour over 30 days | → | $72.00 |
| 1000 req/s over 1 hour | → | 3.6M req |
| 50 KB/s over 1 hour | → | 176 MB |
| 100 widgets/hour over 1 week | → | 16.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 secondResults
| 5 million/day per second | → | 0.000058 million/s |
| 10 TB/month per second | → | 4.05 MB/s |
| 1000 req/s per minute | → | 60K req/min |
| 100k/hour per second | → | 27.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 secondsResults
| speed1 = 10 m/s in inch/s | → | 10.9 yd/s |
| speed2 = 100 km/h in mile/h | → | 62.1 mi/h |
| rate1 = 60 m/s in m/min | → | 3.6 km/min |
| speed3 = 1 km/h in m/s | → | 27.8 cm/s |
| data_rate = 10 MB/day in seconds | → | 121 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 batchResults
| storage_disks = 10 TB at 2 TB per disk | → | 5 disk |
| web_servers = 10000 req/s at 450 req/s per server | → | 23 server |
| network_connections = 100 MB/s at 10 MB/s per connection | → | 10 connection |
| fruit_crates = 100 apples at 30 per crate | → | 4 crate |
| production_batches = 100 at 25 per batch | → | 4 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% bufferResults
| buffered_disks = 10 TB at 2 TB per disk with 10% buffer | → | 6 disk |
| buffered_servers = 10000 req/s at 450 req/s per server with 20% buffer | → | 27 server |
| large_buffer = 100 at 50 per unit with 100% buffer | → | 4 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% bufferResults
| slash_disks = 10 TB at 2 TB/disk | → | 5 disk |
| slash_batches = 100 at 25/batch | → | 4 batch |
| slash_with_buffer = 10 GB/day at 2 GB/disk with 30% buffer | → | 7 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 containerResults
| minimum_units = 5 at 10 per unit | → | 1 unit |
| exact_division = 100 at 50 per container | → | 2 container |
What This Demonstrates #
- Rate expressions with
/andpersyntax - All time units: seconds, minutes, hours, days, weeks, months, years
overkeyword for accumulationperkeyword for rate conversionat...persyntax for capacity planning- Buffer percentages with
with X% buffer - Slash syntax alternative:
2 TB/diskinstead of2 TB per disk - Ceiling division (always rounds up)