Home » Author Archives: Peter Lawrey (page 5)

Author Archives: Peter Lawrey

Why a synchronized StringBuffer was never a good idea

java-logo

Introduction StringBuffer is a synchronized class for mutable strings.  The main problem with making it synchronized is that It was usually used as a local variable so making it synchronized just made it slower. It was never a good idea to use it in a multi-threaded way.  This problem is that developers assumed that methods which used StringBuffer were themselves ...

Read More »

Lies, statistics and vendors

software-development-2-logo

Overview Reading performance results supplied by vendors is a skill in itself.   It can be difficult to compare numbers from different vendors on a fair basis, and even more difficult to estimate how a product will behave in your system. Lies and statistics One of the few quotes from University I remember goes roughly like this:   Peak Performance – A ...

Read More »

Chronicle and the Micro-Cloud

java-logo

Overview A common question I face is; how do you scale a Chronicle based system if it is single writer, multiple readers. While there are solutions to this problem, it is far more likely it won’t be a problem at all. The Micro-Cloud This is the term I have been using to describe a single thread to do the work ...

Read More »

Java is dead (again)

software-development-2-logo

Here is a couple of responses to this annual question I thought worth sharing: The Day Java lost the Battle There is a common myth amongst technologists that better technology will always be the most successful or that you must keep improving or die. A counter example I use is the QWERTY keyboard. No one who uses it, does so ...

Read More »

A down side of durable messaging

software-development-2-logo

Overview Durable messaging can be very fast, as fast as non-durable messaging up to a point. Limitations of durable messaging Durable messaging is dependant on the size of your main memory and the speed of your hard drive.  If you have a HDD, this can be as low as 20 MB/s and as high as 60 MB/s.  A RAID set ...

Read More »

High Performance Durable Messaging

java-interview-questions-answers

Overview While there are a good number of high performance messaging systems available for Java, most avoid quoting benchmarks which include durable messaging and serialization/deserialization of messages. This is done for a number of reasons; 1) you don’t always need or want durable messages 2) you want the option of using your own serialization. One important reason they are avoided ...

Read More »

Java Memory Model and optimisation

java-logo

Overview Many developers of multi-threaded code are familiar with the idea that different threads can have a different view of a value they are holding, this not the only reason a thread might not see a change if it is not made thread safe. The JIT itself can play a part. Why do different threads see different values? When you ...

Read More »

Should Java be more high level or low level?

java-logo

Overview Java 8 is bringing much antisipated features such as Lambda expressions, Type Annotations and Virtual Extensions. While this functionality is a) valuable, b) playing catch up with cooler languages, are these richer, higher level functionality the only area Java should be focused.           What are the most widely used languages There are many ways to assess ...

Read More »

Local variables inside a loop and performance

java-logo

Overview Sometimes a question comes up about how much work allocating a new local variable takes.  My feeling has always been that the code becomes optimised to the point where this cost is static i.e. done once, not each time the code is run. Recently Ishwor Gurung suggested considering moving some local variables outside a loop. I suspected it wouldn’t ...

Read More »

Can synchronization be optimised away?

java-logo

Overview There is a common misconception that because the JIT is smart and synchronization can be eliminated for an object which is only local to a method that there is no performance impact.             A test comparing StringBuffer and StringBuilder These two classes do basically the same thing except one is synchronized (StringBuffer) and the ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.