6. Performance Tuning

  • JProfiler
  • MAT (Memory Analyzer Tool) [heapdump and MAT from Eclipse]
  • Performance SQL
  • own database indexes
  • pgpool and database cache
  • nginx as a SSL terminator
  • Varnish caching REST responses (JSON) and static files
  • Java Melody
  • New Relic

6.1. Optymalizacje

  • Wyłączyć Activity Stream
  • Update gadżetów na Dashboardzie (update na bazie dla wszystkich gadgetów)
  • Edukacja użytkowników aby nie mieli odpalonych miliona zakładek z JIRĄ
  • Czy wszystkie monitory z Wallboardami są potrzebne?

6.2. Database

  • /var/atlassian/application-data/jira/dbconfig.xml
<pool-min-size>20</pool-min-size>
<pool-max-size>20</pool-max-size>
<pool-max-wait>30000</pool-max-wait>
<validation-query>select 1</validation-query>
<min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
<time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>
<pool-max-idle>20</pool-max-idle>
<pool-remove-abandoned>true</pool-remove-abandoned>
<pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
<pool-test-on-borrow>false</pool-test-on-borrow>
<pool-test-while-idle>true</pool-test-while-idle>

6.3. Garbage Collector

Code Listing 6.1. Jira Garbage Collector
JIRA_HOME="/opt/jira/home"
JVM_SUPPORT_RECOMMENDED_ARGS="-server -XX:MaxPermSize=512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+OptimizeStringConcat -XX:+PrintGCDetails -XX:+DisableExplicitGC -Xloggc:/opt/jira/logs/gc-jira-$(hostname)-$(date +%Y.%m.%d).log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M"
JVM_MINIMUM_MEMORY="512m"
JVM_MAXIMUM_MEMORY="2048m"

# -server
# -XX:MaxPermSize=512m
# -XX:+UseG1GC
# -XX:+PrintGC
# -XX:MaxGCPauseMillis=200
# -XX:+PrintGCDateStamps
# -XX:+PrintGCDetails
# -XX:+UseGCLogFileRotation
# -XX:GCLogFileSize=10M
# -Xloggc:/opt/jira/logs/gc-jira-$(hostname)-$(date +%F).log
# -XX:NumberOfGCLogFiles=10
# -XX:+OptimizeStringConcat
# -XX:+DisableExplicitGC



# -Xms --> Minimum Memory
# -Xmx --> Maximum Memory
# -Xmn --> Heap of Younger Generation
# -Xss --> Thread Stack Size
# -XX:MaxMetaspaceSize --> Maximum Memory for Non-Heap Metaspace.
# -XX:NewRatio --> Ratio between Younger and Older Generation Memory sizes.
# -XX:ParallelGCThreads --> No of Parallel GC threads. By default, the GC threads will be equal to the number of CPUs of the Node / VM. Used when Parallel Garbage collectors are configured.






GC_JVM_PARAMETERS=""
GC_JVM_PARAMETERS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCCause ${GC_JVM_PARAMETERS}"
GC_JVM_PARAMETERS="-Xloggc:$LOGBASEABS/logs/atlassian-jira-gc-%t.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20M ${GC_JVM_PARAMETERS}"




## Defaultowe ustawienia Jiry po instalacji:
/opt/atlassian/jira/jre//bin/java
	-Djava.util.logging.config.file=/opt/atlassian/jira/conf/logging.properties
	-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
	-Xms384m
	-Xmx768m
	-Djava.awt.headless=true
	-Datlassian.standalone=JIRA
	-Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true
	-Dmail.mime.decodeparameters=true
	-Dorg.dom4j.factory=com.atlassian.core.xml.InterningDocumentFactory
	-XX:-OmitStackTraceInFastThrow
	-Datlassian.plugins.startup.options=
	-Djdk.tls.ephemeralDHKeySize=2048
	-Djava.protocol.handler.pkgs=org.apache.catalina.webresources
	-Xloggc:/opt/atlassian/jira/logs/atlassian-jira-gc-%t.log
	-XX:+UseGCLogFileRotation
	-XX:NumberOfGCLogFiles=5
	-XX:GCLogFileSize=20M
	-XX:+PrintGCDetails
	-XX:+PrintGCDateStamps
	-XX:+PrintGCTimeStamps
	-XX:+PrintGCCause
	-classpath /opt/atlassian/jira/bin/bootstrap.jar:/opt/atlassian/jira/bin/tomcat-juli.jar
	-Dcatalina.base=/opt/atlassian/jira
	-Dcatalina.home=/opt/atlassian/jira
	-Djava.io.tmpdir=/opt/atlassian/jira/temp
	org.apache.catalina.startup.Bootstrap start

6.4. Monitorowanie

6.5. Rozwiązywanie problemów

grep '/rest' /opt/atlassian/jira/logs/access_log.* |awk '{print $7}' |sort |uniq -c |sort -n

6.6. Assignments

6.6.1. Administracja - Garbage Collector

  1. Zmień Garbage Collector na G1
  2. Zmień Xmx na 1GB
  3. Wepnij Java Melody do monitorowania

6.6.2. Administracja - Zmiana Javy

  1. Zainstaluj nową Javę na serwerze w katalogu /opt/java/$VERSION
  2. Utwórz symlink /opt/java/default/ wskazujący na /opt/java/$VERSION (dlaczego to dobra praktyka?)
  3. Zrestartuj Jirę by wykorzystywała nową Javę