This guide explains how to tune the performance of your Neo4j Enterprise clusters.
The Neo4j Enterprise Operator has been optimized for production environments with several key performance improvements:
- Optimized Rate Limiting: The controller uses intelligent rate limiting to prevent excessive API calls (~34 reconciliations per minute vs. 18,000+)
- Status Update Optimization: Status updates only occur when cluster state actually changes, reducing unnecessary API server load
- ConfigMap Debouncing: 2-minute debounce mechanism prevents restart loops from configuration changes
- Memory Validation: Automatic validation ensures Neo4j memory settings don't exceed available resources
- Resource Recommendations: Built-in recommendations for optimal CPU and memory allocation based on cluster size
- Efficient Monitoring: Lightweight resource monitoring with minimal overhead
One of the most important factors for performance is resource allocation. You can configure the CPU and memory resources for your Neo4j pods using the spec.resources field in the Neo4jEnterpriseCluster resource. It is crucial to set both requests and limits for predictable performance.
resources:
requests:
cpu: "2"
memory: "4Gi"
limits:
cpu: "4"
memory: "8Gi"The operator includes intelligent memory validation that:
- Ensures Neo4j heap settings don't exceed available container memory
- Provides automatic recommendations for optimal memory allocation
- Validates memory ratios between heap, page cache, and system overhead
resources:
requests:
memory: "4Gi" # Minimum for stable operation
limits:
memory: "8Gi" # Allows 4-6GB for Neo4j heap + page cacheFor advanced use cases, you can tune the JVM settings for your Neo4j pods using environment variables in the spec.env field. This allows you to control settings like heap size, garbage collection, and more.
env:
- name: NEO4J_dbms_memory_heap_initial__size
value: "4G"
- name: NEO4J_dbms_memory_heap_max__size
value: "4G"
- name: NEO4J_dbms_memory_pagecache_size
value: "2G"The operator includes built-in performance monitoring capabilities:
- Real-time tracking of CPU, memory, and storage utilization
- Neo4j-specific metrics including transaction rates and query performance
- Automatic detection of resource constraints and bottlenecks
- ConfigMap update frequency and debounce effectiveness
- Controller reconciliation patterns and efficiency metrics
- Cluster health and readiness status tracking
- Set appropriate resource limits: Ensure containers have sufficient CPU and memory
- Use persistent storage: Configure appropriate storage classes for your workload
- Enable monitoring: Monitor both Kubernetes and Neo4j metrics
- Plan capacity: Monitor trends and scale manually as needed
- Use smaller resource allocations: Optimize for development machine resources
- Enable debug logging: Set log levels for troubleshooting
- Use local storage: Consider local storage for faster development cycles