If java is using too much CPU you can try the following modification. I was using a 1GB Memory droplet from Digital Ocean, but I needed to upgrade to 2GB to be able to make this adjustment.

While I didn’t make this additional adjustment, Unifi says you can enable a high-performance garbage collector with the following setting.

https://help.ui.com/hc/en-us/articles/115005159588-UniFi-How-to-Tune-the-Controller-for-High-Number-of-UniFi-Devices

It looked good for about 4 hours, but then it spiked to 100% again. I tried upgrading MongoDB, so we will see