Skip to main content

Overview

Proper performance tuning is essential for delivering a responsive Sakai experience to users. This guide covers JVM optimization, database tuning, caching strategies, and infrastructure best practices.

JVM Tuning

Heap Memory Configuration

Configure JVM memory settings in $TOMCAT_HOME/bin/setenv.sh:

Memory Sizing Guidelines

Leave 40-50% of system RAM for OS file system caching and other processes. Do not allocate all RAM to JVM heap.

Garbage Collection Strategy

G1 Garbage Collector is ideal for Sakai:

ZGC (For Java 17+ Large Heaps)

For very large heaps (>32GB):

JVM Monitoring

Enable JMX for monitoring:

Database Performance

Connection Pool Tuning

Optimize database connection pool in sakai.properties:

MySQL/MariaDB Optimization

Database Configuration

Optimize my.cnf for Sakai:

Index Optimization

Regularly analyze and optimize tables:

Slow Query Log

Enable slow query logging:
Analyze slow queries:

Hibernate Optimization

Configure Hibernate in sakai.properties:
Never enable hibernate.show_sql=true or hibernate.generate_statistics=true in production environments.

Caching Configuration

Apache Ignite (Distributed Cache)

Sakai uses Apache Ignite for distributed second-level caching in clustered deployments.

Ignite Configuration

Configure in sakai.properties:

Cache Data Regions

Configure in kernel-impl/src/main/webapp/WEB-INF/ignite-components.xml:

Memory Cache Configuration

Configure cache time-to-live in sakai.properties:

Tomcat Performance

Connector Configuration

Optimize $TOMCAT_HOME/conf/server.xml:

Thread Pool Sizing

Typical multiplier: 25-50 for I/O-bound applications like Sakai Example for 8-core server:

Session Configuration

Optimize session management in sakai.properties:

Content Delivery Optimization

Content Hosting Performance

Optimize content hosting in sakai.properties:

Cloud Storage for Content

For large-scale deployments, use cloud storage:
Cloud storage reduces local disk I/O and enables better scalability for content hosting.

Search Performance

Elasticsearch Configuration

If using Elasticsearch for search:

Elasticsearch Cluster Settings

Scheduled Job Optimization

Job Scheduler Configuration

Optimize background jobs in sakai.properties:

Disable Unnecessary Jobs

Network and Infrastructure

Load Balancer Configuration

For clustered deployments, configure load balancer with:
  • Session Affinity: Enable sticky sessions
  • Health Checks: HTTP GET to /portal/login
  • Connection Draining: 60 seconds
  • Keep-Alive: Enable with 60 second timeout

Apache HTTPD Front-End

Configure Apache as reverse proxy:

CDN for Static Assets

Offload static content to CDN:

Monitoring and Metrics

Enable Performance Metrics

JMX Metrics

Monitor key metrics via JMX:
  • Heap memory usage
  • Thread count and state
  • Database connection pool stats
  • Cache hit rates
  • Request throughput

Performance Testing

Load Testing Tools

Use tools to validate performance:
  • Apache JMeter: Load testing
  • Gatling: Performance testing
  • Artillery: Modern load testing
Example JMeter test plan:

Performance Baselines

Establish baselines:

Best Practices

Regular Maintenance

Schedule regular database optimization, cache clearing, and log rotation during off-peak hours.

Monitor Continuously

Implement comprehensive monitoring to identify performance degradation before it impacts users.

Scale Horizontally

Add application nodes rather than vertically scaling when hitting resource limits.

Test Under Load

Regularly conduct load testing to validate performance under peak usage scenarios.

Troubleshooting Performance Issues

High CPU Usage

  1. Capture thread dump: kill -3 <tomcat_pid>
  2. Analyze with tools like FastThread or VisualVM
  3. Look for tight loops or blocking operations
  4. Check scheduled jobs running during peak hours

Memory Issues

  1. Analyze heap dump with Eclipse MAT
  2. Look for memory leaks (retained objects)
  3. Check cache sizes and TTL settings
  4. Review large object allocations

Slow Database Queries

  1. Enable slow query log
  2. Use EXPLAIN to analyze query execution plans
  3. Add missing indexes
  4. Optimize queries or add caching

Cache Inefficiency

  1. Monitor cache hit rates via JMX
  2. Adjust TTL settings
  3. Increase cache size if hit rate is low
  4. Review what is being cached