Developers
June 1, 2020

Google Brings Java 11 to Google Cloud Functions

Google brings the ability to write functions in Java, with Java 11 for Google Cloud.
Source: Unsplash

Google has announced the beta release of Java 11 for Google Cloud Functions. This is a significant milestone for both Java and the Google Cloud Platform, bringing Java on par with other languages that are commonly used for Google Cloud development.

Why Java?

There’s a lot of reasons why Google likely wanted to bring Java 11 to Google Cloud.

Originally released in 1995 and 1996, Java has gone on to become one of the most popular programming languages in history. Even 25 years after its initial release, it continues to rank in the top three programming languages. In fact, according to the TIOBE Programming Community Index, Java has consistently ranked in the top three programming languages since 2000, and has been bouncing between one and two since 2005.

It’s not hard to understand why Java is so popular. Originally, Sun Microsystems’ goal was to create a programming language around the principle of Write Once, Run Anywhere (WORA). While some may argue that Java has failed to completely meet that goal, if it hasn’t, it has certainly come closer than any other language.

The key to Java’s WORA approach is the Java Virtual Machine (JVM). By building the language around a virtual machine, it adds a layer of abstraction that makes it much easier to create software for a variety of platforms. The JVM takes the programmer’s code and converts it into bytecode, which is then compiled by the JVM’s Just In Time (JIT) compiler. This converts the bytecode into machine code for the native platform.

Once the JIT translates the bytecode to native code, it caches it and keeps it in memory to speed up operations. This is why many Java programs have a reputation of starting up slow. The JIT compiler is converting the bytecode and caching the native code, causing the initial delay. Once it’s up and running, however, a Java program often runs just as fast as a fully native application.

In fact, Java has such a reputation for performance that many high-performance web applications run off of Java, such as Apple, Google, Facebook, Linked, Netflix, Twitter and more. In some cases, such as Twitter, companies have switched from other languages and platforms to Java specifically because of the performance gains they saw.

Security is another advantage of Java. Although not the most secure language, it ranks relatively high. As a result, Java is often seen to have the right balance of features, performance, usability and security.

Java 11 and Google Cloud Functions

With Java 11 on Google Cloud Functions, developers can write Cloud Functions using any JVM-compatible language, such as Java, Groovy, Scala, Kotlin and more. Google Cloud already supported serverless Java microservices in App Engine and Cloud Run, but this announcement brings an event-driven, serverless compute platform that can be run in the cloud or locally.

“With Cloud Functions for Java 11, now in beta, you can use Java to build business-critical applications and integration layers, and deploy the function in a fully managed environment, complete with access to resources in a private VPC network,” writes Developer Advocates Ray Tsang and Guillaume Laforge in the announcement. “Java functions will scale automatically based on your load. You can write HTTP functions to respond to HTTP events, and background functions to process events sourced from various cloud and GCP services, such as Pub/Sub, Cloud Storage, Firestore, and more.

“Functions are a great fit for serverless application backends for integrating with third-party services and APIs, or for mobile or IoT backends. You can also use functions for real-time data processing systems, like processing files as they are uploaded to Cloud Storage, or to handle real-time streams of events from Pub/Sub. Last but not least, functions can serve intelligent applications like virtual assistants and chat bots, or video, image and sentiment analysis.”

In addition to Google’s own Functions Framework for Java, Google Cloud Functions now has out-of-the-box support for both Micronaut and the Spring Cloud Function project.

Google Cloud and Java: A Match Made In Heaven

Google Cloud is currently in third place in the US cloud market. At the same time, CEO Thomas Kurian has a stated goal of becoming at least the number two provider within five years.

Improving Java support, one of the most popular languages on the planet, not to mention one ideally suited for web application development, is a smart move for Google Cloud. Making it easier for Java developers to use Google Cloud can only help with the company’s goal to take the number two spot.

In the meantime, developers can get started with the Quick Start guide and a free trial of Google Cloud.

TagsGoogle CloudJava
Matt Milano
Technical Writer
Matt is a tech journalist and writer with a background in web and software development.

Related Articles

