RSS feed [root] /weblog /java



title search:


Wed Jun 23 23:53:07 AEST 2021


(google search) (amazon search)
download zip of files only

Sun May 22 22:36:05 AEST 2022 From /weblog/java/fundamental


Data in Java programs - a basic conceptual model -[..]TscD4uW2Qsbt5BlBR_7uX_BekwJ5BLSE/preview

(google search) (amazon search)

Wed May 04 00:08:30 AEST 2022 From /weblog/java/hacks


Hint to prevent blocking of loadClass by using Thread.getContextClassLoader() -[..]3/java-class-loading-performance-impact/

(google search) (amazon search)

Mon Apr 25 10:31:35 AEST 2022 From /weblog/java/performance


Performance comparison for various implementation -[..]-sachs-hppc-koloboke-trove-january-2015/

Java Hashtable, HashMap, ConcurrentHashMap – Performance impact -[..]ap-concurrenthashmap-performance-impact/

Using Red-Black tree in Map -[..]shmaps-keys-and-the-comparable-interface

(google search) (amazon search)

Fri Apr 15 22:54:04 AEST 2022 From /weblog/java/network


1,000,000 Concurrent Connections -

(google search) (amazon search)

Tue Mar 29 16:28:14 AEDT 2022 From /weblog/java/fundamental


JVM Anatomy Quark #26: Identity Hash Code -

Hash, displace, and compress: Perfect hashing with Java -

(google search) (amazon search)

Sat Mar 19 23:00:19 AEDT 2022 From /weblog/java/concurrency


Just know that interrupt() call is just setting a flag, it have to be doing IO work (like database call), or in wait() status, before the thread can really be interrupted.[..]winger?entry=swingworker_stop_that_train

Another nice explanation about interrupt, in summary:

