Java 10 HotSpot Disassembly on macOS High Sierra

Printing Generated Assembly Code From The Hotspot JIT Compiler documented back in 2013 how to view Java Hotspot generated assembly code.

While still useful, the disassembler plugin referenced in the post is no longer available in binary form as the Kenai project has been decommissioned.

A number of references are available on how to build the plugin, however information on how to build on current macOS systems is hard to come by. Here is how to build the disassembler plugin on Java 10.

  • macOS High Sierra 10.13
  • Xcode 9.3 (including Command-line Tools)
  • pointed out the requirement for binptils 2.26
  • was a good starting point
  • OpenJDK Supported platforms:
  • OpenJDK Sources:
  • java command line arguments:


The Cost of Contention

Martin Thompson first reported on the cost of contention using a simple benchmark that measures the time to increment a 64-bit counter 500 million times using various strategies. Results were reported here (section 3.1) and here (Managing Contention vs. Doing Real Work).

I re-implemented this benchmark here.

The results I observed (running on Java 9 with a 2017 MacBook Pro with a 2.9 GHz 7th Generation Kaby Lake Intel Core i7 processor) are comparable to those reported by Martin 7 years ago.

Method Time (ms)
Kaby Lake, Java 10
Time (ms)
Single thread 70 300
Single thread with volatile 2,700 4,700
Single thread with CAS 3,500 5,700
Single thread with synchronized 2,000
Single thread with lock 9,300 10,000
Two threads with CAS 10,800 18,000
Two threads with synchronized 22,400
Two threads with lock 52,500 118,000

While this micro-benchmark is not representative of real-world workloads (as explained here), tempted by its simplicity I plan to use it as the first benchmark to track optimizations to the air-java concurrency library. This would be followed up by a more comprehensive benchmark like this one, which measure both latency  and throughput under various configurations, and finally a real-world application.

Gradle Build with Java 9 Modules and Kotlin

When starting a new Java project recently, I found it surprisingly difficult to setup the Gradle build with support for Java 9 modules and the Kotlin language.

For others who might find themselves in the same bind, here is a gist with the simplest, minimal gradle setup I came up with that includes:

  • A multi-project gradle build,
  • Java 9 modules support,
  • IntelliJ IDEA integration,
  • Kotlin language modules with support for cross-references between Java and Kotlin code in the same module.

Here is an proof-of-concept example of the above build scripts in action:

Cloud Storage Costs


Recently I did a survey of cloud storage options and their costs. My focus was to find the cheapest, scalable storage solution that I can use with minimal cost to begin with.

If you are starting a new mobile app project, without any seed funding, the best choices are still Google Cloud Datastore and Amazon DynamoDB. Both offer low per-operation and per-data costs and data replication without any fixed monthly costs.

A Note on Dynamo DB vs Cloud Datastore

If your application performs a lot of operations (reads/writes) over a relatively fixed-sized dataset, DynamoDB (with higher per-GB-per-month costs but significantly lower per-read/write costs) could be significantly cheaper. A company I worked at leveraged this difference to realize significant cloud storage cost savings by migrating from Datastore to DynaomDB.

Note: the following page is an excellent resource for those familiar with either Google Cloud services or AWS services to find out the corresponding service offerings of the other provider:

Cloud Storage Costs

Datastore (

No per node cost (bills per 100K reads/writes)

  • 6c per 100k reads
  • 18c per 100k writes

18c per gb per mo

AWS DynamoDB (

0.4c per hour minimum (for 5wps and 10 rps)

  • 0.4c per 100k reads (prorated RCUs)
  • 2c per 100k writes (prorated WCUs)

25c per gb per mo

Bigtable (

65c per hour per node (195c per hour for 3 node min)

17c per gb per mo (ssd)

Spanner (

90c per hour per node

  • 10K qps read per node

30c per gb per mo

Cloud SQL for MySQL (

19.3c per hour (13.51c per hour sustained use price) (38.6c per hour with failover replication) [2 CPUs, 7.5 GB RAM]

17c per gb per mo (ssd)



17.5c per hour (12c per hour for 1-year term) (35c per hour with failover replication) [2 CPUs, 8 GB RAM]

11.5c per gb per mo

Heroku Postgres (

27c per hour (pro-rated) [400 connections, 8GB RAM, 256 GB storage]


Product Management

As a Staff-level Software Engineer, this post by Joel Spolsky best describes my standard of excellence for Product Managers – mostly in terms of the degree of attention to detail and technical aptitude that I would expect from a self-respecting, ambitious Product Manager.

Even though Joel is talking about his experience as a Program Manager at Microsoft, most product managers I have worked with at Google and elsewhere function at least partly in the space of a Microsoft Program Manager as described here.

The Software Business

I was reminded today of a quote by Bill Gates I had read 6 years ago in then-Sun Microsystem’s just-ex-CEO, Jonathan Schwartz. Here it is:

The software business [is] all about building variable revenue streams from a fixed engineering cost base

This is from Schwartz’s Good Artists Copy, Great Artists Steal post, which is also very informative about how Software Patents are used in practice.

The above is an important definition for everyone involved in building software to keep in mind and never lose sight of.