Skip to main content

How to Configure Memory and Connection Pool?

Maximize your ServiceOps performance and stability by fine-tuning memory allocation and database connection pools to match your specific workload.

Proper memory and connection pool configuration is essential for optimizing ServiceOps performance, ensuring efficient resource utilization, and maintaining system stability under varying workloads. This guide provides comprehensive procedures for configuring memory allocation and database connection pools across all ServiceOps components.

ServiceOps performance optimization involves two critical aspects:

  • Memory Configuration: Optimizing Java heap sizes for different services
  • Connection Pool Configuration: Managing database connection pools for optimal throughput

Proper configuration of these parameters can significantly improve application responsiveness, reduce latency, and enhance scalability.

Prerequisites

Before configuring memory and connection pools:

System Requirements

  • Root Access: Administrative privileges on the ServiceOps server
  • Service Status: All services must be operational before configuration
  • Backup: Always backup configuration files before making changes
  • Elasticsearch: Must be running before configuring other services

Important Notes

  • Update Order: Always update Elasticsearch memory first, then other services
  • Memory Validation: Ensure minimum memory is always less than maximum memory
  • Backup Requirement: Take configuration backups before any changes
  • Service Dependencies: Understand service dependencies and startup order

Memory Configuration

Memory configuration involves setting Java heap sizes for different ServiceOps services. Proper memory allocation ensures optimal performance and prevents out-of-memory errors.

Set Java Heap Sizes

Two critical JVM parameters control memory allocation:

  • -Xms: Initial heap size (minimum memory allocated at startup)
  • -Xmx: Maximum heap size (maximum memory the JVM can use)

Memory Allocation Matrix

The following matrix provides recommended memory settings based on total server memory:

Memory Martix
ServiceOps Services16 GB32 GB64 GB
MinimumMaximumMinimumMaximumMinimumMaximum
Main Server10244096409610240102424576
Analytics Server1024409640968192102416384
Plugin Server512102451210245122048
Elasticsearch512102451210245122048
Memory Allocation Guidelines
  • Allocate 50-75% of total server memory to Java heap sizes
  • Reserve remaining memory for operating system and other processes
  • Consider workload patterns when choosing between minimum and maximum values
  • Monitor memory usage after configuration to optimize settings

Configuring Main Server Memory

The main server handles core ServiceOps functionality and requires significant memory allocation.

  1. Stop Main Server Service:

    systemctl stop ft-main-server
    systemctl status ft-main-server

  2. Edit Configuration File:

    cd /opt/flotomate/main-server/lib/
    vim boot-hosted-exec.conf

  3. Update Memory Settings:

    The default memory value is -Xms512m -Xms2048m. Replace it with a new value based on the total server memory. To allocate memory, use the above memory matrix table. For example, If the Total Server Memory is 16 GB, you can assign the main-server with min 1024 and max 5120 memory.

    Example: -Xms1024m -Xms5120m

    Once done, save the file.

  4. Save and Restart Service:

    Check the main-server service status, start its service, and again verify its status using the below commands:

    # Save the file and restart service
    systemctl status ft-main-server
    systemctl start ft-main-server
    systemctl status ft-main-server

Configuring Analytics Server Memory

The analytics server handles reporting and analytics functions.

  1. Login

    Login to the terminal server using the root user.

  2. Stop Analytics Server Service:

    systemctl stop ft-analytics-server
    systemctl status ft-analytics-server

  1. Edit Configuration File:

    cd /opt/flotomate/cm-analytics/lib/
    vim analytics-hosted-exec.conf

  2. Update Memory Settings:

    The default memory value which is -Xms512m -Xms2048m. Replace it with a new value based on the total server memory. To allocate memory, use the above memory matrix table. For example, If the Total Server Memory is 16 GB, you can assign the analytics-server with min 1024 and max 4096 memory.

    Example: -Xms1024m -Xms4096m

  3. Save and Restart Service:

    Check the analytics server service status, start its service, and again verify its status using the below commands:

    systemctl status ft-analytics-server
    systemctl start ft-analytics-server
    systemctl status ft-analytics-server