Back
DevelopersJune 1, 2020
Google Brings Java 11 to Google Cloud Functions
Google brings the ability to write functions in Java, with Java 11 for Google Cloud.

Google has announced the beta release of Java 11 for Google Cloud Functions. This is a significant milestone for both Java and the Google Cloud Platform, bringing Java on par with other languages that are commonly used for Google Cloud development.

Why Java?

There’s a lot of reasons why Google likely wanted to bring Java 11 to Google Cloud.

Originally released in 1995 and 1996, Java has gone on to become one of the most popular programming languages in history. Even 25 years after its initial release, it continues to rank in the top three programming languages. In fact, according to the TIOBE Programming Community Index, Java has consistently ranked in the top three programming languages since 2000, and has been bouncing between one and two since 2005.

It’s not hard to understand why Java is so popular. Originally, Sun Microsystems’ goal was to create a programming language around the principle of Write Once, Run Anywhere (WORA). While some may argue that Java has failed to completely meet that goal, if it hasn’t, it has certainly come closer than any other language.

The key to Java’s WORA approach is the Java Virtual Machine (JVM). By building the language around a virtual machine, it adds a layer of abstraction that makes it much easier to create software for a variety of platforms. The JVM takes the programmer’s code and converts it into bytecode, which is then compiled by the JVM’s Just In Time (JIT) compiler. This converts the bytecode into machine code for the native platform.

Once the JIT translates the bytecode to native code, it caches it and keeps it in memory to speed up operations. This is why many Java programs have a reputation of starting up slow. The JIT compiler is converting the bytecode and caching the native code, causing the initial delay. Once it’s up and running, however, a Java program often runs just as fast as a fully native application.

In fact, Java has such a reputation for performance that many high-performance web applications run off of Java, such as Apple, Google, Facebook, Linked, Netflix, Twitter and more. In some cases, such as Twitter, companies have switched from other languages and platforms to Java specifically because of the performance gains they saw.

Security is another advantage of Java. Although not the most secure language, it ranks relatively high. As a result, Java is often seen to have the right balance of features, performance, usability and security.

Java 11 and Google Cloud Functions

With Java 11 on Google Cloud Functions, developers can write Cloud Functions using any JVM-compatible language, such as Java, Groovy, Scala, Kotlin and more. Google Cloud already supported serverless Java microservices in App Engine and Cloud Run, but this announcement brings an event-driven, serverless compute platform that can be run in the cloud or locally.

“With Cloud Functions for Java 11, now in beta, you can use Java to build business-critical applications and integration layers, and deploy the function in a fully managed environment, complete with access to resources in a private VPC network,” writes Developer Advocates Ray Tsang and Guillaume Laforge in the announcement. “Java functions will scale automatically based on your load. You can write HTTP functions to respond to HTTP events, and background functions to process events sourced from various cloud and GCP services, such as Pub/Sub, Cloud Storage, Firestore, and more.

“Functions are a great fit for serverless application backends for integrating with third-party services and APIs, or for mobile or IoT backends. You can also use functions for real-time data processing systems, like processing files as they are uploaded to Cloud Storage, or to handle real-time streams of events from Pub/Sub. Last but not least, functions can serve intelligent applications like virtual assistants and chat bots, or video, image and sentiment analysis.”

In addition to Google’s own Functions Framework for Java, Google Cloud Functions now has out-of-the-box support for both Micronaut and the Spring Cloud Function project.

Google Cloud and Java: A Match Made In Heaven

Google Cloud is currently in third place in the US cloud market. At the same time, CEO Thomas Kurian has a stated goal of becoming at least the number two provider within five years.

Improving Java support, one of the most popular languages on the planet, not to mention one ideally suited for web application development, is a smart move for Google Cloud. Making it easier for Java developers to use Google Cloud can only help with the company’s goal to take the number two spot.

In the meantime, developers can get started with the Quick Start guide and a free trial of Google Cloud.

Google Cloud
Java
About the author
Matt Milano -Technical Writer
Matt is a tech journalist and writer with a background in web and software development.

Related Articles