Java Software Technology

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:


Java Software

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 Java Kotlin Software

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:

Software Technology

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]




A couple of days ago, while planning a vacation trip with my girlfriend and contemplating spending some time on Christmas Island en route back from New Zealand, I stumbled upon these photos of the hydrogen bomb explosions, which were conducted off of the island in the late 50s.

Seeing these photos stirred something very deep in me.

I thought, all my life I’ve done my best to help people, to make the world a better place, and here they were. People building bombs and blowing them up, spreading toxic, destructive, radioactive waste across the entire planet.

I felt distraught. Watching the apparently calm, relaxed faces of these men filled me with disgust and disappointment.

A bunch of white men wearing white lab coats and white goggles on a white boat, looking out onto radioactive mushroom clouds like it’s some sort of spectacle. What were they thinking? Was this some kind of a game for them? Did they feel accomplished and good about their success? Did they feel like winners while watching their successful experiments bring ruin to our planet? Did it make them feel safer? Stronger? But most important of all… did they actually take a moment to meditate, to think about the legacy their work is leaving behind? Did they have a conscience? Did they have  a trace of humanity – a trace of color, left in their souls, wrapped up in lifeless white coats, on lifeless white military boats while watching life-obliterating white mushroom clouds of radioactive dust?

And then I remembered…

My career as a Software Engineer began at age 13 when I saw the first computer land on the desk at home. As soon as I saw it I knew – I had to learn how to program this. And also, I was filled with exhilarating joy at the next thought: this can help people! And so my journey began.

My first project was an Inventory Management system to help manage the inventory and accounting of a computer store, which ran maintenance-free for two years after I left for college, helping bring computers to people’s homes where they can learn and have fun in ways never before possible or imagined.

The next project, while still in high school, was a Service Management system to track service repairs of cash registers, helping run grocery stores  that bring food to people’s homes, and again running for years after I left for college.

Once there, I built the web sites of the student radio station, the student magazine, and numerous other student organizations – helping bring the student community together and improve student life. That period culminated with a new web site of the university itself. This ran (again, maintenance-free, backed by an easy-to-use content management system) for years after I left college, with the “New Students” link front and center on the home page where I put it (and where the Dean of the University asked the project manager to put it back after she presented a modified version  with the “New Students” link removed). Again, helping bring the experience of a university education to new students for years to come.

My first project for an American company was to automate the loading of thousands of antique book records from loosely structured documents. This helped make these books available for sale at an antique book auction website – where they could be discovered by people who need them.

Then I went on to build a live-auction bidding app that allowed people to participate in live auctions over the Internet years before a big online auction site shipped the same functionality. I built the website of the City of Vacaville, including a public transit trip planner for the city, years before the arrival of city transit navigation in the behemoth maps apps of today. I built numerous other web sites and apps, including the web site of a small esoteric San Francisco chocolate shop.

I even brought the live internet auction app to the bull pen for pure-bred livestock auctions during my time at Path-Wise Corporation, a startup founded and run for a few years by a third-generation rancher, turned lawyer, turned entrepreneur.

At Fujitsu Network Communications, I made countless contributions to software that manages fibre optic connections of big Telecommunications companies, helping people connect and share with loved ones via phones and the Internet no matter the distance.

During my short stint as a contractor at Apple, I optimized the product pictures on the online Apple store, helping people buy iPhones and iPads so they can learn and connect in new ways, and do so with less impact on the environment and the company bottom line.

At Webalo, I helped the company run its app faster and more efficiently on iPhones, aimed at helping people run their business more efficiently.

At Google, I contributed to Google for Work, helping people quickly setup e-mail and office productivity apps for their small business and enjoy new standards of security and collaboration.

At an online retail company, I helped the team build a more efficient software production pipeline and heard the heartfelt gratitude of the engineers, knowing I had helped their lives a tiny bit during my short stay.

At Snapchat, I did my tiny part in helping millions of people around the world experience the joy of expressing themselves freely in the moment together with friends… even on New Year’s Eve when we all pick up our phones at once.

And now I am about to join a company that works tirelessly to make cities more enjoyable to live in, while easing transportation (in a fun way) and reducing our impact on the environment. All at once, and executed in a mindful, responsible manner.

What is your legacy?