RSS feed [root] /weblog /java




login:

password:

title search:




 


Sun Dec 14 09:36:42 HKT 2014

java



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

Wed Oct 14 12:11:16 HKT 2020 From /weblog/java/libraries

high performance


Reactor framework, base on disruptor - http://www.infoq.com/news/2013/11/reactor-goes-ga

One http library to consider, Comsat - http://blog.paralleluniverse.co/2015/12/02/http-clients/

disruptor 高性能队列最佳选择 - https://xie.infoq.cn/article/7cee25201ffdaba3b8644d68d?y=qun0825

Babl High-Performance WebSocket Server - https://epickrram.blogspot.com[..]l-high-performance-websocket-server.html https://github.com/babl-ws/babl

(google search) (amazon search)


Thu Oct 08 08:22:27 HKT 2020 From /weblog/java/features

JNI


Invoking Assembly Language Programs using java native interface - http://today.java.net/lpt/a/330

Best practices for using the Java Native Interface - http://www.ibm.com/developerworks/java/library/j-jni/index.html

Other library try to simple using native library - https://inside.java/2020/10/06/jextract/

(google search) (amazon search)


Wed Oct 07 21:52:51 HKT 2020 From /weblog/java/features

java8


Introduction of Lambdas expression in Java - http://zeroturnaround.com/labs/java-8-the-first-taste-of-lambdas/ , an example show how lambdas help to clean up the duplication - http://www.nurkiewicz.com[..]mplifying-readwritelock-with-java-8.html

Another article about Java8 change, where Lambdas is the highlight - http://www.infoq.com/news/2013/08/everything-about-java-8 http://www.shaunabram.com/java8/

Nice tutorial - http://www.dreamsyssoft.com/java-8-lambda-tutorial/index.php

Huge list of articles - http://www.baeldung.com/java8

Use lambdas to replace for-loop - http://saltnlight5.blogspot.com.au[..]creating-your-own-loop-structure-in.html https://www.ibm.com/developerworks/library/j-java8idioms3

Overview for new Date/Time library - http://www.infoq.com/articles/java.time https://binkley.blogspot.com[..]/02/java-date-time-timezone-formats.html

http://www.javacodegeeks.com[..]om/2014/05/java-8-features-tutorial.html

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

Convert SQL feature to stream - http://blog.jooq.org[..]and-their-equivalents-in-java-8-streams/

Simple overview of steam operation - https://www.javaprogramto.com[..]va-8-stream-intermediate-operations.html https://mydeveloperplanet.com/2020/09/23/java-streams-by-example

Behind the scenes: How do lambda expressions really work in Java? - https://blogs.oracle.com[..]o-lambda-expressions-really-work-in-java

(google search) (amazon search)


Wed Oct 07 21:11:17 HKT 2020 From /weblog/java/features

java15


https://www.infoq.com/news/2020/09/java15-released

(google search) (amazon search)



Wed Aug 26 14:25:14 HKT 2020 From /weblog/java/features

reflection


Good : dynamic, generic
Bad: slow, don't work with Obfuscators and most searching and refactoring tools

http://jroller.com/page/ie?entry=time_to_reconsider_reflection

A very nice tool to get parameter name - https://github.com/paul-hammant/paranamer (e.g.: user of getUser(User user))

How to improve the performance - http://coding-masters.blogspot.com[..]-reflection-as-fast-as-direct-calls.html

The problem of using reflection to modify final field - http://www.azulsystems.com[..]7-writing-to-final-fields-via-reflection

Using reflection for using test - http://www.javaadvent.com[..]f-hacking-enums-and-modifying-final.html

Sharing about using invokedynamic - http://www.infoq.com/presentations/invokedynamic http://www.infoq.com[..]ticles/Invokedynamic-Javas-secret-weapon https://www.infoq.com/articles/Invokedynamic-Javas-secret-weapon

LamdbaMetafactory is pretty fast. (*) - https://www.optaplanner.org[..]8/01/09/JavaReflectionButMuchFaster.html

(google search) (amazon search)


Wed Jul 29 14:13:02 HKT 2020 From /weblog/java/performance

memory


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

More heap, GC will get slower - http://plumbr.eu[..]ing-heap-size-beware-of-the-cobra-effect

Collection of tools to analysis GC activities - http://www.fasterj.com/tools/gcloganalysers.shtml

Another presentation of performance hint for hotspot or memory - http://www.infoq.com/presentations/Extreme-Performance-Java

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

