Really simple queuing PL/SQL calcuations..

A couple of posts by Chen Shapira, (this one barbershop-queue-demo and this one random-thoughts-about-queues)  over at regarding queuing in systems and queuing theory piqued my interest. Way back in the beginning of my career in IT I worked in an outsourced  call centre building reports, providing management information etc. one critical piece of this work was calculating requred staffing levels. A lot of this was based on a couple of pieces of maths the ErlangB and ErlangC Formulas as part of the reporting I ended up producing some PL/SQL to perform these calculations its not the best but if your interested its here queuing_calc_plsql.

This is based on the Excel erlangc calculator written by Lester Bromley at however my code has a couple of additional caveats, there is no error or input checking in the pl/sql I may add it a some point but then again I may not, it is therefore possible to get nonsensical responses or divide by zero errors.

Servicetime is defined in the functions as the time spent queuing not the queuing time+transaction time.

the PL/sql functions I wrote allow you to specify an interval rather than use a default of one hour, also the orgonal provides far more functions than i translated, I’ll probably get around to the others at some point but it may take a while.

The same conditions apply, you can use any of this code you like however do not sell rent or lease it out, also its provided as is and I’m not responsible for any loss or damages if its faulty or provides incorrect answers, also if you want to modify re-code into a different language feel free but it would be polite to contact Lester prior to publishing anything based on this as the original work is his.

Anyway back to the point, Chens post got me too thinking could this stuff be useful in an OTLP environment, my thoughts are possibly. It should be possible to estimate the number of cpus based on a given volume of transactions, cpu time required for each transaction and the desired service level. I suspect the model won’t be perfect as cpu usage for a transaction may be split into multiple chunks however hopefully I’ll get some time to produce a test case/simulation and see if it works aver the next week or so, if anyone has any bright ideas let me know..



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: