AIX为Java.doc_第1页
AIX为Java.doc_第2页
AIX为Java.doc_第3页
AIX为Java.doc_第4页
AIX为Java.doc_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Skip to main content 跳转到主要内容 Country/region国家/地区 select 选择 窗体顶端窗体底端 Home Solutions o A smarter planet o By industry Aerospace and defense Automotive Banking Chemicals and petroleum Construction Consumer products Education Electronics Energy and utilities Financial markets Forest and paper Government Healthcare Insurance Life sciences Media and entertainment Metals and mining Retail Telecommunications Travel and transportationo By business need Business intelligence Customer relationship management Enterprise resource planning Financial management Human capital management Product lifecycle management Security Sensors Strategy and change Supply chain managemento By IT issue Business process management Collaboration Content management Cost management Data management Disaster recovery Distribution management Energy efficiency Enterprise application integration Enterprise architecture Regulatory compliance Security Systems management Virtualization Workforce productivityo By Business Partner IBM and Cisco IBM and Dassault Systmes IBM and Oracle IBM and SAP More Alliance Partners Business Partner solutions Find a Business Partnero Business consultingo Cloud computingo Dynamic infrastructureo Financingo Green: energy, environment & sustainabilityo Service oriented architecture (SOA) o Small and medium business o More Services o IT services All IT services Business continuity and resiliency services End-user services Integrated communications services IT strategy and architecture services Maintenance and technical support services Middleware services Security services Server services Site and facilities services Storage and data services IT services A-Zo Business consulting All business consulting Business analytics and optimization Customer relationship management Financial management Human capital management Strategy and change Supply chain management Thought leadershipo Application services All application services Custom application development and system integration Application managemento Outsourcing services Applications outsourcing Business process outsourcing IT outsourcing and hostingo Training o Small and medium business o Other services Asset recovery Software serviceso More Products o Special offers o Software Software overview Products Trials and demos Business Analytics - Cognos - SPSS Enterprise Content Management Information Management - DB2 - Informix - InfoSphere Lotus Rational Tivoli WebSphere System z softwareo Storage All storage Disk systems Tape systems Storage area networks Network attached storage Storage software Hard drives/microdrives Storage A to Zo Servers & systems All servers and systems Systems software Power Systems System i (iSeries) System p (pSeries) System z (Mainframe) System x (xSeries) BladeCenter Cluster systems UNIX servers Linux servers Intel processor-based servers AMD processor-based servers OEM systemso Internet security o Personal computers o Point of sale o Printing systems from InfoPrint o Semiconductors o Upgrades, accessories & parts o Certified used systems & storage o Communities o Small business products o Medium business products Hardware Softwareo More Support & downloads o Download Fixes, updates and drivers Trials and demoso Troubleshoot o Search o Documentation o Forums & communities o Plan o Install o Use o Open a technical service request o Support by product Software Servers and systems System storage Printing systems from InfoPrint Lenovo ThinkPads and ThinkCentreso Customer support o More My IBM o My accounts o My profile o My interests o My community spaces o My technical support o My customer support Shopping cart Contracts Orders and delivery Inventory and maintenance Invoices and payments Self-service tools More customer supporto Subscriptions o More developerWorks developerWorks的 AIX and UNIX AIX和UNIX Technical library 技术文档库 Getting more memory in AIX for your Java applications在AIX中获取更多的内存为您的Java应用程序 Sumit Chawla ( ), Technical Lead, Java Enablement, IBM, Software Group Sumit乔拉 ( ),技术领先,Java的启用,IBM公司软件集团 Sumit Chawla leads the Java Enablement initiative for IBM eServer (for AIX, Windows, and Linux platforms). Sumit乔拉线(对于AIX,Windows和Linux平台)为IBM eServer的爪哇启用倡议。 You can contact him at .你可以联络他 。 Summary: Does your Java application need more memory than you get from a plain vanilla Java installation? 摘要:请问您的Java应用程序需要安装更多的内存比你从一个普通的Java吗? Do you want to talk in gigabytes, not in kilobytes?你想谈谈在千兆字节不是千字节,? This article is your key to unleashing the full power of Java on AIX.这篇文章是你的释放在AIX Java的全部功能。 Tag this! 标记此! Date: 01 Sep 2003 日期:2003年9月1日 Level: Introductory 级别:初级 Also available in: Korean 还有: 韩国 Activity: 10977 views 活动:10977次 Comments: 评论: Introduction 简介 This article explains how 32-bit Java allocates its heap in AIX, and pertains to all the latest versions of 32-bit IBM Java available for AIX versions 4.3.3, 5.1, and 5.2.本文介绍了如何32位Java堆分配其在AIX,以及所有的32位IBM Java最新版本的AIX版本4.3.3,5.1和5.2提供涉及。 You will learn how to distinguish between various memory areas of a Java process under AIX, and how to tweak their sizes to suit your needs.您将学习如何区分一个Java进程的各个领域内存在AIX下,如何调整它们的大小,以满足您的需求。 The information in this article will allow your Java-based applications to break the barrier of 1 GB Java heap with versions of Java prior to 1.4; Ill also describe how Java 1.4 does it automatically for you.这篇文章中的信息将使您的Java应用打破以前的Java版本1.4 1 GB的Java堆的障碍,我会还描述了Java 1.4会为您自动。 For applications that use databases and middleware, this article provides the basis for advanced topics, such as segment collision avoidance.对于应用程序使用的数据库和中间件,本文提供了部分先进的主题,如防撞的基础。 This article has been updated to include information about Java 1.4, and also to give examples of commands you can use to increase your understanding of the topic.这篇文章已被更新,包括关于Java 1.4的信息,也给你的命令可以用来提高您的主题理解的例子。 The fence analogy, and much of the enhanced description, were provided by Mark Bluemel.比喻的篱笆,以及增强的描述不多,都是由马克布卢梅尔。 Along with Mark, Ashok Ambati and Greg Hodgins reviewed the article to make it much more readable.随着马克,阿肖克Ambati审查和Greg霍金斯文章,以使其更具可读性。 The update itself was triggered by feedback from readers like you; thanks to everyone who sent their comments.更新本身的起因是由像你这样的读者的反馈,感谢大家谁送他们的意见。 Back to top 返回顶部 Native versus Java heaps 本机与Java堆 A heap is a storage management structure for tracking and allocating memory. 堆是一个记忆存储管理和分配结构的跟踪。 When we talk about Java processes, there are two different types of memory areas, and hence two types of heaps, that must be distinguished.当我们谈论Java进程,有两种不同类型的内存区域,因此两种堆型,必须加以区别。 The Java Virtual Machine (JVM) has an address space, just like any process, from which it can allocate chunks of memory for various purposes. Java虚拟机(JVM)中有一个地址空间,就像任何过程,从它可以用于各种目的分配的内存块。 Probably the most important (and definitely the most familiar to Java programmers) of these chunks is the Java heap .也许最重要的(绝对是最熟悉的Java程序员)这些块是 Java 堆 。 The Java heap is used for allocating the Java objects, and you can monitor its usage through verbosegc traces. Java的堆是用于分配的Java对象,你可以监视通过其使用的verbosegc痕迹。 The size of a Java heap can be explicitly controlled using -Xms and -Xmx command line arguments.一个Java堆的大小可以明确地控制使用- Xms和- Xmx命令行参数。 This is true for all platforms where Java is supported, hence the name Java heap.这是适用于所有支持Java的平台上,故名Java堆。 The rest of the chunks are allocated by the JVM on an as-needed basis, and are usually platform dependent.该区块其余由JVM分配上根据需要,通常依赖于平台。 We refer to them collectively as data .我们把他们统称为数据 。 From a Java point of view, a more appropriate term for these chunks is native heap , due to its platform-specific nature.从Java的角度来看,对这些块更适当的词是本地堆 ,由于其平台的具体性质。 For example, on AIX the native heap contains several critical components of a JVM process:例如,在AIX上机堆载有一个JVM进程的几个关键组件: Thread stacks for every thread except primordial除了为每个原始线程的线程堆栈 Buffers, lookup tables, and so on for ZIP-related operations (such as GZIPOutputStream methods)缓冲器,查找表,用于ZIP等相关的操作(如GZIPOutputStream方法) Buffers and structures related to native GUIs underlying Swing/AWT (for example, Motif)缓冲器和结构与潜在的Swing / AWT的本地图形用户界面(例如,序) Data used by JNI code, such as native database drivers, MQ-Series, and so on JNI代码所使用的数据,如本地数据库驱动程序,MQ的系列,等 Just-in-time (JIT) compiler and Mixed-Mode-Interpreter (MMI) support routines刚刚在实时(JIT)编译器和混合模式解释器(MMI)的支持例程 Executable code for JIT-compiled methods准时化可执行代码编译的方法 and more.等等。 The native heap size cannot be controlled through a command line argument.本机堆的大小无法控制通过一个命令行参数。 On AIX, depending on the Java version in use and the Java heap size selected, the Java heap may or may not itself be allocated from the native heap.在AIX上,根据所使用的Java版本和Java堆的大小选择不同,Java堆本身未必是从本地堆分配。 In this article, the term heap, if not further qualified, refers to the Java heap, not the process (native) heap.在这篇文章中,术语堆,如果不进一步限定,是指Java堆,而不是过程(本机)堆。 Also, the term data is used interchangeably with native heap.此外,长期的数据互换使用与本机堆。 Back to top 返回顶部 The o_maxdata on AIX 在AIX上o_maxdata Before we can discuss how to allocate larger heaps using Java, we have to understand the process address space in AIX.在我们可以讨论如何使用Java堆分配较大,我们要了解在AIX进程的地址空间。 The information in this section applies to all processes under AIX, including the JVM.本节中的信息适用于AIX下的所有进程,包括JVM的。 See Resources for links to more information on this topic.见资源为主题的链接,这更多信息。 On AIX, the 32-bit address space (= 2 32 or 4 GB) is divided into 16 segments, each 256 MB (256 MB*16 = 4 GB).在AIX上,32位地址空间(= 2 32或4 GB),分为16段,每段256兆(MB的256 * 16 = 4 GB)的。 When a 32-bit process is loaded in memory, its address space looks Figure 1 .当一个32位进程是加载到内存中,它的地址空间看起来图1 。 Figure 1.Segments in 32-bit AIX model 图1.Segments 32位AIX模型 In the default address-space model, segment 2 contains the user stack, kernel stack and u-block, as well as data (area used by malloc() ).在默认的地址空间模型,分部2包含用户堆栈,内核堆栈和U -块,以及数据(面积使用malloc() This translates to a limit of 256 MB for data, stacks, and u-block for the whole process.这256个数据,堆栈和整个流程铀块MB的限制转换。 Segments 3 through C are free to be used as shared memory, using shmat() or mmap() .如COC三是通过自由和内存作为共享,使用shmat()或者mmap() 。 If a process needs to allocate more data, it can switch to the large space model, where the native heap starts from segment 3 onwards, and grows to an offset specified by the o_maxdata value in the XCOFF header to a non-zero value.如果一个进程需要分配更多的数据,它可以切换到大空间模型,在那里开始从本地堆段3起,长到一抵消指定o_maxdata值值在XCOFF头一个非零。 It is essential to understand the significance of o_maxdata to learn how to allocate larger Java heaps.关键是要理解的意义o_maxdata学习如何分配更大的Java堆。 You can think of o_maxdata to be setting a fence in segments 3 through A. Figure 2 shows the fence in action (segments 0, 1 and DF omitted for clarity).你能想到的o_maxdata是树立栅栏“的分部3答:一,通过” 图2显示了行动栅栏(段0,1和DF清晰度省略)。 Figure 2. 图2。 The fence 栅栏 If the fence moves up (that is, the Fence line moves towards Segment 2), we get more space for shared memory and, correspondingly, less space for the native heap.如果栅栏动作“注册”(即,朝向段2芬斯利涅移动),我们得到了更多的本地堆共享内存,相应地,不占空间的空间。 Moving the fence down allows the native heap to grow, while reducing shared memory.移动栅栏下允许本地堆增长,同时减少共享内存。 For a setting of o_maxdata = N , the fence is placed at 0x30000000+N.对于设置o_maxdata = N ,栅栏被放置在0x30000000 + N的 For several good reasons, it is recommended to set o_maxdata to a value that is the start of a particular segment, such as 0xn0000000.几个很好的理由,建议设置o_maxdata的值是由段开始某0xn0000000,如。 In this case, the fence sits between segments 2+n and 3+n, which translates to n segments for the native heap, and 10-n segments for shared memory.在这种情况下,坐在栅栏之间的分部2 + n和3 + n,它转化为N段的本地堆,以及共享内存10 - N的部分。 If o_maxdata is zero, the entire native heap is allocated from segment 2.如果o_maxdata是零,整个本地堆分配从部分2。 This is the default space model; here, all segments from 3 through C (10 segments = 2.56 GB) can be used for shared memory.这是默认的空间模型,在这里,通过C各阶层,从3(10段= 2.56 GB)的,可用于共享内存。 The native heap size is constrained by the available memory in segment 2, (less than 256 MB).本机堆的大小受限于可用的内存段2,(小于256 MB的)。 When o_maxdata is set to a non-zero value, we switch to the large space model, which implies the native heap is allocated from segment 3 onwards.当o_maxdata设置为一个非0值,我们切换到大空间模型,这意味着本地堆分配开始从部分3。 The top-most position of the fence in Figure 2 shows the scenario where o_maxdata is greater than zero.在围栏的位置最上面的图2显示了这样一个场景, o_maxdata是大于零。 Other structures, such as stacks and u-blocks, still get allocated from segment 2.其他结构,如堆栈和U -块,仍然可以拨出部分2。 Segments B and C are used only for shared memory, so o_maxdata can move the fence all the way down to segment A, depicted as the bottom-most position of the fence, leaving segments 3 through A for native heap (8 segments = 2 GB), and B & C (2 segments =512 MB) for shared memory.段B和C是仅用于共享内存,所以o_maxdata可以移动栅栏一路下跌至A段,围栏描绘成最底的位置,留下机堆通过一个分部3(8段= 2 GB的)和B和C(2段= 512 MB)的共享内存。 As an example, setting n=2 ( o_maxdata = 0x20000000) would mean that the fence sits at segment 5, leaving 2 segments (=512 MB) for native heap, and 8 segments (=2 GB) for shared memory.作为一个例子,设置2例( o_maxdata = 0x20000000)将意味着,坐在栅栏5段,造成2段(= 512 MB)的本机堆,8段GB)的共享内存(= 2。 Back to top 返回顶部 Java heap allocation values Java堆分配值 The preceding discussion might make you think that if you want a large Java heap, you must patch the Java binary to have o_maxdata set to 0x80000000.前面的讨论可以让你觉得如果你想有一个大型Java堆,你必须修补Java二进制有o_maxdata设置为0x80000000。 Unfortunately, things are not so simple.不幸的是,事情并非如此简单。 If you look at the 32-bit Java binary, using the dump command, o_maxdata is already set to 0x80000000.如果你看看在32位Java二进制,使用dump命令, o_maxdata已设置为0x80000000。 The example listing below shows the output for Java 1.3.1.下面列出的例子显示了对Java 1.3.1输出。 $ dump -ov /usr/java131/jre/bin/java $转储半岛/ usr/java131/jre/bin/java/usr/java131/jre/bin/java: / usr/java131/jre/bin/java: *Object Module Header* * *对象模块头# Sections Symbol Ptr # Symbols Opt Hdr Len Flags 符号第光学符号Ptr的莱恩旗首部 4 0x000079bc 627 72 0x1002 4 0x000079bc 627 72 0x1002Flags=( EXEC DYNLOAD )旗=(EXEC键DYNLOAD)Timestamp = Aug 07 03:17:57 2003时间戳=“2003年8月7日三时17分57秒”Magic = 0x1df (32-bit XCOFF)魔术= 0x1df(32位XCOFF) *Optional Header* * *可选头Tsize Dsize Bsize Tstart Dstart Tsize Dsize Bsize堵Dstart0x000056df 0x000002f1 0x00000818 0x10000128 0x20000807 0x000056df 0x000002f1 0x00000818 0x10000128 0x20000807SNloader SNentry SNtext SNtoc SNdata SNloader SNentry SNtext SNtoc SNdata0x0004 0x0002 0x0001 0x0002 0x0002 0x0004 0x0002 0x0001 0x0002 0x0002TXTalign DATAalign TOC vstamp entry TXTalign DATAalign目录vstamp条目0x0005 0x0003 0x200009e0 0x0001 0x20000984 0x0005 0x0003 0x0001 0x20000984 0x200009e0maxSTACK maxDATA SNbss magic modtype maxSTACK maxDATA SNbss魔术modtype0x00000000 0x80000000 0x0003 0x010b UR 0x00000000 0x80000000 0x0003 0x010b乌拉圭回合o_maxdata shows up in the last line of the output, and is labeled maxDATA. o_maxdata显示在输出的最后一行,并标有maxDATA。 Yet, an attempt to allocate a heap larger than 1 GB will fail.然而,试图分配一个堆大于1 GB会失败。 You can test this very quickly by using the command java -mx1200m -version .您可以测试这个非常迅速通过使用命令java -mx1200m -version 。 This command will fail with the default JVM settings.此命令将失败,默认的JVM设置。 Note that older versions of Java 1.1.8 and 1.2.2 differed in this behavior.请注意,Java的旧版本1.1.8和1.2.2在这种行为是不同的。 If you are not using the latest service refreshes of your JVM version, you might observe a different behavior.如果你不使用你的JVM的版本的最新服务刷新,您可能会发现一个不同的行为。 The variability is because of the dual-personality heap allocation method used by Java.该变异是因为双堆分配而个性Java中使用的方法。 For up to 1 GB of heap, Java uses malloc() to allocate the Java heap.高达1 GB的堆,Java使用malloc()分配Java堆。 The Java heap is allocated from the native heap. Java的堆是从本机堆上分配。 But if you go above 1 GB, or if the environment variable IBM_JAVA_MMAP_JAVA_HEAP is defined, Java reverts to mmap() for the Java heap, which means it uses shared memory.但是如果你去超过1 GB,或如果环境变量IBM_JAVA_MMAP_JAVA_HEAP定义,爪哇归还mmap()用于Java堆,这意味着它使用共享内存。 This allows Java to allocate a heap as large as the maximum size of shared memory, or 2.56 GB.这允许Java堆分配一个像共享内存的最大大小,或2.56 GB的大。 By default, o_maxdata is set to 0x80000000, leaving 2 GB for native heap and 512 MB for shared memory.默认情况下, o_maxdata设置为0x80000000,造成2 GB的机堆和512 MB内存共享。 If you attempt to allocate a Java heap larger than 1 GB, it fails because Java tries to use shared memory for heap, and there is only 512 MB of shared memory available.如果您尝试分配一个Java堆大于1 GB的,它失败,因为Java堆尝试使用共享内存,并且只有512 MB可用的共享内存。 If you set IBM_JAVA_MMAP_JAVA_HEAP in the environment and try to allocate a heap larger than 512 MB, JVM will be unable to allocate the heap.如果您设置IBM_JAVA_MMAP_JAVA_HEAP在环境和尝试分配一个大于512 MB的堆,JVM将无法分配堆。 The solution is to adjust o_maxdata in such a way that the size of shared memory grows large enough to accommodate the Java heap.该解决方案是调整o_maxdata在这样一种方式,共享的内存大小变大到足以容纳Java堆。 The next section shows you how to do this.下一节介绍如何做到这一点。 Back to top 返回顶部 Stretching the limits 伸展的极限 So how do you go to a larger Java heap?那么你如何去为一个更大的Java堆?

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论