cancel
Showing results for 
Search instead for 
Did you mean: 
jeesshnasree
Starfighter Starfighter
Starfighter
  • 318 Views

where is heap memory source in Linux OS in VM

Hi All,

 

I have VM machine & below settings but have doubts on heap memory usage mechanism .
Please find below provided details . Please check & guide me ,


Below details are sample details &  provide as environment parameters in the  Virtual machine . 
Please find below details for heap memory mechanism purpose mount points with product  configured details  (Samples )  .

First is configuration :

---------------------------------------------------------

1)  root     FS     -   /             100 GB
2) tmp     FS     -   /tmp        20 GB       

 3) home  FS     -   /home     30 GB

4) var       FS     -   /var         100 GB

5) opt       FS     -  /opt          100 GB

6)  SWAP          -                    16 GB

7) RAM              -                    8 GB

Cores            -                     4 cores

9) BIT                -                      64 BIT 

10) Linux OS     -                     RHEL 8.X

11) Product       -                     Tomcat 10.X
12) Prouct Instances  -           4 Tomcat Instances


  Product details In  Virtual machine :
-------------------------------------------------------------------------------------------
-   I am using Tomcat 10.X   product .

-     Heap free memory - Minimum  8 GB &  Max 16 GB  
-     4 instances 


Final one , now I have 4 Instances -  4 * 8 ( Minimum Heap free memory )  & 4 * 16 ( Max Heap free memory ) .

I have 8 GB Physical RAM in the machine then how use heap memory for these 4 instances in my VM .

Please explain me , about how heap memory use in the machine as per mentioned above criteria .


I assumed 4 Instance Heap memory usage on Tomcat 10.X in VM:
Below details for Heap memory config on each instance ( Samples ) in VM  : 
minimum 4 (instance) 8 GB then total heap memory is 32 GB in the machine & 
maximum 4 ( instance) 16  GB  then total heap memory is 64 GB in the machine , 


I provide above details for below questions .

 

Now Question starting here ( doubts ) :

-------------------------------------------------------------------------------------------
1 )  How machine allocates Heap Memory for instance in machine ?
2 )  Where is the source memory for heap memory  ?
3 ) What is the max size heap memory value in the machine ?
4 )  Any dependency with RAM for heap memory of 4 Tomcat Instances ?

5 ) How heap memory mechanism works in the machine , please explain in detail information 
6 )  if my RAM (/proc/meminfo) used 100% & no free memory then how works these 4 Tomcat  mentioned instances  ? 


I am waiting for your valuable information . 
Please provide me guidance .

Note : I am learning new technologies from scrach .

Regards,
Jeesshnasree .

0 Kudos
1 Reply
Travis
Moderator
Moderator
  • 298 Views

@jeesshnasree -

There are some details missing here, but some things can be broken down a little and there are things that can be adjusted and tuned. First off, in general, VMs are always limited by physical memory and RAM that is installed on the system. The kernel manages data that is in the RAM and can be swapped out on your disk. This is at the physical layer, so if I understand your setup correctly, you have 8GB physical RAM and then a 16GB SWAP partition, so with swapping, essentially 24GB of memory can be thought to be available. There is a vm.swappiness setting that can help control how performance on the RAM and memory is used and allocated.

The missing pieces of information is that you have mentioned you are running VMs on top of the physical layer, so those VMs would need to be running on a hypervisor or virtualization technology. Assuming you are running Linux and using RHEL, you might be using KVM. KVM allows to overcommit (over allocate the amount of memory to the VM). It is also possible to use KSM to help save on memory. It was not mentioned directly how you created the VMs as you can guarantee a minimum amount of memory, have a requested amount of memory, and then allow memory ballooning.

Finally, not only do you have the physical swap and RAM on the bare metal system, you have a defined amount of virtual memory VM and you most likely have defined SWAP on the VM which further impacts performance as the VM swaps its memory to the virtual disk and the read/write speed would differ based on the driver used to present the virtual disk (virtio) or (virtio-scsi).

Most likely your memory when overcommitting resources will always show as 100% of your physical RAM as it is used by the main "bare-metal machine" and provided/allocated to the hypervisor or virtualization technology being used to create the VM. The kernel on the bare-metal system (most likely using KVM/qemu) manages the true physical memory and provides to the system. Overall, you will never get 64GB RAM/memory for virtualization, but depending on the configuration of the VMs, it can appear that way.

One thing that could assist in improving performance would be to have your SWAP disk on physical be SSD/NVME to speed up read/write and then to provide different physical disks NVME/SSD to the VMs as storage/swap because again, it is possible for the internal VMs to have SWAP, which also hasn't been indicated in your post.

Tomcat is running in a JVM so JAVA manages the HEAP memory and communicates with the kernel in the VM to create and make all memory requests. It then utilizes the resources provided by the hypervisor to manage the memory requests. In your scenario, it is possible to run the four (4) VMs, but it is possible that if all of them burst to the maximum memory that performance will come to almost a halt because most of the RAM will be virtual memory and have heavy utliization on SWAP.

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training
0 Kudos
Join the discussion
You must log in to join this conversation.