Host Resource Limits w/o explicit reservations?

Had some questions about Host Resource Limits when there are no explicit reservations.

If I have a host with 8gig memory and no containers. Then I set the rancher host Resource Limit to 7 gigs.

So 7 gigs is available.

Then I add 4 java containers in a stack with no mem_reservation: limits specified.

Question 1) Does the schedule require the reservations to be set for each container for it to apply any limits for the host?

Question 2) What happens if the 4 containers start up and use 7 gigs of the memory and I start a new container with no reservation? Will the new container be limited by the scheduler when there are no specified container reservations?

Any there any best practices for setting reservations for java services w/ jvms? Do you need to set the java opts to match the container reservation so jvm has enough memory?

Thanks!

Reservations and Limits are two separate things. Reservations are just that and affect only scheduling. Limits restrict how much the container is actually allowed to use once running.

To use reservations effectively you need them on all the significant services. A service with no reservation set reserves nothing and can go to any active host that meets the other scheduling constraints.

Thanks.

Is mem_reservation: just an envir variable that can be set as a default value in an image? Or does it have to be applied through the service yml when stack is created or upgraded?

It has to applied via yaml when stack is created/updated.