Having trouble locking shared memory in physical RAM? (Sybase ASE & Linux)

Depending on which distribution of Linux you’re running, it seems that locking Sybase ASE’s shared memory into physical RAM can be a bit tricky.  Simply specifying “lock shared memory” in ASE (sp_configure) isn’t enough.

In many distributions, you can simply add the line into /etc/security/limits.conf to enable locking of shared memory up to 2GB for the sybase user:

sybase  –    memlock 2147483648

Unfortunately this doesn’t always work so you need to specify the memlock limit in the $SYBASE/$SYBASE_ASE/install/RUN_server file by adding the following above the dataserver line:

ulimit -l  2147483648

Whether you are able to lock the memory or not will depend on your environment (you do have enough free memory right?).   You can check if the memory is locked by simply checking the /proc/<pid of a dataserver process>/status:

grep VmLck /proc/<pid>/status

VmLck:   1140000 kB

Keep in mind that you won’t have a 1 to 1 memory size match between the locked memory (VmLck) and the total memory VmSize allocated simply because Sybase ASE only locks the shared memory and not the process:

VmPeak:  1182520 kB
VmSize:  1182516 kB
VmLck:   1140000 kB
VmHWM:   1155340 kB
VmRSS:   1155340 kB
VmData:    11488 kB
VmStk:        84 kB
VmExe:     23364 kB
VmLib:      3944 kB
VmPTE:      1168 kB

If all else fails, your distribution may need to run ASE as root to lock the shared memory.

Share Button