Configuring Plugin Server Memory

The plugin server handles third-party integrations and plugins.

  1. Login

    Login to the terminal server using the root user.

  2. Stop Plugin Server Service:

    systemctl stop ft-plugins-server
    systemctl status ft-plugins-server

  3. Edit Configuration File:

    cd /opt/flotomate/plugin-server/lib/
    vim pluginserver-hosted-exec.conf

  4. Update Memory Settings: The default memory value which is -Xms512m -Xms1024m. Replace it with a new value based on the total server memory. To allocate memory, use the above memory matrix table. For example, if the Total Server Memory is 64 GB, you can assign the plugin-server with min 512 and max 2048 memory.

    Example: -Xms512m -Xms2048m

  1. Save and Restart Service:

    Check the plugins-server service status, start its service, and again verify its status using the below commands:

    systemctl status ft-plugins-server
    systemctl start ft-plugins-server
    systemctl status ft-plugins-server

Configuring Elastic Search Memory

Elasticsearch requires careful memory configuration as it uses JVM heap for both data storage and search operations.

  1. Stop Elastic Search Service:

    systemctl stop elasticsearch
    systemctl status elasticsearch

  2. Edit Configuration File:

    cd /usr/share/elasticsearch-7.3.2/config
    vim jvm.options

  3. Update Memory Settings:

    The default memory value which is -Xms512m -Xms768m. Replace it with a new value based on the total server memory. To allocate memory, use the above memory matrix table. For example, if the total server memory is 64 GB, you can assign the elasticsearch with min 1024 and max 4096 memory.

    Example: -Xms512m -Xms2048m

  4. Save and Restart Service:

    Check the elastic search service status, start its service, and again verify its status using the below commands:

    systemctl status elasticsearch
    systemctl start elasticsearch
    systemctl status elasticsearch

Elasticsearch Memory Guidelines
  • Never allocate more than 50% of total system memory to Elasticsearch
  • Elasticsearch heap should not exceed 32GB (even on larger servers)
  • Ensure sufficient memory for file system cache
  • Monitor heap usage to prevent out-of-memory errors

Connection Pool Configuration

Connection pooling manages database connections efficiently, reducing connection overhead and improving application performance.

Terms:

  • Maximum Pool Size: The maximum number of connections that can be opened simultaneously. It must be configured based on the expected peak load and database capacity.
  • Minimum Pool Size: The minimum number of connections to keep open in the pool to reduce latency during peak times.

Connection Pool Matrix

The following matrix provides recommended connection pool settings based on technician count and IT asset count:

Connection Matix
ServiceOps Database ConnectionTechniciansIT Assets
205010015020020005000100001500020000
Main Service - Min10202020201020202020
Main Service - Max5010015020025050100150200300
Analytics Service - Min510202020510202020
Analytics Service - Max40501001502004050100100150
note
  • For a fresh installation, the application-custom.properties file will be blank. You need to update it manually.
  • Verify the file after ServiceOps upgrade.
  • Please take a backup of the configuration before making any changes.
Connection Pool Guidelines
  • Base settings on expected peak concurrent users
  • Consider database server capacity when setting maximum connections
  • Monitor connection pool usage to optimize settings
  • Balance between performance and resource utilization

Configuring Main Server Connection Pool

note

Please back up the config files before making any changes.

  1. Navigate to Configuration Directory:

    cd /opt/flotomate/main-server/config/
    vim application-custom.properties

  2. Update Connection Pool Settings:

    Update the DB connection values based on the technician count and using the database connection matrix table.

    # Default values
    com.flotomate.db.minConnPool=20
    com.flotomate.db.maxConnPool=30

    # Example for 20 technicians
    com.flotomate.db.minConnPool=10
    com.flotomate.db.maxConnPool=50

    # Example for 100 technicians
    com.flotomate.db.minConnPool=20
    com.flotomate.db.maxConnPool=150

