Posts

Ballerina Services in Serverless World

Ballerina is a new programming language being developed by WSO2. Ballerina is optimized for integration and it makes writing HTTP services very easy.

I wrote a Medium story about Ballerina Services in Serverless World, which discusses how you can deploy your own Ballerina Service as a serverless function in AWS Lambda.


Benchmarking Object Pools

Last year, I wanted to benchmark different object pool implementations and I started writing a JMH benchmark for Object Pools.

However, it took some time for me to write the Python scripts to visualize the results. Few months ago, I started learning Python and I could finally write Python to scripts to analyze and visualize results from CSV files.

This is a great achievement for me and I could finally publish the results in a medium story: Benchmarking Object Pools.

Using Java Flight Recorder

I wrote a Medium story about "Using Java Flight Recorder" in last year. The story is a bit long, but it has all the details you need to know when you want to start using Java Flight Recorder (JFR).

Read more at "Using Java Flight Recorder".

Thank you!


Moving to Medium!

Ever since medium.com came, most of the people I know started to write blog posts in medium. So, I also wanted to try it out and see how it works!

My medium.com page is https://medium.com/@chrishantha/ and I already wrote one story in the last year.

I really liked the editor in Medium and I don't have to worry how my story will look when I publish it. This is the main problem I have with blogger. I have to "preview" my post to make sure it looks fine. Especially when I have code snippets. This is not really a problem of the Blogger platform. It's a problem as I use a third-party syntax highlighter.

I'm really disappointed that I didn't spend time to write more posts. My last blog post on Blogger was more than a year ago! There were many personal reasons for not writing blog posts. Anyway, now I want to start writing again and I will continue to write on Medium. I'm also planning to link my Medium stories from this blog.

Thank you for reading! :)




Benchmarking Java Locks with Counters

Image
These days I am analyzing some Java Flight Recordings from taken from WSO2 API Manager performance tests and I found out that main processing threads were in "BLOCKED" state in some situations.

The threads were mainly blocked due to "synchronized" methods in Java. Synchronizing the methods in a critical section of request processing causes bottlenecks and it has an impact on the throughput and overall latency.

Then I was thinking whether we could avoid synchronizing the whole method. The main problem with synchronized is that only one thread can run that critical section. When it comes to consumer/producer scenarios, we may need to give read access to data in some threads and write access to a thread to edit data exclusively. Java provides ReadWriteLock for these kinds of scenarios.

Java 8 provides another kind of lock named StampedLock. The StampedLock provides an alternative way to the standard ReadWriteLock and it also supports optimistic reads. I'm not goi…

Specifying a custom Event Settings file for Java Flight Recorder

Image
When you are using Java Flight Recorder (JFR), the JFR will use an event settings file to check which event types to record.

By default in JFR, there are two settings, "default" and "profile". The default setting is recommended for Continuous Recordings as it has very low overhead (typically less than 1% overhead). The profile setting has more events and useful when profiling the application.

As mentioned in my previous blog post regarding Java Flight Recorder Continuous Recordings, we use following arguments to do a Continuous Recording.

-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,repository=./tmp,dumponexit=true,dumponexitpath=./


Note: According to the Oracle documentation on "java" command, we should be able to specify "settings" parameter to the -XX:FlightRecorderOptions. However, the settings parameter has no effect when used with the -XX:FlightRecorderOptions and the default set…