How To

How To

Setting Environment variables

Set the Heapsizes in the tomcat startup script located in /bin/startup.sh and add these values to the JAVA_OPTS. Maximum heap size: this is the maximum amount of heap memory the Java Virtual Machine (JVM) is allowed to allocate. In the case of most JVMs, the default setting of the maximum heap size is 64MB. You can increase the maximum heap size of applications by setting the -XmxJVM parameter. For example -Xmx1024m allows maximum 1GB (1024MB) heap to be allocated for the JVM.

JAVA_OPTS=-Xms512m -Xmx1024m

Using JDBC connections (optional)

Download and copy the needed jar file for your database to the tomcat library /lib. This configuration is global and must be specified in /conf/server.xml and must be place between the GlobalNamingResources tags . JDBC Resource example

<Resource name="sampledb" auth="Container"
     type="javax.sql.DataSource" username="test" password="test"
     driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
     url="jdbc:sqlserver://192.168.145.138;DatabaseName=sit_crlstore;user=test; password=test;"
     maxActive="10"/>

In order to reference it in a jdbc adapter 2 more steps are required: Add it in your context.xml

<Context ......>
 <Environment name="TB_HOME" type="java.lang.String" value="....." description="Absolute path to TB_HOME" override="false"/>
 <ResourceLink global="sampledb" name="jdbc/trustbuilder" type="javax.sql.DataSource"/>
</Context>

and reference it from your trustbuilder config via the following:

<stb:Adapter stb:id="JdbcConnection" xsi:type="stb:JdbcAdapter">
        <stb:DataSource>java:/comp/env/jdbc/trustbuilder</stb:DataSource>
</stb:Adapter>

More information about defining resources can be found at http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html

Defining the webserver port

If the port (8080 by default) is already in use, Tomcat will not start. Typically Oracle's web server also uses port 8080.

Try to set a different port for Tomcat:

Please locate the Connector in /conf/server.xml with port=8080 setting, and modify the port value.

You can also change the setting in Tomcat's interactive administration tool (http://localhost:8080/admin) under Tomcat Server  Service  Connector. Select the connector with the HTTP type.

Customizing the error pages

This How-To is for advanced users since you have to repack the .war file to edit the error pages.

Trustbuilder has standard Error pages builtin. In case you want to change them you must unpack the trustbuilder-web.war file The error pages are located in trustbuilder-web/errors as JSP files containing 2 html pages and 1 text file. generic.jsp - Generic error page

generic.jsp

<%@page isErrorPage="true" contentType="text/txt; charset=UTF-8"%>
System error

404.jsp - Workflow not found

<%@page isErrorPage="true" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Not found</title>
    <style>
        H3 {
            font-family: Arial, Helvetica, sans-serif;
        }
        #header{
            line-height:50px;
            padding: 20px;
            width: 960px;
            height: 50px;
            margin: 0 auto;
            color:#A8004E;
            -moz-border-radius: 15px;
            border-radius: 15px;
            background-image: -webkit-gradient(linear, 0 top, 0 bottom, from(#A6A6A6), to(#FFFFFF));
            background-image: -moz-linear-gradient(top, #A6A6A6, #FFFFFF );
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#A6A6A6', endColorstr='#FFFFFF');
        }
        div.body {
            overflow: auto;
            margin: 0 auto;
            width: 960px;
            display: block;
            background-color: white;
        }
    </style>
</head>
<body>
    <div  id="header" colspan="13" align="left">
        <img src="../tb.jpg?v=109702" style="float:right"/>
    </div>
    <div class="body">
        <div style="margin-top:5px;">
            <h3>Not found</h3>
        </div>
    </div>
</body>
</html>

html.jsp - generic html error page

<%@page isErrorPage="true" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Server Error</title>
    <style>
        H3 {
            font-family: Arial, Helvetica, sans-serif;
        }
        #header{
            line-height:50px;
            padding: 20px;
            width: 960px;
            height: 50px;
            margin: 0 auto;
            color:#A8004E;
            -moz-border-radius: 15px;
            border-radius: 15px;
            background-image: -webkit-gradient(linear, 0 top, 0 bottom, from(#A6A6A6), to(#FFFFFF));
            background-image: -moz-linear-gradient(top, #A6A6A6, #FFFFFF );
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#A6A6A6', endColorstr='#FFFFFF');
        }
        div.body {
            overflow: auto;
            margin: 0 auto;
            width: 960px;
            display: block;
            background-color: white;
        }
    </style>
</head>
<body>
    <div  id="header" colspan="13" align="left">
        <img src="../tb.jpg?v=109702" style="float:right"/>
    </div>
    <div class="body">
        <div style="margin-top:5px;">
            <h3>An error has occured.</h3>
        </div>
    </div>
</body>
</html>

You are free to edit this files as you keep respect for the html code within these pages. After you edit this pages you must repack te trustbuilder-web.war file or have your application server working with the unpacked files.

Setting thread limits and queuing

The engine can be configured to limit the total amount of requests as well as the maximum time a certain request can take.

To adjust the limits of your Trustbuilder instance you have to alter the trustbuilder.properties located in your TB_HOME. The 2 important keys are

  • engine.limit.concurrent : Maximum number of requests to allow (the request n+1 receives a 503 Server too busy)
  • engine.limit.timeInMs : Maximum of time a request can take before aborting the request.

Performance Tuning

Measuring is knowing, add the following to your logback.xml

<!-- start performance logging entry -->
<appender name="PERFLOG" class="ch.qos.logback.core.FileAppender">
    <file>${user.dir}/perflog.csv</file>
    <encoder><Pattern>%msg%n</Pattern></encoder>
</appender>

<!-- Outputs epoch,item,requests,min,avg,max over all handled requests so far, set to INFO if not wanted -->
<logger name="Engine.Perf" level="DEBUG" additivity="false"><appender-ref ref="PERFLOG" /></logger>

<!-- Outputs epoch,item,time over handled item, set to INFO if not wanted -->
<logger name="Engine.PerfOne" level="DEBUG" additivity="false"><appender-ref ref="PERFLOG" /></logger>

<!-- end performance logging entry -->

This will generate a comma delimited file perflog.csv in the home folder. Which you can then import in excell or something else.

The format of this csv file contains the following columns:

  • time since epoch
  • name of statistic
  • number of requests counted
  • min. time in ms.
  • average time in ms.
  • maximum time in ms.

You can load this perflog.csv into an rrd (round robin database) so even over longer periods of time you can see what the performance is like. Below you can see the script

#!/bin/sh
while IFS=, read time item req; do
if [ ! -e $item.rrd ]; then
#START=`date -v-1d +%s`
START=`date --date='1 days ago' +%s`
rrdtool create $item.rrd --start $START -s 10 DS:temp:GAUGE:600:U:U  RRA:AVERAGE:0:1:5000
fi
linuxEpoch=`echo $time/1000 |bc`
rrdtool update $item.rrd ${linuxEpoch}:${req}
done  $1

#In order to get graphs for a particular step
#rrdtool graph $FILE.jpg --start $START --end `date +%s` DEF:mytemp=$FILE.rrd:temp:AVERAGE LINE2:mytemp#0000FF HRULE:35#FF0000 HRULE:30#FFA500
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.