An utility for testing connectivity to an application server with Apache JServ Protocol (AJP)
AJPing is tests connectivity over AJP to an application server. It sends a 5 byte ping which consists of 0x12, 0x34, 0, 1, 10. It expects a 5 byte pong which contains the following: ‘A’, ‘B’, 0, 1, 9. If it successfully retrieves that response, it considers the transaction valid. If AJPing does not receive a valid response, then it will exit 1.
When AJPing has completed its run — either because it reached a configurable number of repetitions or because the user hit Ctrl-c — it will collect and display performance statistics.
The format for invoking ajping is this:
ajping [options] URL
ajping [options] [scheme]hostname[:port]
The URL scheme is unnecessary and so is the port (as long as the default port is invoked). The default AJP port on most application servers is 8009. AJPing uses that port as well. If you invoked the application with just a hostname, it will create a URL that looks like this: ajp://ip6-localhost:8009/
AJPing was built using GNU long-options. Each option can be invoked in either long or short form. Both long and short can be used in the same startup. The program supports the following options:
VERSION, prints version number to screen.
HELP, prints the fido help message which closely resembles this section of the manual.
IP VERSION, tells AJPing whether it should use IPv4 or IPv6. Version 4 is the default protocol, so this option is only necessary if you want to invoke version 6.
REPETITIONS, tells AJPing how many round trips it should make to the server. The default number is essentially unlimited. It will run until it reaches your system’s maximum integer size. You can stop an unlimited urn with Ctrl-c.
TIMEOUT, sets the socket timeout for AJPing. This will be the amount of time in seconds it will attempt to open a socket, write data to a socket or read data from that socket. The default value is 5 seconds.
QUIET, instructs AJPing to stifle all messages to stdout. This is useful for scripting. You can evaluate the integrity of the test by capturing the exit code. If AJPing was successful, it will exit 0, if not it will exit 1.
Here’s an example run to give you a feel for the application. We’ll use IPv6 and we’ll do 5 reps (round trips) to the server:
Bully $ ajping -i6 -r5 ajp://ip6-localhost:8009/
--- ajping v1.0.1 to ip6-localhost:8009 ---
5 bytes from ip6-localhost (::1): seq=1 time=1074 ms
5 bytes from ip6-localhost (::1): seq=2 time=267 ms
5 bytes from ip6-localhost (::1): seq=3 time=249 ms
5 bytes from ip6-localhost (::1): seq=4 time=252 ms
5 bytes from ip6-localhost (::1): seq=5 time=250 ms
--- ip6-localhost:8009 ajping statistics ---
5 packets sent, 5 received, 0% packet loss, time: 2092 ms
rtt min/avg/max = 249/418/1074 ms
That looks a lot like ping, doesn’t it? Indeed that is how we modeled this program.
RTT stands for “Round Trip Time.” When AJPing is finished with its run, it will display RTT stats before it exits. It will show you the number of 5 byte packets it sent, the number of five byte packets it received and the total amount of time it took to transmit those packets.
NOTE: AJPing has a one second delay between each round trip. That second is NOT added to the time displayed in the first line of stats. Time is the total of all round trips. In this case, it’s the sum of 1074+267+249+252+250. That is 2092 milliseconds.
The second line of stats contains three numbers: the shortest transaction, the longest transaction and the average round trip time. Each of these numbers is displayed in milliseconds. The average round trip time in this example is 418 milliseconds.
You can find the latest version of AJPing in our download area: AJPing Source Distribution
The source repository is hosted on GitHub: AJPing Repository