Discussion and comparison of difference GC at Java 1.7 - http://mechanical-sympathy.blogspot.com.au[..]7/java-garbage-collection-distilled.html . And here is the detail experiment among those difference GC, look like G1 is quite promising - http://java-is-the-new-c.blogspot.com.au[..]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 - https://plumbr.eu/blog/outofmemoryerror-on-overprovisioned-heap

Introduction to metaspace - http://www.infoq.com/articles/Java-PERMGEN-Removed

http://vanillajava.blogspot.com.au[..]optimising-memory-consumption-first.html

Some comments about System.gc() - http://jeremymanson.blogspot.com[..]om/2015/12/why-i-dont-like-systemgc.html

http://blog.takipi.com[..]ng-your-java-garbage-collection-overhead

Logging stop-the-world pauses in JVM - https://plumbr.eu[..]log/logging-stop-the-world-pauses-in-jvm

Why we should put difference app in same VM - http://mydailyjava.blogspot.hk[..]0/generational-disparity-in-garbage.html

Atlassian GC tuning guide - https://confluence.atlassian.com[..]ollection-gc-tuning-guide-461504616.html

Using jemalloc to get to the bottom of a memory leak - https://gdstechnology.blog.gov.uk[..]c-to-get-to-the-bottom-of-a-memory-leak/

Troubleshooting-Java-Memory-Issues - https://www.infoq.com/articles/Troubleshooting-Java-Memory-Issues

Useful parameters for OOME - https://jaxenter.com/jvm-outofmemoryerror-161257.html

Why Java's TLABs are so important and why write contention is a performance killer in multicore environments - https://www.opsian.com/blog/jvm-tlabs-important-multicore/

MMU gang wars: the TLB drive-by shootdown - http://bitcharmer.blogspot.com/2020/05/t_84.html

Latency implications of virtual memory - https://rigtorp.se/virtual-memory/

foreign-memaccess - http://cr.openjdk.java.net[..]cimadamore/panama/foreign-memaccess.html

(google search) (amazon search)


Tue Jul 14 14:44:05 HKT 2020 From /weblog/java/fundamental

object


We can control how the default hashcode return, and and what the difference of default hashcode between java7 and 8 - https://blog.codinghorror.com/complaint-driven-development/

http://sigpwned.com/2018/08/10/string-hashcode-is-plenty-unique/

https://shipilev.net/jvm/objects-inside-out

https://www.baeldung.com/jvm-measuring-object-sizes

(google search) (amazon search)


Tue Jul 14 10:37:55 HKT 2020 From /weblog/java/tools

build


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

(google search) (amazon search)



Tue Jun 09 00:02:20 HKT 2020 From /weblog/java/discussion

books


http://www.javalobby.org/articles/5books/

https://handwiki.org/wiki/Book:ThinkJava

(google search) (amazon search)


Wed Jun 03 15:55:56 HKT 2020 From /weblog/java/discussion

VM


How to write a (toy) JVM - https://zserge.com/posts/jvm/

(google search) (amazon search)


Tue Jun 02 17:50:40 HKT 2020 From /weblog/java/fundamental

garbage


Some overview articles - http://javarevisited.blogspot.com[..]/2011/04/garbage-collection-in-java.html http://jeremymanson.blogspot.com[..]10/01/garbage-collection-references.html http://www.oracle.com[..]work/java/javase/gc-tuning-6-140523.html https://www.infoq.com[..]derstand-classic-java-garbage-collection

Interview with Azul, about the pauseless GC - http://www.infoq.com/interviews/gil-tene-azul-zing

A story of how to tune GC - http://kirk.blog-city.com/why_do_i_have_this_long_gc_pause.htm

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

Java memory configuration and monitoring - http://blog.codecentric.de[..]ry-configuration-and-monitoring-3rd-act/

How Garbage Collection differs in the three big JVMs - http://blog.dynatrace.com[..]ollection-differs-in-the-three-big-jvms/

Garbage Collection Bootcamp 1.0 - http://www.lucidimagination.com[..]1/03/27/garbage-collection-bootcamp-1-0/

http://javarevisited.blogspot.sg[..]ollection-interview-question-answer.html

How CMS work - https://blogs.oracle.com[..]thecollector/entry/hey_joe_phases_of_cms

Compare between difference VM - http://www.optaplanner.org[..]IsTheFastestGarbageCollectorInJava8.html

GC handbook - https://plumbr.eu/java-garbage-collection-handbook

