Throughput Formula

Launch The Formula Builder

Background

I've had this idea rattling around my head for years now. The basic idea is that the time spent idly holding onto a resource has a cost. In particular, I think of the example of database connections. A database engine does not perform well when there are thousands or even hundreds of idle connections.

I got this idea washing dishes, where I would leave the water running even though I was not actively using the water to clean or rinse anything. There is the conveniece of leaving the water running, but the waste of the water that could be used elsewhere.

Back in the technical realm on a software project, I found that if I kept a database connection held hostage while doing web I/O, the number of database connections spiraled out of control. In that case, it was a matter of returning the connection back to the pool before doing the I/O, and getting a connection from the pool after the I/O.

So I set out to build a general formula defining the parameters of connection-bound throughput, and to develop a formula builder for entering measurements of a live system and computing throughput.

Launch The Formula Builder

The Formula

ActiveElapsed = What amount of time does the function actively use the connection?
IdleElapsed   = What amount of time does the function hold onto the connection but does not use it?
(seconds, measurable)

CallsPerSecond = How often is the function called?
(calls / second, variable)

What are the connection counts?
Sum active and idle time products with calls per second to yield connection counts
Secret Sauce: How many connections are needed for activity or idleness for a certain amount of time?
ActiveConnections = Sum(ActiveElapsed X CallsPerSecond)
IdleConnections   = Sum(IdleElapsed X CallsPerSecond)
(connection counts, no units, computed)

TotalConnections = ActiveConnections + IdleConnections
(connection count, no units, computed)

MaxConnections = What is the configured connection count limit
(no units, variable)

What is the rate of return in results / second given total and max connections?
This is a simple linear decay for the proof of concept
RateOfReturn = (MaxConnections - TotalConnections) / MaxConnections
(no units, computed)

BaseThroughput = throughput of one connection under no load
(results / second, measured)

Throughput = ActiveConnections X RateOfReturn X BaseThroughput
(results / second, computed)

Copyright © 2019 - Michael Balloni