Operating System - HP-UX
1827293 Members
2815 Online
109717 Solutions
New Discussion

how to determine the memory is sufficient or not for a new database

 
apple
Super Advisor

how to determine the memory is sufficient or not for a new database

dear HPUX gurus,
currently we have 16 GB of memory and 14GB swap space. there are 8 oracle databases running on this server. currently it looks ok, but we have new requirement for another sybase with 8GB memory requirement to put into this server. how can we access whether with this new database our database performance will not be degraded? attached is the current top output and swapinfo -tam output. do we need to buy more memory? hope to hear from you. than ks alot
12 REPLIES 12
Tim Nelson
Honored Contributor

Re: how to determine the memory is sufficient or not for a new database

With only 14GB of swap space you will not be able to use all 16GB of physical RAM. In order to use ALL your RAM ( - reserve space ) you MUST have at a minimum equivelance. Once you hit 16GB new processes will fail with cannot fork or malloc error.

Back to your question:
Add up the SGA requirements for each database. If it comes close or exceeds the 14GB of usable space then either reduce the application mem requirements or buy more RAM.

apple
Super Advisor

Re: how to determine the memory is sufficient or not for a new database

dear hpux gurus,
With only 14GB of swap space you will not be able to use all 16GB of physical RAM. In order to use ALL your RAM ( - reserve space ) you MUST have at a minimum equivelance. Once you hit 16GB new processes will fail with cannot fork or malloc error.
1. almond08> reserve memory is 12GB, is the reserve memory static? how can we know who reserve it?
2. almond> minimum equivalence of swap space and physical RAM. meaning the swap space is double of physical ram. in this case the swap space should be 32GB (doube of physical ram)?

Add up the SGA requirements for each database. If it comes close or exceeds the 14GB of usable space then either reduce the application mem requirements or buy more RAM.
almond> the total SGA requirements should not more than our current physical size which is 15GB or 14GB. is the current reserve is used by our oracle database?

hope to hear from you. thanks a lot

Steven E. Protter
Exalted Contributor

Re: how to determine the memory is sufficient or not for a new database

Shalom,

Based on your swapinfo I think you have a problem. You are already using 63% of available memory.

You do not want to be consistently paging and you will be if you don't add memory.

The other alternative is to reduce the SGA of the other instances.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
apple
Super Advisor

Re: how to determine the memory is sufficient or not for a new database

dear hpux gurus,
what does it 63% tells? would be truly grateful you could let me know what is the problem.


You do not want to be consistently paging and you will be if you don't add memory.
how do you know its gonna be consistently paging?

The other alternative is to reduce the SGA of the other instances.
how can we as system admin measure the SGA of the other instances. it's configured by our database admin. if system admin can measure, may be we can advice our database admin? is it based on the buzyness of the database like update? select etc

hope to hear from you. thanks a lot
Tim Nelson
Honored Contributor

Re: how to determine the memory is sufficient or not for a new database

Checking application shared memory usage can be done with ipcs -ma

The 63% used is a little misleading as it includes the psuedo swap allocation. psuedo swap is a little trick tht HPUX uses to allow you to run process even though you do not have enough physical swapspace. Kinda like a swap device in memory. psuedo swap will continue to be reduced as you use up more and more physical memory. Once you hit 16GB psuedo swap will be zero and any new processes will require another process to be deactivated to disk ( swapped out ).

Once your %used on the dev items is more than zero, at some time you have started deactivating processes ( use glance or vmstat or sar to monitory deactivation rates )

Glance is a better tool to monitor real memory usage.

My initial estimate of current memory usage is about 5GB out of 16GB ( really 14GB because that is all the device swap you have )

If you were to add an application that at a minimum requires 8GB of RAM (not counting misc other process requirements ) you would be at about 13 or 14GB. Without increasing your device swap space, that is it. Processes will start to fail.

If you increased your device swap to 18GB ( a little fluff so the system does not fail when you reach 16GB ) Then you would have about 2GB free. 2GB of free RAM is a good buffer. but... because you do not know the % of error you should test or ask that the application requirements be reduced for initial testing then review the usage and tweek the apps up until everyone is happy.

apple
Super Advisor

Re: how to determine the memory is sufficient or not for a new database

