Choosing Best Limits of Memory and CPU for Apps

I have a very basic question. I have TrueNas Scale running version 24.10.0.2. For the sake of simplicity, I have 32 GB of Memory and 8 total cores on my CPU.

When I install Nextcloud and Immich, do I set the memory at 16 GB and CPUs at 4 for Nextcloud and 16 GB for memory and 4 CPU cores for Immich so that I use the full memory and CPUs of my system? What if I set it at 32 GB of memory and 8 cores for BOTH apps?

Should I set it lower so that there is memory left over for the functioning of the data?

I guess the question really boils down to is the memory usage “limits” that TrueNAS can use as a max or is it a cumulative number that I need to be mindful of setting in a way that doesn’t exhaust the system running overall?

I don’t know where to find this information. I have looked. If someone can help point me in the right direction for this softball, please let me know.

Matt