`
不吃鱼的猫
  • 浏览: 25309 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Java Performance Tuning - Weak Reference

阅读更多

In the best practise of java performance tuning
We always heard about that: The long term object hold a short term object is one of the most likely way to lead to performace issue.

What is that supposed to mean? It absolutely doesn't make any sence, So let's get it more concrete.

Let's say In a service class. There is a global Map,  which hold the user's order entry. The Entry is a transient object which reserve only for a short time. But when the global map fill the Entry, It's exist as long as the global Map. With time, the global map become bulky coz some many short term object has not been collected which are meant to collected!! 

So in this case, the weak reference come to rescue.

The Entry set in the global Map is a weak reference. If Entry Object is only reference by the weak reference ,then the entry will be the candidate for gc.

For details on

http://www-128.ibm.com/developerworks/java/library/j-jtp11225/     Give a brief introduction with Weak reference.

http://java.sun.com/developer/technicalArticles/ALT/RefObj/              Official iintroduction to Reference Object from Sun.

What is soft reference?
If the only remaining references to an object are weak or soft references, then that object is said to be softly reachable. The garbage collector does not aggressively collect softly reachable objects the way it does with weakly reachable ones -- instead it only collects softly reachable objects if it really "needs" the memory. Soft references are a way of saying to the garbage collector, "As long as memory isn't too tight, I'd like to keep this object around. But if memory gets really tight, go ahead and collect it and I'll deal with that." The garbage collector is required to clear all soft references before it can throw OutOfMemoryError.

More details about soft reference. Please refer
http://www.ibm.com/developerworks/java/library/j-jtp01246.html?S_TACT=105AGX02&S_CMP=EDU

 

分享到:
评论

相关推荐

    Java performance tuning - getting started

    ### Java性能调优入门 #### 引言 本文档旨在为读者提供一系列有用的起步方法,以解决与Java相关的性能问题,并帮助用户针对HP-UX环境下的Java应用进行性能调优。文档并不涵盖所有细节,而是作为该领域的入门指南。...

    Oracle 11G Performance Tuning - sg3

    ### Oracle 11G Performance Tuning - sg3 #### 标题解读: “Oracle 11G Performance Tuning - sg3” 这个标题指出了文档的主要内容:针对Oracle Database 11g版本的数据库性能优化。其中,“sg3”表示这是性能...

    Oracle 11G Performance Tuning - sg2

    ### Oracle 11G Performance Tuning - sg2 #### 标题解读: “Oracle 11G Performance Tuning - sg2” 这个标题明确指出了文档的主要内容是关于 Oracle Database 11g 的性能调优。其中,“sg2”可能是指该文档属于...

    Linux Debugging and Performance Tuning (Prentice, 2005)

    Linux Debugging and Performance Tuning (Prentice, 2005)

    Oracle 11G Performance Tuning - sg1

    这涉及识别和重写低效的SQL语句,利用执行计划(EXPLAIN PLAN)进行分析,并使用SQL Tuning Advisor等工具来优化查询。 4. 索引优化:索引是提高数据库查询性能的关键因素。要对索引进行维护,包括创建和删除索引,...

    Oracle Database 12c Performance Tuning - Vol 2

    本卷《Oracle Database 12c: Performance Management and Tuning Student Guide - Volume II》主要围绕性能管理和调优展开,旨在帮助读者深入理解如何有效地管理和优化 Oracle 12c 数据库的性能。 #### 二、性能...

    Oracle Database 12c Performance Tuning - Vol 1

    在《Oracle Database 12c: Performance Management and Tuning》这本学生指南中,作者Donna Keesling和James Spillery系统地介绍了Oracle Database 12c版本中的性能管理和调优方法。本书不仅涵盖了基本的性能监控...

    Performance Tuning --oracle 9i 性能调整与优化

    在Oracle 9i数据库管理系统中,性能调优是一项关键任务,它涉及到多个层面,如数据缓冲区、共享池、日志缓冲区和排序区的调整。以下是对这些关键组件的详细解释和优化策略。 1. 数据缓冲区调整(Buffer Cache) ...

    mysql监测工具tuning-primer.sh

    其中,“tuning-primer.sh”就是一个广为使用的MySQL性能调优脚本。这个脚本能够帮助我们分析数据库的配置参数,提供优化建议,从而提升数据库的运行效率。 “tuning-primer.sh”是一款基于Shell的开源工具,由...

    java performance tuning

    在本文中,我们将深入探讨Java性能调优的关键知识点,并基于提供的资源"java performance tuning.chm"来展开讨论。 1. **JVM参数调整**: - **堆内存设置**:Java应用的内存分为年轻代、老年代和永久代(Java 8...

    2-day-performance-tuning-guide.pdf

    这些知识点将围绕Oracle数据库性能调优,并尽可能地反映在该2-day-performance-tuning-guide.pdf文件中可能包含的内容。以下内容将尽可能细致地阐述相关的知识点: ### 知识点一:性能调优基础概念 - **性能调优的...

    Java Performance Tuning

    《Java性能调优》这本书是O'Reilly & Associates, Inc.出版的一本专注于提升Java应用程序性能的专业指南。书中深入探讨了如何优化Java虚拟机(JVM)的性能,以达到程序运行更快、更稳定的目标。Java性能调优是开发者...

    Performance-Tuning-Guide-for-Mellanox-Network-Adapters.pdf

    《Mellanox网络适配器性能调优指南》(Performance Tuning Guide for Mellanox Network Adapters) 是一份由Mellanox Technologies发布的技术文档,旨在为用户提供关于如何优化Mellanox网络适配器性能的详细指导。...

    Audio-Tuning-Tool-exe-v2.2052.rar

    《MTK音频调试工具——Audio-Tuning-Tool-exe-v2.2052详解》 MTK(MediaTek)音频调试工具是一款专为MediaTek芯片平台设计的专业软件,用于帮助开发者、工程师以及爱好者对手机或其他设备的音频系统进行调试和优化...

    AIX-Performance-Tuning-VUG-May2418.pdf

    AIX系统性能调优是IT领域中一项关键技术,它涉及到一系列方法和最佳实践,用于优化和改善AIX(Advanced Interactive eXecutive)操作系统的性能。AIX是IBM公司开发的一种UNIX操作系统,广泛应用于其Power Systems...

    Java.EE.7.Performance.Tuning.and.Optimization.178217642X

    Title: Java EE 7 Performance Tuning and Optimization Author: Osama Oransa Length: 398 pages Edition: 1 Language: English Publisher: Packt Publishing Publication Date: 2014-06-25 ISBN-10: 178217642X ...

    Java_Performance_Tuning_2nd

    本书《Java Performance Tuning, 2nd Edition》由Jack Shirazi编写,旨在为Java开发者提供全面且深入的性能调优指南。无论是对初学者还是经验丰富的开发人员来说,书中涵盖的知识点都是极其宝贵的资源。 #### 二、...

    database-2-day-performance-tuning-guide.pdf

    《Oracle® Database 2 Day + Performance Tuning Guide》是一本专为Oracle数据库性能优化设计的指南,由Oracle公司及其关联公司在2019年发布。该指南由Rajesh Bhatiya为主要作者,并由众多Oracle专家共同贡献。本书...

Global site tag (gtag.js) - Google Analytics