Home > Casper, JSS, Linux, Mac administration, Unix, Windows > Performance tuning for the Casper JSS

## Performance tuning for the Casper JSS

One of the challenges Casper admins can run into is performance tuning, which can require going into parts of the JSS that you normally go into only when JAMF Support asks you to do so. To help with this process, there are formulas which you can use to calculate if your JSS’s Tomcat and MySQL services are configured for best performance.

Before proceeding further, I want to emphasize that a) check with JAMF Support first and b) you should always, always, always make backups of your JSS before changing settings. I assume no responsibility and bear no culpability if your JSS breaks as a result of anything you implement as a result of reading this post. I am also not responsible for incorrect math, ruining anyone’s weekend, or that long talk you now need to have with your boss about why your JSS is now broken.

One other thing to be aware of is that I’m going to be focusing on Linux and Windows in this post since those are the platforms that I’m most familiar with for hosting a Casper 9 JSS.

For more details, see below the jump:

There are three sets of settings that can be adjusted to improve (or degrade) the performance of your JSS:

max_connections – located in MySQL’s my.cnf config file
MaxPoolSize – located in /path/to/tomcat_directory/webapps/ROOT/WEB-INF/xml/DataBase.xml

The formula for calculating the optimum max_connections setting in MySQL’s my.cnf configuration file is shown below:

max_connections=(n X p)+1


This formula sets n to equal the number of webapps (i.e. JSSs) you have connecting to the MySQL database and p equals the value of MaxPoolSize. The reason for the +1 in the formula is to make sure that, no matter how many connections your JSS is making, you have at least one unused and open connection to communicate with your MySQL database.

The value of MaxPoolSize is set by default to 90 in the JSS, so most JSSs should be able to use this formula:

max_connections=(n X 90)+1


The value of MaxPoolSize also affects the maxThreads value. The value of maxThreads defines the maximum number of request processing threads to be created, which therefore determines the maximum number of simultaneous requests that can be handled. The formula for calculating the optimum maxThreads setting in Tomcat’s server.xml configuration file is shown below:

maxThreads=(\$MaxPoolSizeNumber X 2.5)W


This formula sets W to equal the number of webapps (i.e. JSSs) you have running in Tomcat.

As mentioned previously, the value of MaxPoolSize is set by default to 90 in the JSS, so most JSSs should be able to use this formula:

maxThreads=(90 X 2.5)W


The other thing you can do to affect performance is that you can adjust how much memory is being allocated to Java, which in turn increases how much memory the JSS’s Tomcat webapp is able to use (since both Tomcat and the JSS webapp are Java applications.) If you’ve been installing and/or updating your Casper server using JAMF’s installer, I strongly recommend using the JSS Database Utility for adjusting Tomcat’s memory settings. You can access those settings via the following process:

1. Launch the JSS Database Utility
2. Click on the Utilities menu and select Change Tomcat Settings…

4. When finished, click the Apply Settings button

5. Restart Tomcat

Note: You can also adjust MySQL’s max_connections settings via the JSS Database Utility by selecting Change MySQL Settings…. and adjusting the Max Database Connections value.

If you installed your JSS using the manual installation process, you may not be able to use the JSS Database Utility for adjusting the Java settings. Instead, you’ll need to set the needed values via alternate means. See below for a description of the attributes used to set Java’s memory values:

• -Xms: Indicates the minimal heap size for memory used by Java (i.e. what’s the minimum amount of memory that Java can use.)
• -Xmx: Indicates the maximum heap size for memory used by Java (i.e. what’s the maximum amount of memory that Java can use.)
• -XX:MaxPermSize: Indicates the maximum memory used for PermGen.
• -Djava.awt.headless: Configures Java to run in headless mode for systems that don’t have displays, keyboards or mice
• -server: Instructs the launcher of the Java application to use the Java HotSpot Server VM.

On Windows, you can set Tomcat’s memory on Windows using the Tomcat7w.exe application located in C:\path\to\tomcat_directory\bin. Once you have it open, click on the Java tab and set the memory options there.

On Linux, you set the memory options with a shell script named setenv.sh which is stored in /path/to/tomcat_directory/bin. Here’s an example of what this script can look like:

#!/bin/sh

export CATALINA_OPTS="-Xms128m -Xmx256m -XX:MaxPermSize=128m -Djava.awt.headless=true -server"


As you can see from the information above, there’s a lot that can go into performance tuning for a Casper JSS. JAMF has tried to set default settings that make sense for most environments, but settings that may have made sense at the initial JumpStart may now need adjustment as the number of Macs managed by your Casper server has grown.

Since different operating systems store MySQL and Tomcat in different places, please see below for a listing of where Tomcat and MySQL (along with their various configuration files) are installed.

MySQL

Here’s where MySQL and its files is located for Windows, Ubuntu and Red Hat Enterprise Linux. My working assumption for these paths is that MySQL Server 5.6 is installed:

Ubuntu:

MySQL – /var/lib/mysql
MySQL configuration file – /etc/mysql/my.cnf

Red Hat Enterprise Linux:

