Home » Author Archives: Peter Lawrey (page 3)

Author Archives: Peter Lawrey

SharedHashMap vs Redis

redis-logo

Overview This is a comparison between OpenHFT’s SharedHashMap and a popular key-value store Redis. Any vendor will tell you how great their product is, so I will start by outlining why you wouldn’t use SharedHashMap, before I tell you why it is a “must have” for performant applications.       Why you would use Redis? Redis is a more ...

Read More »

Chronicle and low latency in Java

java-logo

Overview I was watching this excellent presentation by Rolan Kuhn of Typesafe on Introducing Reactive Streams At first glance it appears that it has some similar goals to Chronicle, but as you dig into the details it was clear to me that there was a few key assumptions which were fundamentally different.   Key assumptions The key assumptions  in the design of ...

Read More »

Common Java Myths

java-logo

These are questions which are likely to be too advanced to ask in any interview as they may just put candidates off.  Never the less, they may be work practising in your own time.                 Myth 1) System.exit(0) prevents finally being called Why does this code System.setSecurityManager(new SecurityManager() { @Override public void checkExit(int ...

Read More »

Java arrays, Wat!?

java-logo

There is a few things you can do with arrays which are surprising.                     Is it an array or not? Serializable array = new Serializable[9]; Is array an array or a scalar? Well its a scalar which points to an array. Just like  Object o = new Object[9]; You can assign ...

Read More »

Common gotchas in Java

java-logo

Overview Java is a minimalist language with deliberately less features than other languages, never the less it has edge cases which strange effects, and even some common cases with surprising effects to trip up the unwary. If you are used to reading another language you can easily read Java the wrong way leaving to confusion. Variables are only references or ...

Read More »

Hardware Transactional Memory in Java, or why synchronized will be cool again

java-logo

Overview Hardware Transaction Memory has the potential to allow multiple threads to speculatively access the same data structure at the same time and let the cache coherence protocol determine if a conflict occurred.  HTM aims to give you the scalability of fine grain locking, the simplicity of course grain locking, and performance close to no locking at all.  If supported ...

Read More »

sun.misc.Unsafe and off heap memory

java-logo

The class sun.misc.Unsafe allows you to many of the things you shouldn’t be able to do in Java, but are still useful in very specific cases. It is to be avoided 99% of the time, however there are rare occasions where this is the only solution which makes sense. This post considers how it has been using in OpenHFT and ...

Read More »

Why we shouldn’t use more threads than we need to

java-logo

Overview There is a common argument that because we have lots of cores, and will have even more in the future we have to use them.  We just we need to find the best ways to use them but just because we can doesn’t mean we should. What is our goal? Good reasons to use multiple threads are   the ...

Read More »

Unique hashCodes is not enough to avoid collisions

java-logo

There is a common misconception that if you have unique hashCode() you won’t have collisions.  While unique, or almost unique, hashCodes are good, this is not the end of the story. The problem is that the size of a HashMap is not unlimited (or at least 2^32 in size)  This means the hashCode() number has to be reduced to a ...

Read More »

C++ like Java for low latency

java-logo

Overview Previously I wrote an article on C like Java.  This is term I had come across before. However, on reflection I thought C++ like Java is a better term as you still use OOP practices, (which not C-like) but you put more work into managing and recycling memory yourself. The term I favour now is “low level” Java programming. ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close