LDAP Count Script


This script is useful for a couple reasons. First, benchmarking/performance testing obviously comes to mind. Having a trace showing an LDAP server's LDAP requests is useful but only if the data are interpretable. Parsing those isn't that hard but it takes time and the running of queries which can be easily bundled into one package or script (like this one). Another potential reason for this script comes in the form of debugging. If a server has a symptom of high utilization determining the source of that problem can be a challenge. LDAP is regularly used on many platforms to do searches which, when not optimized, can cause high utilization. Context logins, web application authentication and address books are just a few uses that can drive up the utilization on a box. Getting an idea, statistically, of your server's load can significantly increase the speed at which you can troubleshoot.

Besides showing statistics this utility also reports all of the connection IDs
reported from the trace. While usually unique a connection ID can be
reused by one application over and over. This utility shows the unique
connection IDs. With that in mind if you see 100,000 connections and only
a couple hundred connection IDs you know that each connection is doing thousands of requests.

Written in Perl this script should work on any platform with a Perl
engine/interpreter. This includes every OS with which I am familiar (all the
major ones) with the exception of microsoft windows. An interpreter is
available for microsoft windows from http://www.activestate.com/ as freeware.

To run the script simply save the ldapcount.pl file to your computer and (if on Linux or Unix) make it executable. Once that is done you can call it directly as follows:

./ldapcouont.pl tracefile0.log [...tracefile1.log]

If you are not on a platform that can run scripts natively in this fashion you can also call the script manually as follows:

perl ldapcount.pl tracefile0.log [...tracefiles1.log]

This calls the Perl interpreter manually feeding it the script and its arguments as Perl's arguments and works just fine.

The script can accept an arbitrary number of files to parse as limited by the shell in which you are running (more files than you'll care to type in will work). Output is broken down per-file.


Comment List
Related Discussions