Posts

Showing posts from February, 2019

Profiling Java application in Google Appengine Flex

Image
There are a lot of ways java applications can be profiled for memory and CPU to find memory leaks or any culprit block of code where the app spends most of the time. In Google AppEngine Flex the application code (jar or war) runs inside a docker container which in turn runs inside a VM dedicated a service/module. While Google Cloud Profile can be used for analysing live applications it only supports CPU profiling when it comes to Java in AppEngine flex. Memory profiling is supported for Java only in AppEngine standard and python and go in AppEngine flex. So as of now, one has to profile the memory in JVM manually.
SSH to the AppEngine instance If you have Editor role you can ssh to the specific appengine flex instance using gcloud utility. You can connect to the instance by clicking on the SSH button against the instance in the instances page in the appengine GCP console.
 SSH to the instance
$ gcloud --project "demoneil" app instances ssh "aef-default-20190225t133842-…

Container Registery and Minikube

In the previous post, we saw how to create a docker image out of a simple gradle/spring boot app and run it locally. In this post, we will push it to a container registry and use it to deploy it in a kubernetes cluster

Upload to Registry 

I created an account in Docker Hub and did a "docker login" in the command line with my credentials.

docker push neilghosh/gradle-spring-boot-app:latest
Note docker CLI bu default talks to Docker Hub, however one can log in to other container registries e.g. GCP's GCR or Azure's ACR by prefixing the image name with the fully qualified registry login URL.

Install and Setup Minikube
We can run Kubernetes locally using Minikube, this gives us the opportunity to develop/deploy/test quickly before we deploy into remote cluster available in GKE or AKS. Minikube uses a virtualization software like Virtual Box to deploy its containers

Download Virtual Box

Install Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/late…

Quick Microservice With Gradle Spring Boot Docker

A few years ago if you would have asked me to create a quick POC backend service with some rest APIs I would have just picked up NetBeans and created the REST APIs using jersey/glassfish (reference implementation of JSR 311 RESTful Web Services) from the UI itself. While the above is an example of creating REST APIs bottom-up from the Database layer, once can plug business logic by adding few more java classes or a service layer. Lately, I have been using Spring Boot a lot in production and it really makes the developer's life easy by not having to write a lot of boilerplate code. Annotations take care of Dependency injection, singleton, REST API mappings etc. It even has the embedded Jetty web server to run the service locally without really having to install a bulk of binary like Glassfish/Tomcat server and deploy them (comes integrated with Netbeans tough - one could right click…

I am now a Google Developers Expert !

Image
I was recently recognised as a Google Developers Expert in Cloud. This is a program run by Google Developers to recognise developers of Google technologies as well as outstanding professionals in product strategy, UX/UI, marketing, growth hacking and monetization.

While this is a great hour I would definitely thank the local community leaders and Google DevRel folks for providing me with the opportunity over the years to get involved with the communities and nominating me for this program.



Google Cloud Platform is a public cloud where I have worked most professionally and personally in side projects. I was fortunate to discover this early on was just when it was just Google AppEngine with only python and datastore support. This was a big leap over finding a free shared Linux hosting with LAMP stack and cPanel where I also hosted manage my blog in WordPress. This was probably the only way I could host some server-side scripting / dynamic web page for free before AppEngine was there. Ev…