Condition variable related code is hard to understand. So let me explain

There are a few strange things about Condition related code in Java concurrency. I’ll use the following code to show you. The code is about one cup and two threads. One thread is trying to fill it, the other to drink from it. The code uses explicit Lock + Condition API. But what I’m going …

Condition variable related code is hard to understand. So let me explain Read More »

Test-and-set Primitive

First of all, it’s not the same as “compare-and-swap”. Sounds similar, but different. What it does is, Set a variable to a new value Return the old value of the variable It’s a hardware primitive, i.e. atomic. On x86 the instruction is `xchg` What can it be used for? It can be used for implementing …

Test-and-set Primitive Read More »

Lock striping vs Lock splitting

Lock stripping: Use different locks for different purposes on the whole data structure. For example, a read lock + a write lock Lock splitting: Use multiple locks for different parts of a data structure. For example, 16 locks are used for a ConcurrentHashMap, each guards N/16 buckets (N = total number of buckets)

Microservice’s independent scaling can improve overall performance. But how, and how much ? – part 3, more discussion

Caveats of “they perform the same” As you can see in the previous 2 articles (part1 and part2), distributed mode and bundled mode sometimes have the same performance. However, most of “the same performance” scenarios are based on this assumption: For a single service if the computer hardware is twice as good, then the performance …

Microservice’s independent scaling can improve overall performance. But how, and how much ? – part 3, more discussion Read More »

Microservice’s independent scaling can improve overall performance. But how, and how much ? – Part 2, different minimum computing resource

In previous article we brought up the question, and we had a conclusion: In this article we’ll example how it is like if the services have different minimum computing resources TL;DR See conclusion Method and Assumptions The methods and assumptions are basically the same as previous article . Difference is A and B here will …

Microservice’s independent scaling can improve overall performance. But how, and how much ? – Part 2, different minimum computing resource Read More »

Microservice’s independent scaling can improve overall performance. But how, and how much ?

People say if you separate services and let them scale independently, you can will get better performance by allocating what’s needed and no computation resources will be wasted. But how exactly? And how much gain will there be compared to a monolithic solution? This article will do a quantified research. TL;DR See conclusion Method Let’s …

Microservice’s independent scaling can improve overall performance. But how, and how much ? Read More »