Check what GC you are using - http://marxsoftware.blogspot.hk[..]16/04/determining-garbage-collector.html

About G1 Java Garbage Collector - http://dobbscodetalk.com[..]G1-Java-Garbage-Collector.html&Itemid=29

Tools to visualize GC - http://gceasy.io/

Visualizing difference algorithm - https://spin.atomicobject.com[..]sualizing-garbage-collection-algorithms/

safepoints - http://performantcode.com/gc/safepoints/

Few new GCs for huge heap - https://dzone.com/articles/java-garbage-collection-3

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. - https://blogs.oracle.com[..]agazine/understanding-garbage-collectors

JVM Pauses - It's more than GC - https://blanco.io/blog/jvm-safepoint-pauses/

(google search) (amazon search)


Tue Jun 02 10:14:53 HKT 2020 From /weblog/java/fundamental

collections


Detailed decision of arraylist and linkedlist, consist of a lot benchmark results, take a look if interested: http://javachaos.crazyredpanda.com/?p=99

One bug from java HashMap explaining it can be difficult to achieve fail-fast - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6625725 http://java.dzone.com/articles/do-your-iterators-always-fail

Performance difference of difference collection - http://java-persistence-performance.blogspot.com[..]0/12/what-is-faster-jvm-performance.html http://leolewis.website.org[..]/2011/07/14/java-collection-performance/

A treelist implementation - http://binkley.blogspot.com/2007_02_01_archive.html

Implement LRU cache using LinkedHashMap - http://vanillajava.blogspot.com[..]11/06/java-secret-lru-cache-in-java.html

Problem of using soft-reference for automate cache clean up - http://comments.gmane.org[..]gmane.comp.java.jsr.166-concurrency/7982

if it claims that an element is contained in it, this might be in error, but if it claims that an element is not contained in it, then this is definitely true. - http://codingjunkie.net/guava-bloomfilter/

Comment of various collections library - http://plumbr.eu/blog/selecting-your-collections-library

List of FAQ of Java collections - http://www.journaldev.com[..]lections-interview-questions-and-answers

Java Collections – Performance (Time Complexity) - http://infotechgems.blogspot.com.br[..]1/java-collections-performance-time.html

Performance improvement for HashMap for Java8 - http://www.nurkiewicz.com[..]hashmap-performance-improvements-in.html

Introduction to GS collection - http://www.infoq.com[..]s/gs-collections-examples-tutorial-part1 http://www.infoq.com[..]s/gs-collections-examples-tutorial-part2

removeEldestEntry, interesting function of linkedhashmap - http://www.ageofjava.com[..]/prevent-your-caches-from-exploding.html

How new version of java help immutable style - https://dzone.com/articles/java-collections-are-evolving

https://blog.frankel.ch/map-merge-compute

(google search) (amazon search)


Tue Jun 02 10:14:05 HKT 2020 From /weblog/java/libraries

math


Efficient Java Matrix Library (EJML) is a linear algebra library for manipulating real/complex/dense/sparse matrices. Its design goals are; 1) to be as computationally and memory efficient as possible for both small and large matrices, and 2) to be accessible to both novices and experts. These goals are accomplished by dynamically selecting the best algorithms to use at runtime, clean API, and multiple interfaces. EJML is free, written in 100% Java and has been released under an Apache v2.0 license. - http://ejml.org/wiki/index.php?title=Main_Page

https://mkyong.com/java/java-mod-examples

(google search) (amazon search)


Tue Jun 02 08:32:20 HKT 2020 From /weblog/java/features

java14


http://cr.openjdk.java.net[..]jlaskey/Strings/TextBlocksGuide_v10.html

https://ondro.inginea.eu[..]new-features-between-java-8-and-java-14/

JDK 14 Foreign-Memory Access API Overview - https://medium.com[..]-memory-access-api-overview-70951fe221c9

Pattern Matching for instanceof in Java 14 - https://blogs.oracle.com[..]ttern-matching-for-instanceof-in-java-14

(google search) (amazon search)


Tue Jun 02 08:30:26 HKT 2020 From /weblog/java/features

unsafe


The infamous sun.misc.Unsafe explained: object creation, native memory allocation, native concurrency - http://mydailyjava.blogspot.hk/2013/12/sunmiscunsafe.html

Features that help for writing low latency application - http://vanillajava.blogspot.com[..]1/sunmiscunsafe-and-off-heap-memory.html

