HP-UNIX-内存热点问题及案例分享.ppt
《HP-UNIX-内存热点问题及案例分享.ppt》由会员分享,可在线阅读,更多相关《HP-UNIX-内存热点问题及案例分享.ppt(44页珍藏版)》请在三一办公上搜索。
1、内存热点问题及案例分享,张永军企业客户技术支持中心支持服务事业部中国惠普有限公司2004.2,检查内存,1.dmesg:Memory Information:physical page size=4096 bytes,logical page size=4096 bytes Physical:1048576 Kbytes,lockable:790684 Kbytes,available:918096 Kbytes2.sam:samPerformance MonitorsSystem PropertiesMemory3.syslog.log4.glance,Memory的角色,三个部分:1.Ph
2、ysical memory2.Available MemoryThe amount of main memory not reserved for the kernel is termed available memory.Available memory is used by the system for executing user processes.3.Lockable MemoryPages kept in memory for the lifetime of a process by means of a system call(such as mlock,plock,or shm
3、ctl)are termed locked memory.Locked memory cannot be paged and processes with locked memory cannot be deactivated.Kernel parameter:unlockable_mem.Total available system memory-unlockable_mem=lockable memory,检查空闲内存,1.TopMemory:126108K(79812K)real,419716K(324852K)virtual,98184K free2.Glance3.Vmstat#vm
4、stat 1 1 procs memory page faults cpu r b w avm free re at pi po fr de sr in sy cs us sy id 1 0 0 93405 5989 5 1 0 0 0 0 0 448 737 133 1 1 99,与内存相关的内核参数,Buffer cache related:nbuf and bufpages=0 表示使用动态内存 dbc_max_pct50 dbc_min_pct5 Buffer cache used by File system.建议调低dbc_max_pct(尤其大量使用raw device),否则占
5、用太多内存。,与内存相关的内核参数(续),vx_ninode=0 表示使用动态内存,可能占用很大内存,造成系统内存资源耗尽,还可能造成superpagepool corruption Or fragmentation。unlockable_mem 使用缺省值(=0),内存的分配,内存分配的三种方式,需要相同数量的swap.plain memory as allocated with malloc(3C)system call.shared memory as allocated with shmget(2)system call.memory mapped files as allocated
6、 withmmap(2)system call.,内存的分配(续),一般内存的分配由malloc(3C)系统调用完成a)To report process memory usage,by largest first,run:#ps efl|sort rnk 10|moreAnd look at 10th column(SZ)to see the amount of memory used by this process for data/text and stack(as this value is in pages,you can multiply by 4096 to determine
7、the size in bytes.)Anytime you see that the size(SZ)is a four-digit number,watch it over time and see if it continues to grow.Alternative ps command-Alternatively,you can use the UNIX95 options to look at both Virtual Size as well as the actual Size.Run:#UNIX95=1 ps-efo vsz,sz,pid,args|grep-v grep|s
8、ort-rnk 1|more,内存的分配(续),b)And another way is to sort glances process list(or application list)by RSS(or Res Mem Virt Mem).For example:PROCESS LIST Users=5 User CPU Util Cum Disk ThdProcess Name PID PPID Pri Name(100%max)CPU IO Rate RSS Cnt-pax 13819 13818 148 root 2.7/5.8 273.3 9.4/32.8 284kb 1glanc
9、e 14464 1822 158 root 2.1/3.1 3.0 0.0/2.1 4.3mb 1scopeux 1715 1 127 root 1.7/0.2 518.4 1.5/0.0 4.1mb 1swapper 0 0 127 root 1.5/0.8 2213.0 0.3/0.0 16kb 1java 10095 1 168 root 1.0/2.7 348.7 0.0/4.2 42.0mb 28vxfsd 35 0 138 root 0.2/0.1 289.4 1.9/1.3 352kb 16c)Unsupported tools:procsize&kmeminfo,内存的分配(续
10、),2)共享内存的分配:shmget(2)system call.a)To see shared memory usage,ipcs can be used.For example,run:#ipcs mb|more To totalthe shared memory usage,run:#ipcs-mb|sed-n/m/p|awk total+=$NFENDprintf(“%dn”,total)b)unsupported tool called shminfo,内存的分配(续),3)内存映像文件:mmap(2)system call.No tools available but unsupp
11、orted shminfo.,用户进程内存限制,maxdsiz,maxssiz,maxtsizShared memory limit:shmmaxswap,32bit app,解释,对通常的程序来说:第一象限用来存放app text第二象限用来存放data&stack第三四象限用来存放共享的数据The default usage for the quadrants is:Quadrant 1 Process textQuadrant 2 Process dataQuadrant 3 Shared libraries Shared memory Memory mapped filesQuadra
12、nt 4 Shared libraries Shared memory Memory mapped filesThe last part of quadrant 4 is reserved for system I/O.,32bit app Private 部分,Maxdsiz&maxssiz 所决定的数据段和堆栈段位于同一个象限中,总和不能大于1GB。Maxdsiz&maxssiz应该合理配置,否则互相影响Maxssiz一般设置成64MB已足够正常32bit应用,数据段最大为940MB安装补丁,最大可以1.9GB。编译选项 ld-NOR“chatr+q3p enable executable
13、_name”to enable third quadrant private,32bit app 共享部分,第3、4象限用来做32bit app的共享寻址最大1.75GBSHMEM_MAGIC 将第二象限用于共享数据(这时最大为2.75GB)To get SHMEM_MAGIC,the executable needs to have been linked(ld)with EXEC_MAGIC(the-N option)and chatred with SHMEM_MAGIC(the-M option).,64bit app,For 64 bit processes the quadrant
14、 sizes are 4tb,and therefore the maximum sizes for text,data,shared memory,etc,are quite large.For 64 bit 11.00/11i executables there is currently no need to have different memory maps available as the standard one allows up to 4TB for the program text,another 4TB for its private data and a total of
15、 8TB for shared areas.,考虑一下,16GB物理内存将多个数据库置于同一台机器 对32位数据库,只有1.75GB内存可用怎么办?,Memory Windows!,What does the Memory Windows feature do?,Enabling memory windows does change the kernels default allocation policy.With only the global memory window configured,the kernel allocates shared addresses from the 4
16、th quadrant first and then the 3rd quadrant.When max_mem_window is set to a non-zero value(enabling memory windows),the kernel changes the default allocation policy such that the 3rd quadrant is tried first followed by the 4th.,内核设置,To enable the use of memory windows the kernel tunable max_mem_wind
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- HP UNIX 内存 热点问题 案例 分享
链接地址:https://www.31ppt.com/p-6507387.html