when i check glance, the current memory utilisation is 99% or 100% but when i check swapinfo -tam, it gives me the memory utilisation is 35 % as per below: why the values different? why one should i refer? hope to hear from you. thanks a lot
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 8192 163 8029 2% 0 - 1 /dev/vg00/lvol2
dev 6144 160 5984 3% 0 - 1 /dev/vg00/lvswap
reserve - 13612 -13612
memory 15183 5338 9845 35%
total 29519 19273 10246 65% - 0 -
apple
Super Advisor

Re: how to determine the memory is sufficient or not for a new database

have just get info from dba, added up all the instances sga requirements are 8GB. currently we have 15GB physical memory. 15GB minus 8GB= we have left 7GB. new database req is 8GB. but how much operating system is taking from our phyiscal memory for operating system operations. can we assume the left 7GB can be solely use by the new database? if we increase the device swap space is it ok? sorry if my question is not smart. hope to hear from you. thanks alot
Yogeeraj_1
Honored Contributor

Re: how to determine the memory is sufficient or not for a new database

hi,

> but how much operating system is taking from our phyiscal memory for operating system operations. can we assume the left 7GB can be solely use by the new database? if we increase the device swap space is it ok?

In general, the amount of memory required by the operating system is usually minimal.

For instance, if you consider Oracle, there is a fix amount of memory that is "reserved" for the SGA at the startup of the database instance itself. (if you have Oracle 10g, you need to look at the SGA_TARGET value). After that, depending of the configuration, whether you are running dedicate server mode or MTS, the memory is allocated accordingly. In dedicated server mode, you usually size for the maximum amount connections possible. The more connections, you have the more memory it will require. In your case, it is most probably that you are running Dedicated server mode.

Now that you are bringing in the Sybase database, you need to look into how memory allocation is done. If it is similar to Oracle, you need to do the sizing as i mention above...

Also, you might monitor you database performance and see if you have not done an overkill at the Oracle level... in which case, you will haev to release a few GB of memory..

Just a few thoughts.

hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: how to determine the memory is sufficient or not for a new database

hi,

> but how much operating system is taking from our phyiscal memory for operating system operations. can we assume the left 7GB can be solely use by the new database? if we increase the device swap space is it ok?

In general, the amount of memory required by the operating system is minimal.

For instance, if you consider Oracle, there is a fix amount of memory that is "reserved" for the SGA at the startup of the database instance itself. (if you have Oracle 10g, you need to look at the SGA_TARGET value). After that, depending of the configuration, whether you are running dedicate server mode or MTS, the memory is allocated accordingly. In dedicated server mode, you usually size for the maximum amount connections possible. The more connections, you have the more memory it will require. In your case, it is most probably that you are running Dedicated server mode.

Now that you are bringing in the Sybase database, you need to look into how memory allocation is done. If it is similar to Oracle, you need to do the sizing as i mention above...

Also, you might monitor you database performance and see if you have not done an overkill at the Oracle level... in which case, you will haev to release a few GB of memory..

Just a few thoughts.

hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Sajjad Sahir
Honored Contributor

Re: how to determine the memory is sufficient or not for a new database


Dear Almond

When considering the performance of any system it is important to determine a
baseline of what is acceptable. How does the system perform when there is no
load from applications or users? What are the systems resources in terms of
memory , both physical and virtual? How many processors does the system have
and what is the speed and RISC level? What is the layout of the data ? What
are the key kernel parameters set to and how are those resources being
utilized? What are the utilities to measure these ?

Memory Resources

HP-UX utilizes both physical memory , RAM and virtual memory, referred to as
swap. There are three resources that can be used to determine the amount
of RAM: syslog.log,dmesg, and adb (absolute de-bugger) .The information dmesg
reports comes from /var/adm/syslog/syslog.log ,while using dmesg is
convienient, if the system has logged too many errors recently, the memory
information may not be available.

Insufficient memory resources are a major cause of performance problems and
should be the first area to check .

The memory information from dmesg is at the bottom of the output .

example:
Memory Information :
physical page size =4096 bytes, logical page size= 4096 bytes
Physical: 524288 Kbytes, locakble: 380880 Kbytes , available: 439312

Using adb reads the memory from a more reliable source, the kernel.