Tips of using unsafe - http://vanillajava.blogspot.com.au[..].com.au/2014/06/making-unsafe-safer.html

An overview of it - http://www.infoq.com[..]A-Post-Apocalyptic-sun.misc.Unsafe-World https://blogs.oracle.com[..]ine/the-unsafe-class-unsafe-at-any-speed

(google search) (amazon search)


Tue Jun 02 08:28:50 HKT 2020 From /weblog/java/features

IO


Watch service, watch if directory changed - http://www.javacodegeeks.com/2012/02/java-7-watchservice.html

Tips of using bytebuffer - http://worldmodscode.wordpress.com[..]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: http://javarevisited.blogspot.com[..]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 - https://www.marcobehler.com/guides/java-files

(google search) (amazon search)



Fri May 01 09:13:26 HKT 2020 From /weblog/java/performance

cases


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

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

A case study of solving thread contention - http://blogs.mulesoft.org[..]fighting-thread-contention-in-your-code/

http://www.cubrid.org[..]-of-java-application-performance-tuning/

Notes about measuring map performance - http://vanillajava.blogspot.com.au[..]ronicle-map-and-yahoo-cloud-service.html

High Performance Java - Binary instead of Objects - John Davies - https://vimeo.com/138956045 http://www.infoq.com/presentations/java-low-latency

jemalloc, look like a really nice tool - https://gdstechnology.blog.gov.uk[..]c-to-get-to-the-bottom-of-a-memory-leak/

story of finding why there is so many GC - http://www.infoq.com[..]horough-jvm-thorough-analysis-ygc-part01

GC thread blocked by system call - http://www.infoq.com/cn/articles/GC-Log-Uncovers-Pause https://www.infoq.com/articles/GC-Log-Uncovers-Pause

We always need benchmark - https://arnaudroger.github.io[..]2017/06/15/forward-vs-backward-loop.html

Investigation and solutions of performance issue caused by GC log - https://engineering.linkedin.com[..]c-pauses-caused-by-background-io-traffic

Using jemalloc to get to the bottom of a memory leak - https://technology.blog.gov.uk[..]c-to-get-to-the-bottom-of-a-memory-leak/

Parallel Collection Processing: Leveraging Batching - https://4comprehension.com/parallel-collection-processing-2/

Maybe good to careful about collection initalization - http://blog.pitest.org[..]ars-with-a-single-character-code-change/

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

Performance comparison of difference JVM vendor - https://www.reddit.com[..]stopping_openj9_from_overtaking_hotspot/

(google search) (amazon search)


Mon Apr 06 21:51:19 HKT 2020 From /weblog/java/network

URI


https://blog.sebastian-daschner.com[..]om/entries/creating-uris-with-uribuilder

(google search) (amazon search)


Sun Mar 29 18:15:44 HKT 2020 From /weblog/java/concurrency

collections


Even though

private List synchList = Collections.synchronizedList(new LinkedList());

is thread safe, serialize sync List is NOT thread safe for sure. The story is, if you only synchronized the collection, and if we try to get the iterator in concurrent access environment, it will throws currencymodificationexception .

For collection is small, may be making defensive copy http://www.javapractices.com/Topic15.cjp is good. Otherwise, in java5, there is concurrency collection.

reference:
http://jroller.com[..]ntry=collections_synchronizedlist_broken
http://jroller.com/page/ctarrington?entry=java_collections_trivia

Map operation, include use of FutureTask and putIfAbsent() method from ConcurrentMap. - http://www.javaspecialists.co.za/archive/newsletter.do?issue=125

Other then lterate through the elements, adding and removing elements can also be problem, this article document a few good cases about that - http://rayfd.wordpress.com[..]en-a-synchronized-class-isnt-threadsafe/

Samples of using Queue.drainTo() - http://binkley.blogspot.com[..]rforming-fixed-amounts-of-work-with.html

http://tech.puredanger.com/2009/02/28/java-7-transferqueue/

Overview of blockingqueue - http://tutorials.jenkov.com[..]/java-util-concurrent/blockingqueue.html

Simple benchmark - http://java-persistence-performance.blogspot.com[..]jvm-performance-part-iii-concurrent.html

Multi-thread behaviour - http://vanillajava.blogspot.com[..]hread-safety-issues-with-vector-and.html

java.util.concurrent.ConcurrentHashMap VS openhft.collections.SharedHashMap - http://openhft.blogspot.co.uk[..]autilconcurrentconcurrenthashmap-vs.html

