`
whoisjackychen
  • 浏览: 13177 次
文章分类
社区版块
存档分类
最新评论

java class data sharing

 
阅读更多

 

http://docs.oracle.com/javase/6/docs/technotes/guides/vm/class-data-sharing.html

Class Data Sharing

Overview

Class data sharing (CDS) is a new feature in J2SE 5.0 intended to reduce the startup time for Java programming language applications, in particular smaller applications, as well as reduce footprint. When the JRE is installed on 32-bit platforms using the Sun provided installer, the installer loads a set of classes from the system jar file into a private internal representation, and dumps that representation to a file, called a "shared archive". Class data sharing is not supported in Microsoft Windows 95/98/ME. If the Sun JRE installer is not being used, this can be done manually, as explained below. During subsequent JVM invocations, the shared archive is memory-mapped in, saving the cost of loading those classes and allowing much of the JVM's metadata for these classes to be shared among multiple JVM processes.

In J2SE 5.0, class data sharing is supported only with the Java HotSpot Client VM, and only with the serial garbage collector.

The primary motivation for including CDS in the 5.0 release is the decrease in startup time it provides. CDS produces better results for smaller applications because it eliminates a fixed cost: that of loading certain core classes. The smaller the application relative to the number of core classes it uses, the larger the saved fraction of startup time.

The footprint cost of new JVM instances has been reduced in two ways. First, a portion of the shared archive, currently between five and six megabytes, is mapped read-only and therefore shared among multiple JVM processes. Previously this data was replicated in each JVM instance. Second, since the shared archive contains class data in the form in which the Java Hotspot VM uses it, the memory which would otherwise be required to access the original class information in rt.jar is not needed. These savings allow more applications to be run concurrently on the same machine. On Microsoft Windows, the footprint of a process, as measured by various tools, may appear to increase, because a larger number of pages are being mapped in to the process' address space. This is offset by the reduction in the amount of memory (inside Microsoft Windows) which is needed to hold portions on rt.jar. Reducing footprint remains a high priority.

Regenerating the Shared Archive

Under some circumstances the system administrator may need to manually regenerate the shared archive. This is typically only necessary on Solaris if the Java SE packages were installed over the network to a machine of a different architecture than that performing the installation. Regardless, these regeneration instructions apply to all supported platforms.

The shared archive file is colocated with the shared library for the JVM. On Unix platforms, it is stored in jre/lib/[arch]/client/classes.jsa and on Microsoft Windows platforms injre/bin/client/classes.jsa. If this file exists, it must be manually removed before regeneration.

To regenerate the archive, log in as the administrator; in networked situations, log on to a machine of the same architecture as the J2SE installation and ensure that you have permission to write to the installation directory. Then execute the command

java -Xshare:dump

Diagnostic information will be printed as the archive is generated.

Manually Controlling Class Data Sharing

The class data sharing feature is automatically enabled when conditions allow it to be used. The following command line options are present primarily for diagnostic and debugging purposes and may change or be removed in future releases.

-Xshare:off
Disable class data sharing.
-Xshare:on
Require class data sharing to be enabled. If it could not be enabled for various reasons, print an error message and exit.
-Xshare:auto
The default; enable class data sharing whenever possible.

 

分享到:
评论

相关推荐

    Java 11 压缩包版 -jdk11.0.12

    4. **动态CDS**:Class Data Sharing (CDS) 功能的扩展,使得多个JVM实例可以共享类数据,提升启动速度。 5. **ZGC**:一个低延迟的垃圾收集器,尤其适合大内存应用,可以减少应用程序暂停时间。 此外,Java 11还...

    Java虚拟机规范(Java SE 7 中文版

    3. 类数据共享(Class Data Sharing, CDS):此功能允许JVM在启动时共享已经编译的类数据,减少启动时间和内存占用。 4. 并发与多线程:Java SE 7引入了Fork/Join框架,这是一种用于并行执行任务的高级框架,适用于...

    java15-20

    - **JEP 412: Context-Sensitive Class Data Sharing**:改进了类数据共享(Class Data Sharing),使得类加载更高效,尤其是启动时间。 - **JEP 413: Strongly-Typed Heap Inspection**:加强了堆内存的检查,...

    Mastering Java 11

    5. **动态CDS(Class Data Sharing)**:这是一种新的类加载优化技术,允许在JVM启动时共享已编译的类数据,从而加快启动速度和减少内存占用。 6. **ZGC(Z Garbage Collector)**:ZGC是一个低延迟的垃圾收集器,...

    Java运行原理与Java虚拟机.pdf

    还有类数据共享(Class Data Sharing)、动态类文件加载等技术,进一步优化了Java程序的启动速度和运行效率。 总的来说,Java运行原理与Java虚拟机的紧密配合使得Java成为一种跨平台、安全且高效的语言。通过理解...

    Java-11.0.8和java-8u333( Mac版本)

    Java 11引入了一些新特性,例如HTTP客户端API、JEP 325 ( Flight Recorder ) 和JEP 310 ( Application Class-Data Sharing ),这些都是为了提高性能、可观察性和诊断性。此外,Java 11还改进了垃圾收集器,如ZGC(Z ...

    java-jdk1.8-jdk-8u202-linux-x64.zip

    - 类数据共享(Class Data Sharing, CDS):可以优化启动时间,通过预先加载类数据到共享归档文件来减少JVM启动时的内存占用。 - 对JSON支持的增强:包括内置的JSON-P(Java API for JSON Processing)和JSON-B...

    Java JDK 11 版本

    - **JEP 262:Class Data Sharing (CDS)**:CDS允许在启动时共享类数据,从而减少应用程序的启动时间和内存占用。 5. **弃用和移除**:为了保持平台的清洁和未来的发展,JDK 11中也移除了一些过时的API和功能,...

    深入理解Java7核心技术与最佳实践

    另外,类数据共享(Class Data Sharing,CDS)功能使得启动时间得以优化,通过预加载类到共享存档,减少了应用程序的启动时间。 在I/O方面,NIO.2(New IO 2.0)提供了文件系统API的增强,支持异步文件操作和路径...

    Java jdk7.rar

    2. 类数据共享(Class Data Sharing,CDS):允许在启动时共享类加载数据,减少应用启动时间。 3. 方法区(Method Area)优化:移除了永久代(Permanent Generation),改为MetaSpace,解决了JVM内存溢出问题。 4....

    Java JDK 1.8 64位 Windows

    - 类数据共享(Class Data Sharing)和压缩类空间(Compressed Class Space)进一步减少了内存占用。 6. **开发工具**: - `jvisualvm`:集成在JDK中的多合一性能分析工具,包含CPU、内存、线程等监控功能。 - `...

    Java SE Development Kit 13.0.2 x64.zip

    3. **JEPs(JDK Enhancement Proposals)**:Java 13包括了几个JEPs,如JEP 350(Dynamic CDS Archives),它允许在运行时创建类数据共享(Class Data Sharing)归档,从而在启动时提高性能。还有JEP 354(JVM ...

    java-11-openjdk-11.0.7.10-1.windows.redhat.x86_64.zip

    7. **动态CDS(Class Data Sharing)**:在启动时,可以共享类数据,减少应用启动时间。 8. **JEP 320: Remove the Java EE and CORBA Modules**:移除了不再维护的Java EE和CORBA模块,使JDK更加精简。 9. **其他...

    java版本8,官网下载太麻烦

    此外,JVM还增强了动态编译(JIT)和类数据共享(Class Data Sharing),进一步提升了运行时性能。 总结来说,Java 8通过引入Lambda表达式、Stream API、日期和时间API的改进、Optional类以及优化的垃圾回收机制,...

    The Java Language Specification, Java SE 10 Edition.rar

    6. **默认CDS档案(JEP 314)**:全称为“Class-Data Sharing”,Java 10默认启用CDS,这允许多个Java应用共享类数据,从而提高启动速度和减少内存占用。 7. **其他改进**:还包括对JVM性能的优化,如JVM内部数据...

    Java JDK11 解压版(Windows x64)

    8. **JEP(JDK Enhancement Proposals)**:Java 11包含了多个JEP,比如JEP 320(Remove the Java EE and CORBA Modules)、JEP 310(Application Class-Data Sharing)等,这些提案推动了Java平台的发展。...

    Java 9-13.zip

    另外,Java 13也对JDK内置的HTTP客户端进行了改进,并引入了“Dynamic CDS”(Class Data Sharing),这可以减少启动时间,尤其是在服务器环境中。 通过解决这些章节中的编程作业,开发者可以深入理解Java的新特性...

    最新Java 11 API

    6. **动态CDS(Class Data Sharing)**: 动态CDS允许在运行时创建共享的类数据归档文件,从而提升应用程序启动速度,特别是对于服务器端和大数据应用。 7. **JShell增强**: JShell,也称为REPL(Read-Eval-...

    Java 13 新特性概述

    2. **动态应用程序类-数据共享(Dynamic Class-Data Sharing, CDS)**: - 在Java 10中,CDS允许自定义类加载器加载的类在多个JVM之间共享,减少了启动时间和内存占用。Java 13进一步简化了CDS的使用,现在应用在...

Global site tag (gtag.js) - Google Analytics