Locks, Blocks, and Deadlocks: Oracle Docs

Excerpt from Oracle Documentation

It is important to understand how locking works in a concurrent application before continuing with a description of the concurrency mechanisms JE makes available to you. Blocking and deadlocking have important performance implications for your application. Consequently, this section provides a fundamental description of these concepts, and how they affect JE operations. Continue reading “Locks, Blocks, and Deadlocks: Oracle Docs”

Make Your Program Slower With Threads

How much do context switches matter?

By Marc Brooker

Years ago, while taking a numerical methods course, I wrote some code to calculate the expected number of shared birthdays in a group. The code is very simple: each attempt constructs a vector of N birthdays, then counts the duplicates. The outer loop runs millions of attempts, and calculates the mean number of shared birthdays across all the samples. It’s little more than a tight loop around a pseudo-random number generator. Continue reading “Make Your Program Slower With Threads”

Useful JVM Flags – Java JVM Performance Tuning

05/08/12 by Patrick Peschlow

In this part of our series we focus on one of the major areas of the heap, the “young generation”. First of all, we discuss why an adequate configuration of the young generation is so important for the performance of our applications. Then we move on to learn about the relevant JVM flags.

From a purely functional perspective, a JVM does not need a young generation at all – it can do with a single heap area. The sole reason for having a young generation in the first place is to optimize the performance of garbage collection (GC). More specifically, the separation of the heap into a young generation and an old generation has two benefits: It simplifies the allocation of new objects (because allocation only affects the young generation) and it allows for a more efficient cleanup of objects not needed anymore (by using different GC algorithms in the two generations). Continue reading “Useful JVM Flags – Java JVM Performance Tuning”

Akka Streams Kafka

If you aren’t familiar with Akka you should read up on this fabulous new approach to Java performance development. Kafka streams of course is one of the best ways to implement streaming data to the datastore of your choice. The two together – marvelous!

Continue reading “Akka Streams Kafka”

Thread.State in Java? BLOCKED vs WAITING

Article From GeekExplains Thursday, July 3, 2008

Difference between BLOCKED state and WAITING / TIMED_WAITING states?

When a thread calls Object.wait method, it releases all the acquired monitors and is put into WAITING (or TIMED_WAITING if we call the timeout versions of the wait method) state. Now when the thread is notified either by notify() or by notifyAll() call on the same object then the waiting state of the thread ends and the thread starts attempting to regain all the monitors which it had acquired at the time of wait call. At one time there may be several threads trying to regain (or maybe gain for the first time) their monitors. If more than one threads attempt to acquire the monitor of a particular object then only one thread (selected by the JVM scheduler) is granted the monitor and all other threads are put into BLOCKED state. Got the difference? Continue reading “Thread.State in Java? BLOCKED vs WAITING”