Update the required custom changes and once done, save the file.

  1. Restart Main Server Service:
    systemctl stop ft-main-server
    systemctl start ft-main-server

Configuring Analytics Server Connection Pool

note

Please back up the config files before making any changes.

  1. Navigate to Configuration Directory:

    cd /opt/flotomate/cm-analytics/config/
    vim application-custom.properties

  2. Update Connection Pool Settings:

    Update the DB connection values based on the technician count and using the database connection matrix table.

    # Default values
    com.flotomate.db.minConnPool=10
    com.flotomate.db.maxConnPool=25

    # Example for 20 technicians
    com.flotomate.db.minConnPool=5
    com.flotomate.db.maxConnPool=40

    # Example for 100 technicians
    com.flotomate.db.minConnPool=20
    com.flotomate.db.maxConnPool=100

Update the required custom changes and once done, save the file.

  1. Restart Analytics Server Service:
    systemctl stop ft-analytics-server
    systemctl start ft-analytics-server

Performance Monitoring and Optimization

Memory Monitoring

Monitor memory usage after configuration:

# Check JVM memory usage
jstat -gc <process_id>

# Monitor system memory
free -h

# Check service memory usage
ps aux | grep java

Connection Pool Monitoring

Monitor database connection usage:

# Check PostgreSQL connections
psql -U postgres -c "SELECT count(*) FROM pg_stat_activity;"

# Monitor connection pool metrics
# Check application logs for connection pool statistics
tail -f /opt/flotomate/main-server/logs/application.log

Performance Tuning Recommendations

  1. Memory Optimization:

    • Monitor garbage collection frequency
    • Adjust heap sizes based on usage patterns
    • Consider G1GC garbage collector for large heaps
  2. Connection Pool Optimization:

    • Monitor connection wait times
    • Adjust pool sizes based on peak usage
    • Consider connection timeout settings
  3. System-Level Optimization:

    • Ensure adequate swap space
    • Monitor disk I/O performance
    • Optimize network settings

Troubleshooting

Out of Memory Errors

  • Problem: Java heap space errors or system memory exhaustion
  • Solution:
    • Increase heap size within recommended limits
    • Monitor memory usage patterns
    • Consider reducing concurrent load
    • Check for memory leaks in applications

Connection Pool Exhaustion

  • Problem: Database connection timeouts or pool exhaustion
  • Solution:
    • Increase maximum connection pool size
    • Check for connection leaks
    • Monitor database server capacity
    • Optimize query performance

Service Startup Failures

  • Problem: Services fail to start after configuration changes
  • Solution:
    • Verify configuration file syntax
    • Check memory allocation values
    • Ensure sufficient system resources
    • Review service logs for specific errors

Best Practices

Memory Allocation

  • Start with conservative settings and adjust based on monitoring.
  • Never allocate more than 75% of total system memory.
  • Keep minimum and maximum heap sizes close for stability.
  • Monitor garbage collection patterns.

Connection Pool Management

  • Base settings on actual usage patterns, not theoretical maximums.
  • Monitor connection wait times and adjust accordingly.
  • Consider database server capacity when setting maximum connections.
  • Implement connection timeout settings.

Change Management

  • Always backup configuration files before changes.
  • Test changes in a non-production environment first.
  • Make incremental changes and monitor the impact.
  • Document all configuration changes.

Next Steps

After configuring memory and connection pools:

  1. Monitor Performance: Establish baseline metrics and monitor regularly
  2. Optimize Settings: Adjust configurations based on actual usage patterns
  3. Plan for Growth: Consider future capacity requirements
  4. Document Configuration: Maintain detailed configuration documentation
  5. Regular Reviews: Schedule periodic performance reviews and optimizations
Success Indicators

Your memory and connection pool configuration is successful when:

  • All services start without memory errors
  • Application response times are acceptable
  • Database connections are stable
  • System resources are utilized efficiently
  • Performance metrics meet business requirements
  • No out-of-memory errors occur during peak usage