To determine the physical memory (RAM) using adb:

for HP-UX 10.X
example:

echo physmem/D | adb -k /stand/vmunix /dev/kmem
physmem:
physmem: 24576

for HP-UX 11.X systems running on 32 bit architecture:
example:

echo phys_mem_pages/D | adb /stand/vmunix /dev/kmem
phys_mem_pages:
phys_mem_pages: 24576


for HP-UX 11.X systems running on 64 bit architecture:
example:

echo phys_mem_pages/D | adb64 -k /stand/vmunix /dev/mem
phys_mem_pages:
phys_mem_pages: 262144

The results of these commands are in 4 Kb memory pages, to determine the size
in bytes multiply by 4096 .

To fully utilize all of the RAM on a system there must be a sufficient amount
of virtual memory to accomodate all processes . The HP recommendation is at
that virtual memory be at least eaqual to physical memory plus application
size. This is outlined in the System Adminstration Tasks Manual .

To determine virtual memory configuration run the following command :
#swapinfo –tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 0 1024 0 1 /dev/vg00/lvol1
reserve 184 -184
memory 372 96 276 26
total 1396 280 1116 20

The key areas to monitor are reserve , memory and total . For a process
to spawn it needs a sufficient amount of virtual memory to be placed in
reserve. There should be a sufficient amount of free device swap to open any
processes that may be spawned during the course of operations. By subtracting
thereserve from the device total you can determine this value.
If there is an insufficient amount available ( typically from device swap)
you will receive an error : cannot fork : not enough virtual memory. If
this error is received , you will need to allocate more device swap. This
should be configured on a disk with no other swap partitions, and ideally of
the same size and priority of existing swap logical volumes to enable
interleaving.

Refer to the Application Note KBAN00000218
Configuring Device Swap for details on the procedure.

The memory line is enabled with the kernel parameter swapmem_on set to 1 . This
allows a percentage of RAM to be allocated for pseudo-swap. This is the default
and should be used unless the amount of lockable memory exceeds 25% of RAM.

You can determine the amount of lockable memory by running the command:
example:
echo total_lockable_mem/D | adb -k /stand/vmunix /dev/mem

total_lockable_mem:
total_lockable_mem: 185280

This will return the amount in Kbytes of lockable memory in use.

If pseudo-swap is disabled by setting swapmem_on to 0 , there will typically be
a need to increase the amount of device swap in the system to accommodate
paging and reserve area.

If the total under PCT USED is 90 or greater it is recommended to increase the
amount of device swap.


After physical and virtual memory is determined , we need to determine how much
buffer cache has been configured and how much is being used. By default the
system will use dynamic buffer cache . The kernel will show buf pages and nbuf
set to 0 in SAM. The parameters that govern the size of the dynamic buffer
cache are dbc_min_pct and dbc_max_pct , these define the minimum
and maximum percentage of RAM allocated. The default values are 5% mimimum and
50% maximum .

On systems with small amounts of RAM these values may be useful for
dedicated applications. Since the introduction of HP-UX 11.0 the amount of RAM
a system can have has increased from 3.75Gb to our newest systems with up to
256Gb. Keeping the default values for systems with a large amount of RAM can
have a negative impact on performance, due to the time the lower level routines
that check on free memory in the cache take.

To monitor the use of the buffer cache run the following command :

sar –b 5 30

You will see output similar to :

bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s
0 95 100 1 2 54 0 0


Ideally we want to see a %wcache of 95 or greater. If the system consistenly
shows %wcache less than 75 it would be advisable to lower the value of
dbc_max_pct. In 32 bit architecture, the buffer cache resides in quadrant 3,
limiting the maximum size to 1 Gb. Typically values less than 300Mb are
preferable.

Memory for applications

For applications to have a sufficient amount of space for text, data and stack
in memory the kernel has to be tuned. The total size for text, data and stack
for 32 bit systems using EXEC_MAGIC is in quadrant 1 and 2, and is 2Gb less the
size of the Uarea . These are represented by the kernel parameters maxtsize,
maxdsiz and maxssiz . Under SHMEM_MAGIC the total size is limited to 1Gb in
quadrant 1.


If these parameters are undersized the system will error. Insufficient maxdsiz
will return “out of memory “ and insufficient maxsiz will
return “stack growth failure”.


