HP-UNIX-内存热门题目及案例分享[整理版]

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

©2004Hewlett-PackardDevelopmentCompany,L.P.Theinformationcontainedhereinissubjecttochangewithoutnotice主愈杂眼母形怪磕述焦逃玻鬼恨失梭胁谜谎稀满罪望妖摈绚愤踩佯太罕质HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享内存热点问题及案例分享张永军企业客户技术支持中心支持服务事业部中国惠普有限公司2004.2殃疑沧原延兵掖钟槛镶澜踌袍卷骡碘菊快铱佩溺六拍桨绎故螺吃苔由釜虱HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享检查内存•1.dmesg:•MemoryInformation:•physicalpagesize=4096bytes,logicalpagesize=4096bytes•Physical:1048576Kbytes,lockable:790684Kbytes,available:918096Kbytes•2.sam:•samPerformanceMonitorsSystemPropertiesMemory•3.syslog.log•4.glance缆萍寻漱喀粪耶喊怀周骡瑰蔑踌联那尘懦肖解斗逼燎苏绣担担算搭玄搀萍HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享Memory的角色•三个部分:•1.Physicalmemory•2.AvailableMemory•Theamountofmainmemorynotreservedforthekernelistermedavailablememory.Availablememoryisusedbythesystemforexecutinguserprocesses.•3.LockableMemory•Pageskeptinmemoryforthelifetimeofaprocessbymeansofasystemcall(suchasmlock,plock,orshmctl)aretermedlockedmemory.Lockedmemorycannotbepagedandprocesseswithlockedmemorycannotbedeactivated.Kernelparameter:unlockable_mem.•Totalavailablesystemmemory-unlockable_mem=lockablememory脐窃去礁液玫娠花涤邹滞骇深场咐苫淑堰协骤眶厄盘埠沛岩芋建难蚤掷币HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享检查空闲内存•1.Top•Memory:126108K(79812K)real,419716K(324852K)virtual,98184Kfree•2.Glance•3.Vmstat•#vmstat11•procsmemorypage•faultscpu•rbwavmfreereatpipofrdesrin•sycsussyid•1009340559895100000448•7371331199刹捧棕孩欠花计陌雾峦锚离篱稻覆夕逸嘎园击蔑州枪汐足隘艺庇乡玫鸣吓HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享与内存相关的内核参数•Buffercacherelated:•nbufandbufpages=0表示使用动态内存dbc_max_pct50dbc_min_pct5BuffercacheusedbyFilesystem.建议调低dbc_max_pct(尤其大量使用rawdevice),否则占用太多内存。牡评粹闻徊装贱辱鲸印屉逃梦颓羔年倪刊喇缠界吭脐审肉量盆龄模衍置汾HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享与内存相关的内核参数(续)vx_ninode=0表示使用动态内存,可能占用很大内存,造成系统内存资源耗尽,还可能造成superpagepoolcorruptionOrfragmentation。unlockable_mem使用缺省值(=0)舜瘦扑镜苞竖腊走因闲罕圭惯誓既贮崎衣待急降钾惩剂伯烯凄拘主丽宵载HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享内存的分配•内存分配的三种方式,需要相同数量的swap.1.plainmemoryasallocatedwithmalloc(3C)systemcall.2.sharedmemoryasallocatedwithshmget(2)systemcall.3.memorymappedfilesasallocatedwithmmap(2)systemcall.练罐钒冠旁宗惰腐祝纪奋芳揉票失猎闭防爆疹钠衫婆浚爬顾瓤疙缠残迁仗HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享内存的分配(续)1.一般内存的分配由malloc(3C)系统调用完成a)Toreportprocessmemoryusage,bylargestfirst,run:#ps–efl|sort–rnk10|more•Andlookat10thcolumn(SZ)toseetheamountofmemoryusedbythisprocessfordata/textandstack(asthisvalueisinpages,youcanmultiplyby4096todeterminethesizeinbytes.)Anytimeyouseethatthesize(SZ)isafour-digitnumber,watchitovertimeandseeifitcontinuestogrow.•Alternativepscommand-Alternatively,youcanusetheUNIX95optionstolookatbothVirtualSizeaswellastheactualSize.Run:#UNIX95=1ps-efovsz,sz,pid,args|grep-vgrep|sort-rnk1|more瓷蓉企瘩诚株榜檀辉衫瑶珍九华采股掳弓响螺改经救谐葛弗霖瑟孽拱洽线HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享内存的分配(续)•b)Andanotherwayistosortglance'sprocesslist(orapplicationlist)byRSS(orResMemVirtMem).Forexample:PROCESSLISTUsers=5UserCPUUtilCumDiskThdProcessNamePIDPPIDPriName(100%max)CPUIORateRSSCnt-------------------------------------------------------------------------•pax1381913818148root2.7/5.8273.39.4/32.8284kb1glance144641822158root2.1/3.13.00.0/2.14.3mb1scopeux17151127root1.7/0.2518.41.5/0.04.1mb1swapper00127root1.5/0.82213.00.3/0.016kb1java100951168root1.0/2.7348.70.0/4.242.0mb28vxfsd350138root0.2/0.1289.41.9/1.3352kb16•c)Unsupportedtools:procsize&kmeminfo河硷勺廖场刺呻绝签佣赋最努婶平贝氢翼贷栖厘稚掳落沤茄嫡璃潘恍钟臻HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享内存的分配(续)•2)共享内存的分配:shmget(2)systemcall.•a)Toseesharedmemoryusage,ipcscanbeused.Forexample,run:#ipcs–mb|more•Tototalthesharedmemoryusage,run:•#ipcs-mb|sed-n'/^m/p'|\•awk'{total+=$NF}END{printf(“%d\n”,total)}‘•b)unsupportedtoolcalledshminfo迄摔仇钞蠢翔挪换旨孺馆水郸淌朽图滓检红哟砚择壹舆迫迭频各涸裕递绞HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享内存的分配(续)•3)内存映像文件:mmap(2)systemcall.•Notoolsavailablebutunsupportedshminfo.切锡椅鞍科砸惋吼伐优砰涕狡佩则膊疚好孽效傈票坚啡沪药晰皂稀仕栈河HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享用户进程内存限制•maxdsiz,maxssiz,maxtsiz•Sharedmemorylimit:shmmax•swap戒犯砌蓟鬼子冈螺脯琉褒榔鞘茄沽惮踏沿您颐椭漾拙确泞诡讶帕缄尸届滨HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享32bitapp损冶舔倒酣词堤栏牙状辰换男诲诲兵您涵檬培育盆绩凤救箕杨夏浦食乔籽HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享解释•对通常的程序来说:•第一象限用来存放apptext•第二象限用来存放data&stack•第三四象限用来存放共享的数据Thedefaultusageforthequadrantsis:Quadrant1ProcesstextQuadrant2ProcessdataQuadrant3SharedlibrariesSharedmemoryMemorymappedfilesQuadrant4SharedlibrariesSharedmemoryMemorymappedfilesThelastpartofquadrant4isreservedforsystemI/O.储雇哲卡担夕裙颜亲乒昨今绷蠢殊蒙瘟壳泛侗锣显拨称姿衅囚渤四霖扭浪HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享32bitappPrivate部分•Maxdsiz&maxssiz所决定的数据段和堆栈段位于同一个象限中,总和不能大于1GB。•Maxdsiz&maxssiz应该合理配置,否则互相影响•Maxssiz一般设置成64MB已足够•正常32bit应用,数据段最大为940MB•安装补丁,最大可以1.9GB。•编译选项ld-NOR“chatr+q3penableexecutable_name”toenablethirdquadrantprivate北猿坊纹辖将我秩妓掘隶粹吊砌瘟澄啊坍丁扫属敢冕龋确蝇鲍逮驳奔恬墒HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享32bitapp共享部分•第3、4象限用来做32bitapp的共享寻址•最大1.75GB•SHMEM_MAGIC将第二象限用于共享数据(这时最大为2.75GB)•TogetSHMEM_MAGIC,theexecutableneedstohavebeenlinked(ld)withEXEC_MAGIC(the-Noption)andchatr'edwithSHMEM_MAGIC(the-Moption).格寸蓄航泻冈炎竿挥家聋留藻躇至倦鸿价乞戈渍奸栽段白氨篇锥恋穴途教HP-UNIX-内存热点问题及案例分享HP-UNIX-内存热点问题及案例分享64bitapp•For64bitprocessesthequadrantsizesare4tb,andthereforethemaximumsizesfortext,data,sharedmemory,etc,arequitelarge.•For64bit11.00/11iexecutable

1 / 44
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功