What should we do when we call code that may cause an InterruptedException? Don't immediately yank out the batteries! Typically there are two answers to that question:
1) Rethrow the InterruptedException from your method. This is usually the easiest and best approach. It is used by the new java.util.concurrent.* package [[..]util/concurrent/Semaphore.html#acquire() ], which explains why we are now constantly coming into contact with this exception.
2) Catch it, set interrupted status, return. If you are running in a loop that calls code which may cause the exception, you should set the status back to being interrupted. For example:
while (!Thread.currentThread().isInterrupted()) {
// do something
try {
} catch (InterruptedException e) {
Remember the Law of the Sabotaged Doorbell - don't just ignore interruptions, manage them properly!


Another blog explain about InterruptedException -[..]terruptedexception-and-interrupting.html[..]running-infinite-java-regular-expression[..]derstanding-thread-interruption-in-java/

How to Stop a Java Thread Without Using Thread.stop()? -[..]a-java-thread-without-using-thread-stop/

(google search) (amazon search)

Sun Feb 13 01:08:30 AEDT 2022 From /weblog/java/features


Introduction of Lambdas expression in Java - , an example show how lambdas help to clean up the duplication -[..]mplifying-readwritelock-with-java-8.html

Another article about Java8 change, where Lambdas is the highlight -

Nice tutorial -

Huge list of articles -

Use lambdas to replace for-loop -[..]creating-your-own-loop-structure-in.html

Overview for new Date/Time library -[..]/02/java-date-time-timezone-formats.html[..]om/2014/05/java-8-features-tutorial.html

Grouping and partitioning with stream -[..]/11/java-8-streams-api-grouping-and.html
In a nutshell, make sure to never override a default method in another interface -[..]va-8-default-methods-can-break-your.html

Convert SQL feature to stream -[..]and-their-equivalents-in-java-8-streams/

Simple overview of steam operation -[..]va-8-stream-intermediate-operations.html

Behind the scenes: How do lambda expressions really work in Java? -[..]o-lambda-expressions-really-work-in-java

Useful & Unknown Java Features -[..]2022/01/05/useful-unknown-java-features/

(google search) (amazon search)

Sun Feb 06 00:05:36 AEDT 2022 From /weblog/java/concurrency


Benchmark for LongAddr -[..]

If there is a concern about wasting too many memory for Atomic* wrapper class, we may consider changed to use AtomicFieldUpdater to update primitive directly -[..]/Lesser-known-concurrent-classes-Part-1/

What exactly is 'tearing'? -[..]comments/rsr8az/what_exactly_is_tearing/

(google search) (amazon search)

Wed Feb 02 00:48:54 AEDT 2022 From /weblog/java/fundamental


Mirandas, bridges, overpasses -[..]mirandas-bridges-overpasses-50b25655bb4c

Understanding Java Compilation: From Bytecodes to Machine Code in the JVM -[..]mpilation-from-bytecodes-to-machine-code

(google search) (amazon search)

Wed Feb 02 00:38:23 AEDT 2022 From /weblog/java/performance


Debugging RAM: Java Garbage Collection - Java Heap Deep Dive, Part 1 -[..]ge-collection-java-heap-deep-dive-part-1

(google search) (amazon search)

Wed Feb 02 00:21:36 AEDT 2022 From /weblog/java/network


2 nice blog about create and unit test custom IO stream -

Java sockets I/O: blocking, non-blocking and asynchronous -[..]n-blocking-asynchronous-aliaksandr-liakh

(google search) (amazon search)

Mon Jan 10 00:41:28 AEDT 2022 From /weblog/java/features


Watch service, watch if directory changed -

Tips of using bytebuffer -[..]2/14/the-java-bytebuffer-a-crash-course/

path : ..\.\Java.txt
absolute path : C:\Users\WINDOWS 8\workspace\Demo\..\.\Java.txt
canonical path : C:\Users\WINDOWS 8\workspace\Java.txt

Read more:[..]getcanonicalpath-java.html#ixzz3A8Zya6YG

Jump to a position of a file, inputstream.skip() is faster than reader.skip(), and reader.skip() is faster than randomAccessFile.

Java & Files: An Introduction -

Modern file input/output with Java: Going fast with NIO and NIO.2 -[..]2-buffers-channels-async-future-callback

(google search) (amazon search)

Thu Jan 06 00:07:30 AEDT 2022 From /weblog/java/tools


Generate a diff page forother toreview in HG -

Introduce a tool to keep IDE code and webcontainer code in sync -

Auto complete of IDEA is pretty cool -[..]aster-with-intellij-idea-live-templates/

use ctrl-w to select text -[..]ins-ides-their-best-feature-is-control-w

7-new-tools-java-developers-should-know -

Buggy App is a simple java application that simulates different performance problems like Memory Leak, OutOfMemoryError, CPU spike, thread leak, StackOverflowError, deadlock, unresponsiveness, … -[..]buggy-app-simulate-performance-problems/

13 Best Java Decompilers for Download and Online Use for Java Developers -

Generate fake data -

(google search) (amazon search)

Wed Jan 05 00:36:02 AEDT 2022 From /weblog/java/performance


Will you get any performance improvement if you manage memory yourself? -[..]ne-is-faster-java-heap-or-native-memory/

More heap, GC will get slower -[..]ing-heap-size-beware-of-the-cobra-effect

Collection of tools to analysis GC activities -

Another presentation of performance hint for hotspot or memory -

Show how to enable and analyze the verbose:gc out data -[..]3/01/java-verbose-gc-tutorial-video.html

Discussion and comparison of difference GC at Java 1.7 -[..]7/java-garbage-collection-distilled.html . And here is the detail experiment among those difference GC, look like G1 is quite promising -[..]ng-and-benchmarking-java-7s-garbage.html

Memory is not allocate to single block, thus even you allocate enough memory in term of size, it may not enough to held individual object -

Introduction to metaspace -[..]optimising-memory-consumption-first.html

Some comments about System.gc() -[..]om/2015/12/why-i-dont-like-systemgc.html[..]ng-your-java-garbage-collection-overhead

Logging stop-the-world pauses in JVM -[..]log/logging-stop-the-world-pauses-in-jvm

Why we should put difference app in same VM -[..]0/generational-disparity-in-garbage.html

Atlassian GC tuning guide -[..]ollection-gc-tuning-guide-461504616.html

Using jemalloc to get to the bottom of a memory leak -[..]c-to-get-to-the-bottom-of-a-memory-leak/

Troubleshooting-Java-Memory-Issues -

Useful parameters for OOME -

Why Java's TLABs are so important and why write contention is a performance killer in multicore environments -

MMU gang wars: the TLB drive-by shootdown -

Latency implications of virtual memory -

foreign-memaccess -[..]cimadamore/panama/foreign-memaccess.html

Detect proactively whether application’s memory is under-allocated -

(google search) (amazon search)

Tue Dec 28 01:55:27 AEDT 2021 From /weblog/java/fundamental


Pitfall and solution of implementing finalize(), if you really need it[..]ns_Boehm/misc_slides/java_finalizers.pdf

Optimization-robust finalization -[..]C1/SC22/WG21/docs/papers/2007/n2261.html

An example showing that memory leak caused by finalize() -[..]

Beware the Finalizer queue, and java.lang.ref.Finalizer object -

try { return } finally {} -[..]892842-try-%7B-return-%7D-finally-%7B%7D

(google search) (amazon search)

Mon Dec 20 00:06:15 AEDT 2021 From /weblog/java/performance


List some common causes of memory leak in application restart. -[..]/Weblog/your_web_app_is_leaking#comments[..]/20/the-top-java-memory-problems-part-1/

Incorrect use of threadlocal -

Memory leak if load JDBC class incorrectly -

Serialization and ResourceBundle issue from core library (fixed) -

PermHeap bloat in and only in server VM -

String.subString() still held a big big char[] -

One pitfall of URLClassLoader, it cause leak from classloader, which is not obvious from the code -

Steps of finding out a memory leak by native code -[..]e/v/Dp7Rf33tij5BFBNRpVja#YnJRjM4IVyt54TV

Interesting Garbage Collection Patterns -[..]interesting-garbage-collection-patterns/

(google search) (amazon search)

Thu Dec 02 12:03:52 AEDT 2021 From /weblog/java/performance

option list

java -XX:+PrintFlagsFinal -version | findstr HeapSize , find out actual Xmx default in bytes -[..]default-parameters-of-xms-and-xmx-in-jvm

-XX:+PerfDisableSharedMem , prevent locking by sharedmem in linux -

How linkedin turn the GC -[..]ughput-and-low-latency-java-applications

Using generational & concurrent GC collector -[..]/04/ibm-jvm-tuning-gencon-gc-policy.html

Full VM option list :, update for Java7 -[..][..]ost-complete-list-of-xx-options-for.html

A simplified list for some frequency use options -[..]rbage-collector-guidelines-and-tips.html

HotSpot JVM garbage collection options cheat sheet -[..]spot-jvm-garbage-collection-options.html[..]va/javase/tech/vmoptions-jsp-140102.html

An example and story about effect of difference VM parameter affecting the performance -

Clear the code cache automatically with -XX:+UseCodeCacheFlushing -[..]time-for-long-running-java-applications/

Discussion about -XX:MinHeapFreeRatio parameter -[..]

The other detailed guide for VM parameters tuning -

Here is a more simple cookbook -

A outdated (1.4) , compehensive but still not really too detailed, overview of various GC tuning -

Some say following VM parameter is good enough
-server -Xmx -XX:+UseParallelGC[..]/page/binublog?entry=java_tuning_for_xml

Some say is useful if you have huge memory

Some say below parameter keep GC in low pause
Some say below parameter are very optimal
-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:NewSize=1200m -XX:SurvivorRatio=16[..]d.tss?thread_id=41258&ASRC=EM_NNL_347804
Some say those parameter is good

Just in case anyone is curious, the flags enabled by -XX:+AggressiveOpts in JDK 1.6.0_25 are:


Generate dump with OOME - -XX:+HeapDumpOnOutOfMemoryError

GC log sample of -XX:+UseConcMarkSweepGC -XX:PrintFLSStatistics=1 -XX:+PrintGCDetails -

A case study of tuning VM GC parameters -[..]ld-you-trust-the-default-settings-in-jvm

Explanation for few performance related VM parameters -[..]ine-options-jvm-performance-improvement/

Show the exact vm flag that java using -[..]/looking-inside-a-jvm-xxprintflagsfinal/

For G1GC -[..]e-first-garbage-collector-tuning-flags-1[..]otspot-jvm-performance-tuning-guidelines

(google search) (amazon search)

Wed Dec 01 15:07:49 AEDT 2021 From /weblog/java/features


Writing a simple Filesystem using Fuse and java 17 -[..]imple_filesystem_using_fuse_and_java_17/

(google search) (amazon search)

Mon Nov 29 00:19:57 AEDT 2021 From /weblog/java/performance


A case showing java is faster than C++ -[..]mgroups#!topic/comp.lang.c++/7aNw3PzPvMI

Case show how to improve GC time spend on a java application -[..]11/java-vm-beware-of-younggen-space.html

A case study of solving thread contention -[..]fighting-thread-contention-in-your-code/[..]-of-java-application-performance-tuning/

Notes about measuring map performance -[..]ronicle-map-and-yahoo-cloud-service.html

High Performance Java - Binary instead of Objects - John Davies -

jemalloc, look like a really nice tool -[..]c-to-get-to-the-bottom-of-a-memory-leak/

story of finding why there is so many GC -[..]horough-jvm-thorough-analysis-ygc-part01

GC thread blocked by system call -

We always need benchmark -[..]2017/06/15/forward-vs-backward-loop.html

Investigation and solutions of performance issue caused by GC log -[..]c-pauses-caused-by-background-io-traffic

Using jemalloc to get to the bottom of a memory leak -[..]c-to-get-to-the-bottom-of-a-memory-leak/

Parallel Collection Processing: Leveraging Batching -

Maybe good to careful about collection initalization -[..]ars-with-a-single-character-code-change/

Issue of using non-thread safe collection in multi-thread -[..]oting-cpu-spike-in-a-major-trading-appli

Performance comparison of difference JVM vendor -[..]stopping_openj9_from_overtaking_hotspot/

Why we chose java for HFT -[..]equency-trading-application-600f7c04da94

5 Mundane Java Performance Tips -[..]/posts/5-java-mundane-performance-tricks

(google search) (amazon search)

Sun Oct 17 22:59:31 AEDT 2021 From /weblog/java/hacks

corner case

Corner case cheat sheet in Java -[..]cornerCaseCheatSheet/cheatSheetJava.html

(google search) (amazon search)

Wed Oct 06 17:16:36 AEDT 2021 From /weblog/java/concurrency


Sample ResubmittingScheduledThreadPoolExecutor, the coding is nice!

Implement thread pool properly -

RetryExecutor -[..]/2013/07/asynchronous-retry-pattern.html

ScheduledThreadPoolExecutor corePoolSize=0 at JDK9 cause 100% CPU -[..]1-10-03-my-bug-used-up-100cpu-or-did-it/

(google search) (amazon search)

Mon Oct 04 23:47:12 AEDT 2021 From /weblog/java/tools


Understanding Apache Maven – The Series -[..]0/understanding-apache-maven-the-series/

Faster Maven builds -

(google search) (amazon search)

Sun Sep 12 23:26:48 AEST 2021 From /weblog/java/fundamental


Some overview articles -[..]/2011/04/garbage-collection-in-java.html[..]10/01/garbage-collection-references.html[..]work/java/javase/gc-tuning-6-140523.html[..]derstand-classic-java-garbage-collection

Interview with Azul, about the pauseless GC -

A story of how to tune GC -

NewRatio ( XX:MaxNewSize ) is important, but usually ignored -[..]ector/entry/the_second_most_important_gc

Java memory configuration and monitoring -[..]ry-configuration-and-monitoring-3rd-act/

How Garbage Collection differs in the three big JVMs -[..]ollection-differs-in-the-three-big-jvms/

Garbage Collection Bootcamp 1.0 -[..]1/03/27/garbage-collection-bootcamp-1-0/[..]ollection-interview-question-answer.html

How CMS work -[..]thecollector/entry/hey_joe_phases_of_cms

Compare between difference VM -[..]IsTheFastestGarbageCollectorInJava8.html

GC handbook -

Check what GC you are using -[..]16/04/determining-garbage-collector.html

About G1 Java Garbage Collector -[..]G1-Java-Garbage-Collector.html&Itemid=29

Tools to visualize GC -

Visualizing difference algorithm -[..]sualizing-garbage-collection-algorithms/

safepoints -

Few new GCs for huge heap -

Objects are allocated with extra space for an indirection pointer. When the Java threads access the object, they first read the indirection pointer to see whether the object has moved. When the garbage collector moves an object, it updates the indirection pointer to point to the new location. New objects are allocated with an indirection pointer that points to themselves. Only when an object is copied during GC will the indirection pointer point to somewhere else. -[..]agazine/understanding-garbage-collectors

JVM Pauses - It's more than GC -

Digging into Java Garbage Collection -[..]5e/digging_into_java_garbage_collection/

(google search) (amazon search)