The last configurable area of memory to check is shared memory . Any
application running within the 32 bit domain will have a limit of 1.75Gb total
for shared memory for EXEC_MAGIC and 2.75Gb using SHMEM_MAGIC. Individual
processes cannot cross quadrant boundaries , so the largest shmmax can be for
32 bit is 1Gb.

It is important to determine if the application is running 32 bit or 64 bit
when troubleshooting 64 bit systems.

This can be done with the file command :

example :

file /stand/vmunix
/stand/vmunix: ELF-64 executable object file - PA-RISC 2.0 (LP64)

PA-RISC versions under 2.0 are 32 bit

For an overview on shared memory for 32 bit systems refer to the Application
Note RCMEMKBAN00000027 Understanding Shared Memory on PA RISC Systems .

The kernel parameter shmmax determines the size of the shared memory
region. SAM will not allow this to be configured greater than 1 quadrant , or
1Gb even on 64 bit systems. If a larger shmmax value is needed for 64 bit
systems it has to be done using a manual kernel build.

In a 64 bit system 32 bit applications will only address the 32 bit shared
memory region,64 bit applications will only address the 64 bit regions.

Example of a creating a kernel with shmmax at 2Gb:

cd /stand/build
/usr/lbin/sysadm/system_prep -v -s system
kmtune -s shmmax= 2147483648 -S /stand/build/system
/usr/sbin/mk_kernel -s ./system
mv /stand/system /stand/system.prev
mv /stand/build/system /stand/system
kmupdate
shutdown -ry 0

To determine shared memory allocation, use ipcs this utility is used to
report status of interprocess communication facilities. Run the following
command:

ipcs –mob

You will see an output similar to this :

ipcs -mob
IPC status from /dev/kmem as of Tue Apr 17 09:29:33 2001
T ID KEY MODE OWNER GROUP NATTCH SEGSZ
Shared Memory:
m 0 0x411c0359 --rw-rw-rw- root root 0 348
m 1 0x4e0c0002 --rw-rw-rw- root root 1 61760
m 2 0x412006c9 --rw-rw-rw- root root 1 8192
m 3 0x301c3445 --rw-rw-rw- root root 3 1048576
m 4004 0x0c6629c9 --rw-r----- root root 2 7235252
m 5 0x06347849 --rw-rw-rw- root root 1 77384
m 206 0x4918190d --rw-r--rw- root root 0 22908
m 6607 0x431c52bc --rw-rw-rw- daemon daemon 1 5767168


The two fields of the most interest are NATTCH and SEGSZ.

NATTCH -The number of processes attached to the associated shared
memory segment. Look for those that are 0, they indicate processes who have not
released their shared memory segment.

If there are multiple segments showing with an NATTACH of zero , especially if
they are owned by a database, this can be an indication that the segments are
not being efficiently released . This is due to the program not calling
detachreg . These segments can be removed using ipcrm -m shmid.


Note : Even though there is no process attached to the segment , the data
structure is still intact. The shared memory segment and data structure
associated with it are destroyed by executing this command.

SEGSZ The size of the associated shared memory segment in bytes. The
total of SEGSZ for a 32 bit system using EXEC_MAGIC cannot exeed 1879048192
bytes or 1.75Gb, or 2952790016 bytes or 2.75Gb for SHMEM_MAGIC.
Sajjad Sahir
Honored Contributor

Re: how to determine the memory is sufficient or not for a new database

u can use ipcs tool

see out put of ipcs

data1# ipcs -mob
IPC status from /dev/kmem as of Mon May 5 08:46:10 2008
T ID KEY MODE OWNER GROUP NATTCH SEGSZ
Shared Memory:
m 0 0x411c1148 --rw-rw-rw- root root 0 348
m 1 0x4e0c0002 --rw-rw-rw- root root 2 61760
m 2 0x41201d2f --rw-rw-rw- root root 1 8192
m 3 0x00a5c581 --rw------- sfmdb users 2 1695744
whiteknight
Honored Contributor

Re: how to determine the memory is sufficient or not for a new database

Almond,

You can get the kmeminfo tools from HP Response center, it will give you the break down of each memory utilization.

WK
Problem never ends, you must know how to fix it