Deploy and Scale Spring Batch in the Cloud – with Adaptive Cost Control

Engineering | Josh Long | May 21, 2024 | ...

May 21, 2024, at 9 AM PST

You can now use Azure Spring Apps to effectively run Spring Batch applications with adaptive cost control. You only pay when batch jobs are running, and you can simply lift and shift your Spring Batch jobs with no code change.

Spring Batch is a framework for processing large amounts of data in Java applications. It provides reusable functions for logging, transaction management, job statistics, job restart, skipping errors, and resource management. It also supports high-performance tasks through optimization and partitioning. Introduced in March 2008, Spring Batch is popular among Java developers and is part of the Spring portfolio. It is widely used in modern enterprise systems to handle complex batch processing tasks efficiently.

Running Spring Batch jobs in the cloud presents several challenges:

  • Scalability: Ensuring batch jobs can scale efficiently to handle large volumes of data.
  • Cost Management: Controlling costs by only paying for resources when jobs are running.
  • Job Lifecycle Management: Managing the lifecycle of batch jobs, including scheduling, monitoring, and restarting jobs if they fail.
  • Infrastructure Management: Handling the underlying infrastructure, such as servers and storage, required to run batch jobs.
  • Security: Securing the batch jobs and the data they process.
  • Monitoring: Setting up effective monitoring and logging for job performance and errors.

Again, you can now use Azure Spring Apps to effectively run Spring Batch applications with adaptive cost control:

  • You only pay when batch jobs are running.
  • You can simply lift and shift your Spring Batch jobs with no code change.

We are announcing the public preview of Jobs in Azure Spring Apps to enable you to deploy and scale Spring Batch applications without worrying about job scalability, cost control, lifecycle, infrastructure, security, and monitoring. This makes it easier to handle large-scale data processing efficiently, leveraging the flexibility and scalability of the cloud.

Introduction to Jobs in Azure Spring Apps

Jobs in Azure Spring Apps are tasks with a finite lifespan — they start, perform processing, and exit upon completion. Each job execution typically handles a single unit of work and can run from minutes to hours, with multiple executions running simultaneously. Examples include batch processes that run on demand and scheduled tasks — a great fit for scenarios such as data processing, machine learning, building intelligence for AI applications, and any scenario where on-demand processing is required. This capability enables developers to efficiently manage and scale tasks within their applications, ensuring optimized performance and resource usage in a cloud environment.

Jobs in Azure Spring Apps enable you to run containerized, run-to-completion tasks within your environment. They will support three trigger types:

  • Manual: Triggered on demand by a user or application.
  • Schedule: Runs on a recurring schedule.
  • Event: Triggered by an event, like a message in a queue, and can be used for CI/CD pipeline build agents.

Currently, the public preview supports manual triggers. Our engineering team is actively working on adding support for scheduled and event-based triggers, which will be available soon. This ongoing development ensures that you can fully leverage the flexibility and power of Azure Spring Apps for all your batch processing needs.

Jobs share the same environment as your Spring applications, enabling shared resources like networking and storage. You can create and manage jobs, bind secrets with Azure Key Vault, secure communications, and monitor jobs, just like your Spring applications in Azure Spring Apps. You can combine Jobs and Apps to build powerful solutions.

Deploy Spring Batch Jobs in 3 Easy Steps

You can deploy Spring Batch Jobs in 3 easy steps:

  • Create a Job
$ az spring job create --name generate-monthly-statements
  • Deploy Spring Batch Job
$ az spring job deploy --name generate-monthly-statements \

--artifact-path target/generate-monthly-statements.jar
  • Start a Job
$ az spring job start --name generate-monthly-statements

With these simple steps, you can quickly deploy and run your Spring Batch jobs on Azure Spring Apps.

Achieve Cost Efficiency and Simplicity with Adaptive Cost Control for Spring Batch Jobs

Let's use an example to explain adaptive cost control. Suppose you have a Spring Batch job needing 8 vCPUs and 16 GB of memory. Normally, you'd use a larger virtual machine, like an Azure Virtual Machine D16v5, costing around $572 USD per month. Even if you run the job for only 2 hours a day, you still pay for the full month and handle maintenance for the OS, packages, JDK, and APM.

With Azure Spring Apps, you allocate 8 vCPUs and 16 GB for just the job's runtime, say 60 hours a month. This costs around $45 USD per month, with all underlying infrastructure maintenance — OS, packages, JDK, and APM — handled for you. This reduces both infrastructure costs and the effort required by your developers and platform engineers. This approach is known as adaptive cost control.

Deploy Spring Batch Jobs and Share Your Feedback

Azure Spring Apps delivers simplicity and productivity, and you can leverage Spring experts to make your projects even more successful. You can easily deploy your Spring and polyglot applications - and now Spring Batch Jobs - to the cloud and get them up and running in no time. It's a golden path to production that simplifies the deployment process and optimizes your resource usage. We'll continue to innovate tools and optimize services for streamlining Spring app migration to cloud at scale and running those Spring apps efficiently and economically – Faster, Cheaper, and Better.

And the best part? We're offering FREE monthly grants on all tiers - 50 vCPU hours and 100 GB hours per tier. This is the number of FREE hours you get BEFORE any usage is billed, giving you a chance to test out the service without any financial charges.

So why wait? Take advantage of our FREE monthly grants and deploy your first Spring Batch Job to Azure Spring Apps today!

Go to https://aka.ms/first-spring-batch-job!!

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all