MySQL – /usr/bin/mysql
MySQL configuration file – /etc/my.cnf

Windows:

MySQL – C:\Program Files\MySQL\MySQL Server 5.6
MySQL configuration file – C:\ProgramData\MySQL\MySQL Server 5.6\my.ini

Tomcat and the JSS webapp

If you’re installing and/or updating your JSS using JAMF’s installer for the JSS, here’s where it puts the Apache Tomcat files and JSS webapp files for Windows and Linux (both Red Hat Enterprise Linux and Ubuntu):

Windows JSS installer:

• JSS web application – C:\Program Files\JSS\Tomcat\webapps\ROOT\
• Apache Tomcat – C:\Program Files\JSS\
• JSS Tomcat’s server.xml configuration file – C:\Program Files\JSS\Tomcat\conf\server.xml
• JSS Tomcat’s Java keystore – C:\Program Files\JSS\Tomcat\certs\.keystore
• JSS JSS Database Utility – C:\Program Files\JSS\bin\JSSDatabaseUtil.jar
• JSS Database backup location – C:\Program Files\JSS\Backups\Database\
• JSS Logs – C:\Program Files\JSS\Logs\

Linux JSS Installer (for Red Hat Enterprise Linux and Ubuntu):

• JSS web application – /usr/local/jss/tomcat/webapps/ROOT/
• Apache Tomcat – /usr/local/jss/
• JSS Linux service startup script – /etc/init.d/jamf.tomcat7
• JSS Tomcat’s server.xml configuration file – /usr/local/jss/tomcat/conf/server.xml
• JSS Tomcat’s Java keystore – /usr/local/jss/tomcat/.keystore
• JSS JSS Database Utility – /usr/local/jss/bin/JSSDatabaseUtil.jar
• JSS Database backup location – /usr/local/jss/backups/database/
• JSS Logs – /usr/local/jss/logs/

If you’re installing or updating your JSS using the manual install process, Tomcat needs to be installed separately. Here’s where Tomcat is located for Windows, Ubuntu and Red Hat Enterprise Linux. My working assumption for these paths is that Tomcat 7 is installed:

Windows:

• Apache Tomcat – C:\Program Files\Apache Software Foundation\Tomcat 7.0
• Apache Tomcat’s server.xml configuration file – C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\server.xml
• JSS web application – C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT

Red Hat Enterprise Linux:

• Apache Tomcat – /usr/share/tomcat7
• Apache Tomcat’s server.xml configuration file – /usr/share/tomcat7/conf/server.xml
• JSS web application – /usr/share/tomcat7/webapps/ROOT

Ubuntu:

• Apache Tomcat – /var/lib/tomcat7
• Apache Tomcat’s server.xml configuration file – /var/lib/tomcat7/conf/server.xml
• JSS web application – /var/lib/tomcat7/webapps/ROOT

When troubleshooting, you’ll usually need to check the logs. If you installed using the manual process and properly configured where the logs should be going, here’s where they’re stored for Windows, Ubuntu and Red Hat Enterprise Linux:

Windows:

• C:\Program Files\Apache Software Foundation\Tomcat 7\logs\Catalina.date_goes_here.log
• C:\Program Files\Apache Software Foundation\Tomcat 7\logs\JAMFSoftwareServer.log
• C:\Program Files\Apache Software Foundation\Tomcat 7\logs\JAMFChangeManagement.log

Red Hat Enterprise Linux and Ubuntu:

• /var/log/tomcat7/Catalina.date_goes_here.log
• /var/log/tomcat7/JAMFSoftwareServer.log
• /var/log/tomcat7/JAMFChangeManagement.log

Note: You can set the location for the JAMFSoftwareServer.log and JAMFChangeManagement.log logfiles in /path/to/tomcat_directory/webapps/ROOT/WEB-INF/classes/log4j.properties.

For the directory paths in Tomcat’s log4js.properties file, you can use ” / “ for both Windows and Unix-based systems. If you want to use Windows’ ” ” for paths, you have to use them in pairs (the first  ” ” is for escaping the slash.) Both of the following approaches shown below would work fine:

log4j.appender.LOGFILE.File=C:/path/to/jss.log

log4j.appender.LOGFILE.File=C:\\path\\to\\jss.log

1. October 31, 2016 at 1:33 pm

Thanks for this write up Rich!

Here’s some of the MySQL tuning I’ve done for my instance (about 300 iPads and 600 Macs)

# General
## Memory Usage
join_buffer_size = 256K
sort_buffer_size = 1M

## Informational
server-id = 1

# InnoDB
## Buffer Pool
### the jamfsoftware database uses myISAM for it’s storage engine, so InnoDB is mostly unused
innodb_buffer_pool_instances = 8
innodb_buffer_pool_size = 256M

# Networking
## Data / Memory size
max_allowed_packet = 512M # Recommended by JAMF

max_connections = 301# Recommended by JAMF

thread_cache_size = 12 # 8 + (Max_connections / 100) rounded up

## Various
read_buffer_size = 64K # Possibly increase this, depending on MyISAM performance over time
tmp_table_size = 1G

# MyISAM