Why are there so many concurrent queues implementations in Java? - https://vmlens.com/articles/cp/why_so_many_queues/

Why hashmap is not thread safe - https://www.pixelstech.net[..]a-HashMap-is-considered-as-thread-unsafe

(google search) (amazon search)



Sat Feb 29 23:23:24 HKT 2020 From /weblog/java/fundamental

memory


From java code to java heap, detail of how java use memory - http://www.ibm.com[..]rks/java/library/j-codetoheap/index.html

Algorithm of determine suitable thread pool size - http://www.javacodegeeks.com[..]reading-stories-about-robust-thread.html

Detail of how to analysis how much memory you need - http://www.javacodegeeks.com[..]m/2012/12/how-much-memory-do-i-need.html

Chinese introduction of memory model - http://www.infoq.com/cn/articles/java-memory-model-1

Difference between PermGem and MetaSpace - http://javaeesupportpatterns.blogspot.com.au[..]02/java-8-from-permgen-to-metaspace.html

How many bytes a boolean value takes in Java? - https://www.pixelstech.net[..]many-bytes-a-boolean-value-takes-in-Java

(google search) (amazon search)


Sun Feb 16 21:39:18 HKT 2020 From /weblog/java/performance

option list


-XX:+PerfDisableSharedMem , prevent locking by sharedmem in linux - http://www.evanjones.ca/jvm-mmap-pause.html

How linkedin turn the GC - http://engineering.linkedin.com[..]ughput-and-low-latency-java-applications

Using generational & concurrent GC collector - http://www.javacodegeeks.com[..]/04/ibm-jvm-tuning-gencon-gc-policy.html

Full VM option list : http://blogs.sun.com/roller/resources/watt/jvm-options-list.html, update for Java7 - http://nerds-central.blogspot.com[..]ot.com/2011/07/all-jvm-7-xx-options.html http://stas-blogspot.blogspot.com[..]ost-complete-list-of-xx-options-for.html

A simplified list for some frequency use options - http://rdafbn.blogspot.com.au[..]rbage-collector-guidelines-and-tips.html

HotSpot JVM garbage collection options cheat sheet - http://aragozin.blogspot.com[..]spot-jvm-garbage-collection-options.html http://www.oracle.com[..]va/javase/tech/vmoptions-jsp-140102.html

An example and story about effect of difference VM parameter affecting the performance - http://www.javaspecialists.eu/archive/Issue191.html

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

Discussion about -XX:MinHeapFreeRatio parameter - http://www.gossamer-threads.com[..]s.com/lists/lucene/java-user/44286#44286

The other detailed guide for VM parameters tuning - http://java.sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf

Here is a more simple cookbook - http://java.sun.com/performance/reference/whitepapers/tuning.html

A outdated (1.4) , compehensive but still not really too detailed, overview of various GC tuning - http://www.petefreitag.com/articles/gctuning/

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

Some say is useful if you have huge memory
-XX:+UseLargePages
http://blogs.sun.com[..]dagastine?entry=java_se_tuning_tip_large

Some say below parameter keep GC in low pause
-XX:MaxGCPauseMillis=5000
Some say below parameter are very optimal
-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:NewSize=1200m -XX:SurvivorRatio=16
http://www.theserverside.com[..]d.tss?thread_id=41258&ASRC=EM_NNL_347804
Some say those parameter is good
-XX:+UseConcMarkSweepGC
-XX:ParallelCMSThreads=1
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:CMSIncrementalDutyCycleMin=0
-XX:CMSIncrementalDutyCycle=10
http://blog.mikiobraun.de/2010/08/cassandra-gc-tuning.html

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

-XX:+EliminateAutoBox
-XX:AutoBoxCacheMax=20000
-XX:BiasedLockingStartupDelay=500
-XX:+DoEscapeAnalysis
-XX:+OptimizeStringConcat
-XX:+OptimizeFill

Generate dump with OOME - -XX:+HeapDumpOnOutOfMemoryError

GC log sample of -XX:+UseConcMarkSweepGC -XX:PrintFLSStatistics=1 -XX:+PrintGCDetails - https://gist.github.com/1329783

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

Explanation for few performance related VM parameters - http://www.techpaste.com[..]ine-options-jvm-performance-improvement/

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

For G1GC - https://dzone.com[..]e-first-garbage-collector-tuning-flags-1

https://ionutbalosin.com[..]otspot-jvm-performance-tuning-guidelines

(google search) (amazon search)