Inspiration

Originally, a similar solution based on Spring Boot was already being used by my website: simply-how.com. In order to lower the startup time and reduce the memory footprint, I decided to migrate to Quarkus.

What it does

The core component of this solution is an API that tracks page views.

After receiving a request, the app parses the headers and query parameters, generates relevant data and sends the end result to Elasticsearch.

The app also sends performance data such as memory usage and garbage collection metrics to Elasticsearch.

The user can either use Kibana or another visualizations solution that supports Elasticsearch to display the page view and performance dashboards.

How I built it

The migration was done in three phases:

  • Extract the analytics micro-service from the simply-how.com back-end
  • Migrate the analytics solution to Quarkus JVM
  • Configure the app to support GraalVM native with Quarkus

I used Gradle to manage the build and dependencies and Github Actions to automate the build workflow and deploy to Docker Hub.

Challenges I ran into

The GraalVM native configuration was the most challenging part as it required the configuration of the Elasticsearch client with custom GraalVM substitutions.

Accomplishments that I'm proud of

  • The startup time was down from about 10 seconds to 1 second (or less without counting the Docker startup)
  • The memory footprint was reduced by more than 75%

What I learned

Quarkus makes it very easy to add support to GraalVM native image build to your app

What's next for ES Web Analytics

  • Analyze more data from the requests
  • Improve the prebuilt dashboard

Built With

Share this project:

Updates