The Magic of Math

Me: in the equation, t represents the arrival time of the first packet carrying the object…

Meeting attendee: wait, wait, t, x, y, that is too complicated…

And that is how some engineers, who have Masters of Science or PhD degrees and who have been on the job for 10 to 15 years, are completely disconnected from the most simple of math equations.

We work with interfaces, call flows and requirements. We rinse and repeat until our skills expand in the areas of defining APIs, of defining functional interactions, of optimizing behaviors and designing the most simplified behavior to achieve efficiency. However, we sometimes embark on an optimization quest without, first, trying to identify the obvious mathematical optimum. Identifying the optimal achievable performance allows one to stop searching for improvements when none are to be had.

One example we had to deal with is extracting the optimal playback time for http streaming objects delivered in constant bit rate bursts over a channel.

Assume that http streaming objects are created at a periodic interval T1 and each carry T1 seconds worth of video. The segments are of maximum size S. Assume, for simplicity, that all segments are of maximum size. Furthermore, assume that the packets are delivered using short bursts delivering at most S/T1*T2 bytes per burst every T2 seconds where T2<T1.

Assume that the segments are generated at an encoder once every T1 seconds. The segments are delivered to the delivery engine which maps the arriving data onto the scheduling opportunities every T2 seconds. Since T1 and T2 are not aligned then the packets will exhibit variable delay until scheduled. The data is then delivered to an end client which must decide what is the optimal playback time of the stream of segments based on the delivery characteristics of the first receive segments.

One can show for the above stream that the receiver can schedule the playback of the first received segment at arrival time of first packet of segment + ceil(T1/T2)*T2 and a slight margin. The playback or every subsequent segment can be scheduled at T1 intervals with segments guaranteed to be delivered before the playback point of these future segments.

Our software engineers had tried to use multiple ad-hoc formulas based on the first/last packet arrival of a segment and based on T1. These formulas were not optimal and worse sometimes failed depending on the actual setting of T2 which was a variable characteristic of the system.

A simple analysis was all it took. This would be a simple exercise for an engineering student. So, why was it so complicated for experienced and highly cultured engineers?

My advice is to keep your accumulated experience and knowledge close and your math toolbox closer.

Leave a comment