Best Practices for Reducing Memory Issues
When you develop and monitor your ThingWorx solutions, use the following best practices to avoid memory-driven performance issues:
Monitor the daily usage of memory in your ThingWorx solution functions. This helps you understand the memory usage in your solution in steady state and under stress-conditions.
Perform scalability testing with production-like data using Apache JMeter or similar utilities to model many users and devices interacting with your ThingWorx solution at the same time.
You must ensure that enough system resources are allocated for scalability testing. Most production systems require 64 GB of RAM, out of which 40 GB is allocated to Java heap.
Stream queries can retrieve large number of records from the database before they are further filtered in the JVM memory. It is recommended to add appropriate time intervals to minimize the number of rows retrieved by streams. This helps especially when data starts to accumulate on the daily production use.
If possible, use external systems, such as a database server, microservice server, or a federated ThingWorx server for heavy in-memory processing.
Optimize long running services. Any service running for over 10 minutes is likely to lock memory, database connections, and other server resources during execution. The scheduled services should also be executed and completed in under 10 minutes to ensure memory resources are returned to the system.
Consider implementing a high availability cluster for production usage. This ensures that the overall solution remains available even if one of the ThingWorx nodes encounters memory issues.
Was this helpful?