cancel
Showing results for 
Search instead for 
Did you mean: 

Swap space becomes critically low in the system

Former Member
0 Kudos

Hi,

We are facing a situation where the swap space space  is critically low in the system, there is just 10 % available swap space in the system

And we can't see the swap space being released to the OS .

This is one of the  Application servers we have for R3 system.

SAP environment:

SAP Netweaver 7.01

LINUX RHEL

Oracle 11g

$free -m //outut

As you can see we have 64G physical memory allocated to this application server whereas the configured swap space is around 20G.

This Linux box houses two application server one for R3 and the other for CRM.

Would appreciate if you can tell me what should be done to release the swap space as above shows that 18 gig of 20 is being used right now.

Regards,

Rakesh

Accepted Solutions (1)

Accepted Solutions (1)

former_member182657
Active Contributor
0 Kudos

Hi Rakesh,

If you have some free space on the system then follow below e.g to extend swap space:

To add a swap file:
1. Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.


2. At a shell prompt as root, type the following command with count being equal to the desired block size:
# dd if=/dev/zero of=/swapfile bs=1024 count=65536
3. Setup the swap file with the command:


# mkswap /swapfile


4. To enable the swap file immediately but not automatically at boot time:

# swapon /swapfile


5. To enable it at boot time, edit /etc/fstab to include:
/swapfile swap swap defaults 0 0


The next time the system boots, it will enable the new swap file.
6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.

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

To disable the temporary swap space execute the following commands:

1.
# su - root
2.
# swapoff swapfile
3.
# rm swapfile

Regards,

Gaurav

Former Member
0 Kudos

Thanks Sriram and Gaurav.

I think for 20 GB space for swap is configured as per SAP recommendation for zero memeory management perspective on the ABAP application server.

1597355 - Swap-space recommendation for Linux

Sriram, the steps that you mentioned makes sense but I would like to add one more information that we had just increased the em/initial_size_MB from 9 GB to 16GB and haven't touched the swap space.

So you think that may have any bearing for this situation where the swap space is not being released automatically?

Regards,

Rakesh

Sriram2009
Active Contributor
0 Kudos

Hi Rakesh

What is the Physical memory size? at the initial stage you may set it 20 GB, based on your SAP application usage you may require to increase the virtual memory & Memory buffer areas.

so you can increase the virtual memory to 30 or 40 GB and than check the memory usage in SAP by using the transaction ST02.

Regards

Sriram

Former Member
0 Kudos

As stated the physical memory of the box is 64 GB and the Swap space is standard 20 GB.

It has happened in the past and rather than just rebooting the box I want to understand what causes this and what can be done to prevent in the future.

So just to reiterate, my question is what can I investigate as to why did the swap space is not being released to the OS?

I know this comes under the purview of OS system administration but can't  we do something about it from SAP BASIS administration perspective?

Regards,

Rakesh

Sriram2009
Active Contributor
0 Kudos

Hi

First thing you can increase the Swap area as mention in the SAP note 1597355  you can define the SWAP 64GB.

after that check the system performance and keep a eye on transaction ST02. check any swap's there in memory buffers values.

Kindly refer the links

How to run SAP transaction ST02 and do performance analysis in SAP memory/buffer area | SAP applicat...

Buffer Monitor and Tune Summary (SAP Library - Monitoring in the CCMS)

Regards

Ram

Former Member
0 Kudos

Thanks Sriram for your input.

Hopefully the increase in the swap size resolves this issue.

Thanks,

Rakesh

former_member182657
Active Contributor
0 Kudos

Hi Rakesh,

Swap space usage becomes an issue only when there is not enough RAM available,but in your case you've with 64GB of RAM for the system out of which 58GB has already been consumed or used as per the screenshot and in these situation the kernel is forced to continuously move memory pages to swap and back to RAM, just to keep applications running. In this case, system monitor applications would show a lot of disk I/O activity.

Check the I/O activities under ST06 .

This behaviour can be configured by setting the value of /proc/sys/vm/swappiness. The default value is 60, setting it to 0 means “never use swap when there is still RAM left“ and 100 is swapping out memory as soon as possible.

Recommend to perform on test box first.

Regards,

Gaurav


Former Member
0 Kudos

Thanks Gaurav..

what you have said makes sense we will check that parameter which determines to what extent swap space should be used between 0 to 100 %.

However, I have found that there are many swaps in the SAP buffer (ST02) that we will be tuning soon in both of the application servers that I had mentioned above,

I have checked the ST06 and couldn't found any page in/out activity.

see below the screen shots of  ST02 and ST06 for both application servers.

Regards,

Rakesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

We have  to reboot the physical server to release teh SWAP space which dropped to critically low 4%.

Before reboot, I stopped the SAP apps and that alone  released the sap space more than 50% ,however I went ahead and took the bounce of the server.

Clearly as we can see, there is no SWAP space in use right now and it will start allcoating once there is load on the server.

My question is, why sometimes we don't see the memory allocated by SWAP returns back to the OS as normally would be the case.

Could this be because of some bug  in the OS?

We have this version of RHEL:

$ cat /etc/redhat-release

Red Hat Enterprise Linux Server release 5.7 (Tikanga)

-sh-3.2$

Sriram2009
Active Contributor
0 Kudos

Hi Rakesh

1. Stop the both the SAP instance, check the swap space released or not? if the result same just do the OS level

2. After restart the OS before starting the SAP instance check the swap and after start the SAP instance

3.Kindly refer the SAP Notes

1597355 - Swap-space recommendation for Linux

941735 - SAP memory management for 64-bit Linux systems

171356 - SAP software on Linux: General information

based on this you can increase the swap

Regards

Sriram