cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate available shared memory for Sybase Max Memory?

Former Member
0 Kudos

Firstly thank you guys for helping me to figure out to increase max memory on linux. but I still not sure how to calculate available max memory for sybase from shared memory of linux.

I want to open a new ticket for this. As I search over internet, this looks like a common question.

Here is my case:

OS: CentOS release 4.9 (Final) 64-bit

SYBASE ASE 12.5.4 is also 64-bit

This server is dedicated for Sybase, no other application.

I following the guide from doc and your guys instructions:

1. Calc available memory: Total physical memory  - reserved for OS(1G) - Other app memory (2G for ramdisk)

    for may case: 17G - 1G -2G = 14G

2. Then I set shmmax  = 14G = 14738890752 bytes (=13.76GB)  //as documented, this is for max memory for single segment of memory

3. Then I set shmall = 3598362 (4k) ( =   =13.76GB)      // at beginning, I thought no need to change this, but actually, need to change it to make it working

4. Then I set /dev/shm = 14G       //not sure about this. even sybase get the memory, if I check with df -h, the use% is still 0%

5. Then I set max memory = 14G = 7196724(2k)

With about calculation, it is not working, I can not set 14G for max memory, then I try to increase shmall little by little, finally, after I set shmall = 30000000(4k), then I am able to set max memory = 7500000(2k) = 14.31G

So when I predict there is 14G for syabse max memory, I should set both shmmax and shmall. what's the calculation? sybase document only mentioned shmmax.

with the latest CentOS 6.3, it set shmmax and shmall by default as:

shmmax = 68719476736 (=64G)

   shmall = 4294967296 (4k) (=16384G ???)

So if I put above setting for my case( not try it yet), what would be available for sybase max memory?

My ticket for this issue:

Accepted Solutions (1)

Accepted Solutions (1)

former_member182259
Contributor
0 Kudos

You need to be a bit careful with your math and also a bit more realistic with what you are considering from the OS - and probably should spend some serious time with the docs.

14GB = 14336MB = 14680064KB = 15032385536 bytes

Now then, if you read the sysadmin guides, one of the things you need to understand is that it probably is not wise to have shared memory set to >70% of the physical memory.   Executables need to run as well as file system caching, etc. - and in Linux, file system cache is unrestricted by default.   So....given a host with 17GB(??? Are you sure, I think it is likely 16GB and you are not doing the 1024 based math correctly), you would best to run with ~12GB for shared memory.   However, if we assume that you RRREEALLLLY want to use 14GB, then we also need to realize that OTHER applications (including Backup Server and some OS processes) will use shared memory as well.   If you read my post, it points out that shmall is the TOTAL amount of shared memory that can be allocated on the system - in ALL segments.   If you set SHMALL to 14GB - you can have 14 1GB segments or 1 14GB segment ...but no more.  Given some OS processes and others likely are using shared memory, 14GB for shmall limits ASE to something <14GB.    So, if I want to have ASE at 14GB, I need to set SHMALL to something bigger than 14GB - and likely a bit bigger.   For argument's sake, let's say 15GB.   You could find out for sure by doing ipcs -a and adding up the shared memory in use.....but 1GB should be enough.  Then, since ASE will try to grab ALL of the shared memory it wants in a single segment at bootup (vs. increasing it later), it will need to be able to get a least a 14GB shared memory segment.

You probably should have a chat with someone from your OS team as well.   Linux allocates memory in 4K pages or 2MB huge pages.   Since you are using ASE 12.5, you need to stick with the 4K pages.   Either way, shmall is configured as if all in 4K pages - so 15GB = 15360MB = 15728640KB = 3932160 4K pages

...so you should set

shmall = 3932160

shmmax = 15032385536

Now then, ASE allocates memory in 2KB pages - kinda like the OS uses 4KB pages.   So you need to set 'max memory' to 7340032.    There is a trick many of us long time ASE people know....1MB=512 2K pages (the math is simple....but it is a good trick to remember)....so to translate pages to MB you divide by 512....in your case 7196724/512= 14056.1015625MB = 13.72GB.   You should have set max memory to the number I state.

/dev/shm should not be needed unless it isn't there at all.

Also, remember, the docs are written for RHEL/SUSE - the supported distros - which may have different kernel default configurations than CENTOS or other unsupported distros.

Former Member
0 Kudos

Thank you so much, Jeff. Very very helpful. I will redo and try it one more time.

Answers (0)