Mid-Tier Sessions


 

APLMidTierSessions attempts to solve a common problem in load balanced Mid-Tier scenarios. The problem is that your Load Balancer routes sessions to various nodes in your environment, but it’s often difficult to tell how many users currently have active sessions on any given server.

For this tool to work, you must first be running Tomcat, and have JMX configured. Please refer to the below documentation on how to enable and configure JMX

http://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html

Once configured, you could use JConsole (look in your Java bin directory) to verify connectivity. Once you verify that JConsole can connect, then this tool should be able to connect with the same server/port combination.

This tool supports both unauthenticated as well as authenticatied connections, but I don’t have access to an SSL protected system, so I cannot test that at the moment.

If interested in knowing what node you are on, create a jsp file with the following code.  Put this file in your ‘shared’ directory on every Mid-Tier server (same directory as login.jsp), then access that JSP through your load balancer, it’ll tell you which host you are connected to.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Mid-Tier Node Name</TITLE>
</HEAD>
<LI>Hostname: <%= InetAddress.getLocalHost()%>
</BODY>
</HTML>

All command line parameters overwrite anything in the config file, but both can be used in conjunction.  So, if you have some values that are the same between all servers in your group, you can add those to the config file, and then only pass the ‘different’ values on the command line, and it’ll work just fine.

APLMidTierSessions.jar -x <server> -t <TCPPort> [-cx <context> -c <configFile> -u <user> -p <password> -o <outputFile> -e <environment> -splunk -v -h]
Required
-x: This is the server to connect to
-t: This is the TCP Port to connect to
Optional
-cx: This is the context your MidTier is running under, default is ‘arsys’
-c: Config file to use, if undefined it looks at APLMidTierSessions.properties file
-u: User used to connect to the servers
-p: Password of the user being used to connect
-o: File that you want the output to go to. If undefined, it goes to APLMidTierSessions.log
-e: A text string to represent what environment this server is in
-p: Alters the output to be a single line, and make it easy for Splunk to read the log line
-v: Ignores all other inputs and provides Application and version information
-h: Ignores all other inputs and provides this output

Version History
1.0 – July 22nd 2014
– Logs into Tomcat JMX Server and provides the total number of active sessions for the specified server