Blog Post

Apps on Azure Blog
3 MIN READ

Java on Azure Functions - 2023 Update

kulkarnisonia16's avatar
Oct 25, 2023

The Azure Functions team is thrilled to share the key investments made in 2023 to enhance our Java offering on the platform and delight customers. This post will also talk about the roadmap for the next year.  

 

What’s new? 

 

  1. [GA] Dependency Injection hooks in Java  
  2. [GA] Application Insights Distributed Tracing for Java Functions  
  3. [GA] Azure SQL bindings for Azure Functions Java 
  4. Durable Functions enhancements 
  5. Cold Start improvements 

 

Dependency Injection hooks in Java (GA)  

 

Azure Functions Java now supports the dependency injection (DI) software design pattern, which is a technique to achieve Inversion of Control (IoC) between classes and their dependencies. Azure Functions Java provides a hook to integrate with popular Dependency Injection frameworks in your Functions Apps. This gives frameworks like Spring, Quarkus, Google Guice, Dagger, etc. the ability to create the function instance and register it into their IOC container to manage your functions naturally.  Read documentation and try out samples. 

 

Application Insights Distributed Tracing for Java Functions (GA)  

 

To view more data from your Java-based Azure Functions applications than is collected by default, enable the Application Insights Java 3.x agent. This agent allows Application Insights to automatically collect and correlate dependencies, logs, and metrics from popular libraries and Azure SDKs. This telemetry is in addition to the request telemetry already captured by Functions. 

Configure this by setting the “Recommended” collection level in the Application Insights resource associated with your Function App. 

 

By using the application map and having a more complete view of end-to-end transactions, you can better diagnose issues. You have a topological view of how systems interact along with data on average performance and error rates. You also have more data for end-to-end diagnostics. You can use the application map to easily find the root cause of reliability issues and performance bottlenecks on a per-request basis. For more advanced use cases, you can modify telemetry by adding spans, updating span status, and adding span attributes. You can also send custom telemetry by using standard APIs.  You can also profile your production Java Function applications using the Application insights profiler. This feature is currently in public preview.  

 

Initial preview of the distributed tracing for Azure Functions Java had a cold start implication of 9s which was optimized to less than 1s by GA. Read documentation on how to enable this. Try it out with sample code. 

 

Azure SQL Bindings for Azure Functions Java 

 

Azure Functions Java now supports input bindings, output bindings, and a function trigger for the Azure SQL and SQL Server products. Read the documentation and check out samples to get started.  

 

Durable Functions enhancements 

 

Since Durable Functions General Availability in December 2022, the team has added new capabilities like support for restart, suspend/resume, and waiting for orchestration completion from the SDK. Check out supported application patterns and create your first durable function in Java. Get in touch with us on the Java Durable functions repository. 

 

Cold start improvements 

 

The team worked tirelessly to drastically lower the cold start numbers by optimizing the Java worker and its communication with the Functions host. 

Timeline    

percentile_Time_taken_50    

    

percentile_Time_taken_99    

    

January ‘23  

(before cold start optimization on Java worker)    

1,293.667ms    

6,964ms    

October ‘23  

(after cold start optimization on Java worker)    

647ms (reduced by ~50%)    

1750ms (reduced by ~75%)    

 

What’s next? 

 

In the upcoming months, we will work on supporting the latest and the greatest runtime stack version (Java 21 LTS), SDK Type bindings, custom GSON support and more. 

If you haven’t already tried Azure Functions Java, here is how you can get started. 

Get in touch with us anytime by creating issues in the Azure Functions Java GitHub repository. 

Updated Oct 26, 2023
Version 3.0
No CommentsBe the first to comment