Skip to content

Reference To web.xml Configuration

eostermueller edited this page Dec 5, 2015 · 11 revisions

The wuqiSpank web.xml is located here:

.extract/webapps/wuqiSpank/WEB-INF/web.xml

The above .extract directory is created as a child directory of the 'current directory' when you launch java -jar wuqiSpank.jar. This is how Tomcat unzips itself onto the file system (documentation ). The folder structure looks like this:

export-dir
.extract/
├── conf
├── logs
├── webapps
│   ├── wuqiSpank
│   │   ├── WEB-INF
│   │   │   ├── classes
│   │   │   └── lib
└── work

Export Dir

The only way to save your wuqiSpank traces to disk is by clicking the "Export to File" button. Elsewise, the JDBC-captured traces will be lost when you restart the wuqiSpank web app. If the export-dir doesn't exist at startup, wuqiSpank will attempt to create it.

By default, exported traces are stored in the export-dir folder, which is a child folder of the directory where you started wuqiSpank. For instance, if you started wuqiSpank in this folder:

c:\foo>java -jar wuqiSpank-?.??.jar

Then your export-dir will be in this location:

c:\foo\export-dir

You can change this by updating this configuration in web.xml (.extract/webapps/wuqiSpank/WEB-INF/web.xml):

<context-param>
        <param-name>export-dir</param-name>
        <param-value>c:/wuqiSpank/my-export-dir</param-value>
</context-param>	

Trace Remote Host

By default, wuqiSpank tries to trace SQL from an intrace-agent.jar file that is listening on port 9123 (intrace default) on localhost.

If instead, you want wuqiSpank to trace SQL from an intrace-agent.jar deployed on a separate machine, you'll need to specify that parameter as follows:

    <context-param>
        <param-name>intrace-agent-host</param-name>
        <param-value>otherserver.com</param-value>
    </context-param>

Non-default port for intrace-agent.jar

    <context-param>
        <param-name>intrace-agent-port</param-name>
        <param-value>9121</param-value>
    </context-param>

Why would you ever use this? To trace SQL from two different web applications on the same machine. You will need two instances of wuqiSpank, one for each webApp.

WebApp #1

Step 2-2 of the Getting Started instructions detail the intrace-agent.jar parameters. To the end of that long parameter, add the following as specified here:

[serverport-9121

wuqiSpank #1

Create two folders, wuqiSpank-one and wuqiSpank-two and put a wuqiSpank jar file in each folder. You'll need one wuqiSpank instance for each webApp you want to trace. In wuqiSpank-one/.extract/webapps/wuqiSpank/WEB-INF/web.xml set the intrace-agent-port to 9121 as detailed above. When you launch wuqiSpank.jar, append -httpPort 8121. The browser url to see SQL from WebApp #1 will be http://localhost:8121/wuqiSpank

WebApp #2

Step 2-2 of the Getting Started instructions detail the intrace-agent.jar parameters. To the end of that long parameter, add the following as specified here:

[serverport-9122

wuqiSpank #2

In wuqiSpank-two/.extract/webapps/wuqiSpank/WEB-INF/web.xml set the intrace-agent-port to 9122 as detailed above. When you launch wuqiSpank.jar, append -httpPort 8122. The browser url to see SQL from WebApp #1 will be http://localhost:8122/wuqiSpank

Cache for Static Data

Use this syntax in wuqiSpank web.xml:

<context-param>
        <param-name>cached-tables</param-name>
        <param-value>physical_plant, product_cfg</param-value>
</context-param>	

..to highlight the table names 'physical_plant' and 'product_cfg' in blue (blue like a slow moving glacier). As shown, multiple tables must be separated by commas. See how the digit '4' is circled in blue, below? Blue is wuqiSpank's 'reserved color' to indicate when a table with mostly 'static' data should be cached with a solution like EHCache. When a developer see a blue table, they must insure that all the queries to it are backed by an in-memory cache. static-blue

Watch for growth in a SELECT N+1 Table

Use this syntax in wuqiSpank web.xml:

<context-param>
        <param-name>growth-tables</param-name>
        <param-value>big_ams, tran_hist</param-value>
</context-param>	

..to highlight the table name 'big_ams' in red. See how the digit '9' is circled in red, below? Red is wuqiSpank's 'reserved color' to indicate when a table with data that is frequently changing (INSERT included). When a developer sees a red table, they must insure they they minimize queries to this table, because it will grow large, especially in production. dynamic-red

InfluxDB

The [Getting Started](Getting Started) page shows how to install your JDBC web app, wuqiSpank, InfluxDB and Grafana all on the same machine. To move InfluxDB to a separate machine, you need to do the following:

  1. Install InfluxDB on the desired machine. The [Getting Started](Getting Started) has a link to InfluxDB install instructions.

  2. Tell wuqiSpank the host/port of new InfluxDB by using the following parameters in wuqiSpank's web.xml file. See instructions above for how to find the web.xml.

       <context-param>
       	<param-name>influxdb-host</param-name>
       	<param-value>someothermachine.com</param-value>
       </context-param>
       
       <context-param>
       	<param-name>influxdb-port</param-name>
       	<param-value>8087</param-value>
       </context-param>	
    
  3. Tell Grafana the host/port of the new InfluxDB by browsing to your Grafana instance at http://localhost:3000 and following these instructions.

Grafana

The [Getting Started](Getting Started) page shows how to install your JDBC web app, wuqiSpank, InfluxDB and Grafana all on the same machine. To move Grafana to a separate machine, you need to perform the instructions below. Following these instructions achieves one very small thing: it allows wuqiSpank to provide a link to the Grafana web application (which is not available yet).

  1. Install Grafana on the desired machine. The [Getting Started](Getting Started) has a link to Grafana install instructions.

  2. Tell wuqiSpank the host/port of new Grafana by using the following parameters in wuqiSpank's web.xml file. See instructions above for how to find the web.xml.

     <context-param>
         <param-name>grafana-host</param-name>
         <param-value>someothermachine.com</param-value>
     </context-param>	
     <context-param>
         <param-name>grafana-port</param-name>
         <param-value>3000</param-value>
     </context-param>	
    

Clone this wiki locally