How Apache Fineract Close of Business batch jobs run each night, and when they stop finishing in time
The Close of Business Day job is the Spring Batch run that closes out each business day in Fineract, and it becomes a planning problem because it has to finish before the next business day opens. A core banking team with Fineract running in a test environment may see it complete in minutes on a small data set and conclude that the nightly window is safe. The Fineract README says the job can run for several hours on deployments with millions of accounts, so that conclusion does not carry over to production volumes. In practice, scale, not features, is the usual cause of a missed batch window. The same job logic that finishes quickly on a few thousand accounts can take most of a night when account counts, transaction history and product mix grow.
Fineract separates its workload by instance type, and the batch instance is the one that runs this job. The instance type is set through environment variables, and the Fineract documentation recommends one write instance, one batch instance and multiple read instances on database read replicas for high load. Confirm with your own environment team which instance runs the batch, how many processes it uses, and whether any other workload shares its database connections. The project does not provide a comprehensive production deployment guide, and the README notes that a production deployment can be complex and time-consuming. That gap means the team must set the batch window itself: measure runtime against a production-sized copy of the data, record how the job's duration grows with account count, and decide in advance what happens when the run overruns.
Planning that window starts with a timed rehearsal on realistic volume, not a feature walkthrough. Ask the vendor or internal platform team to document the job's steps in the version you plan to run, the database load each step places, and the points where a failed run can be restarted without repeating completed work. Then decide the cutoff time, the escalation path when the job is still running at that time, and who is authorized to stop it. Remote partitioning, which the README says can spread the work across worker nodes coordinated through ActiveMQ or Kafka, is one way to shorten the run, but it adds broker, worker and failure modes that must be tested before you rely on it. Confirm which broker your organization already operates and who owns it. Monitoring is the other half of the plan: track start and end times for each nightly run, the duration of each step, database connection and lock behavior, and any batch failures that need manual action. A run that starts late but finishes on time is a warning sign, and a trend in run duration across weeks is usually visible long before the window is missed.
Which Apache Fineract components take part in Close of Business
Close of Business is a nightly Spring Batch job, so its reliability depends on which instance type runs it, where the data is read and written, and how partitions reach worker nodes. The cards below cover the parts that take part and the settings that control each one.
Batch instance
The batch instance is the Fineract process that launches the Close of Business Day Spring Batch job. It is selected through the instance type environment variable set to batch, and it is the component you should size and schedule separately from user-facing traffic. Confirm with your deployment team which instance runs the job on each environment, and that no second batch instance starts the same run by accident.
Fineract docsWrite instance
The write instance handles API calls that change accounts, transactions and ledger entries, and it is the only instance type that runs Liquibase database migrations. Close of Business writes its results through the write path, so a schema change deployed during the night window can interfere with the job. Check the upgrade order and confirm that migrations are finished before the nightly run starts.
Read instances on replicas
Read instances serve reporting and client-facing queries against PostgreSQL read replicas, which keeps those queries from competing with the nightly job for primary database capacity. The documentation recommends multiple read instances for high load, and each one is configured with the read instance type. Ask how replication lag is monitored, because a read instance that trails the primary may show balances that do not yet reflect the previous night's run.
Worker nodes for partitions
When remote partitioning is enabled, the batch job splits its work into partitions that worker nodes process in parallel and report back on. Each worker is a separate Fineract process, so capacity planning must account for how many workers you run and how they reach the database. Confirm how many workers your environment uses and which settings each one needs, rather than assuming a count from another deployment.
ActiveMQ or Kafka broker
The message broker carries requests and replies between the batch coordinator and the worker nodes. If the broker is slow, unavailable or undersized, partitions wait or fail, and the run stretches past its window. The README names ActiveMQ and Kafka as supported coordination options, so choose one based on the broker your organization already operates and monitor its queue depth and availability during the night.
Fineract repositoryPostgreSQL and the tenants database
PostgreSQL is the recommended database, and each tenant's connection details are read from the tenants database. Close of Business runs per tenant, so a misconfigured tenant entry can cause one institution's run to fail or write to the wrong schema. Verify the tenant identifiers, connection pools and database credentials for every tenant before go-live, and check that the database has enough maintenance window for the nightly job.
FSIP-9 proposalHow the batch master, workers, broker and database exchange work during a partitioned run
The run starts on the batch instance, which acts as coordinator: it plans the Close of Business work and hands partitions to worker nodes through the broker, either ActiveMQ or Kafka. Workers read and write the PostgreSQL primary, while read instances stay on replicas so reporting and API traffic never compete with batch writes. Check that the batch network zone, broker and database sit on the boundaries you have agreed, that broker access is authenticated, and that each worker's results return to the coordinator before the run is marked complete.
Coordinator, broker, workers and database during a partitioned Close of Business run.
Which Close of Business batch jobs setup fits your volume and team
This table compares four ways to run the Close of Business Day batch job: a single batch instance, remote partitioning over ActiveMQ or Kafka, and a hybrid that splits the window by tenant. Read each row against your account volume, tenant count and in-house skills. The main takeaway is that remote partitioning adds a broker and failure modes you must own, so choose it only when a single batch process cannot finish inside your daily window.
| Option | When it fits | Operational cost | What to validate in your environment |
|---|---|---|---|
| Single batch instance | Smaller account base where the nightly job completes well inside the end-of-day window with headroom for reruns | Lowest: one batch instance, one database, standard logs. Failures usually mean restarting the job from its last checkpoint | Measure run time on a copy of production volume, including the slowest month-end day and a forced restart |
| Remote partitioning with ActiveMQ | Large account base where the job runs for hours and worker nodes can be added to shorten the window | Requires a JMS broker to operate, secure and back up, plus worker nodes. Must handle lost messages, stuck partitions and duplicate execution | Confirm broker support with your Fineract version, broker high availability, and who on your team can diagnose a stalled partition |
| Remote partitioning with Kafka | Large deployments where Kafka is already run as shared platform infrastructure and the team has Kafka operations skills | Requires a Kafka cluster with topic, retention and access control management. Adds consumer lag and rebalancing to watch during the batch window | Check whether your platform team already owns Kafka capacity, and test how the job behaves when a worker node is terminated mid-run |
| Hybrid split by tenant | Multi-tenant deployments where tenants have different cut-off times or where one large tenant dominates run time | Combines the operating cost of the chosen partitioning model with per-tenant scheduling, reporting and exception handling | Confirm that tenant scheduling and ordering rules meet your regulator and finance reconciliation requirements before adopting it |
| Monitoring and alerting | Needed for every option, and more demanding once work is spread across nodes | Requires dashboards for job status, step duration, failed partitions and database load, plus on-call procedures | Define the alert that fires when the job is still running past your agreed cut-off, and who decides whether to rerun |
| Team skills | Choose the option your team can operate at 2 a.m. during a failed run, not the option that looks fastest on paper | Each added component needs at least one person who understands it deeply, and that knowledge is a recurring cost | Identify named owners for the Fineract batch job, the broker or cluster, and the database, and confirm their availability for the batch window |
How to configure remote partitioning for Apache Fineract Close of Business
This sequence takes a Fineract deployment from a confirmed release and database baseline to a batch window where Close of Business runs across partitioned worker nodes, with a check at each stage so the team knows the setup works before relying on it overnight.
Confirm the release and PostgreSQL baseline
Before touching configuration, the platform team picks the Fineract 1.x release they will run, checks it against the official release notes, and confirms the database is PostgreSQL, the recommended engine. MariaDB and MySQL are deprecated under FSIP-9, so a deployment on either should be planned as a migration, not a tuning exercise. Record the release tag, the PostgreSQL version and the JDBC driver in the runbook. Done means every environment, including the batch environment, reports the same release tag and the same database engine.
Separate write, batch and read instances
The platform engineers deploy distinct Fineract instances and set each instance type through environment variables: one write instance, one batch instance and one or more read instances pointed at read replicas for high load. Keeping the batch instance separate means nightly work does not compete with teller and API traffic on the write node. Check that each instance starts, reports its configured type in its logs or health endpoint, and that the batch instance is not serving user-facing API traffic.
Run Liquibase migrations on the write instance only
Schema migrations run only on write instances, so the team runs them once, from the write node or through the separate liquibase-only Spring profile on Kubernetes, before starting batch and read instances. Confirm the migration completes without errors and that the database change log shows every changeset applied. Starting the batch instance against an unmigrated schema is a common cause of failed nightly runs, so this check should be a go or no-go gate in the deployment pipeline.
Stand up the ActiveMQ or Kafka broker
The team chooses the broker that matches its operations skills and existing estate: ActiveMQ or another JMS broker, or Apache Kafka. The platform team provisions it inside the client's network, sizes it with the infrastructure team, and restricts access to the Fineract coordinator and worker nodes only. Confirm with the Fineract documentation and the broker vendor which settings the partitioning feature expects. Done means the broker accepts a test message from a Fineract node and a test consumer receives it.
Enable the coordinator and worker nodes
The coordinator (the batch instance) and the worker nodes are configured with the remote partitioning settings described in the Fineract documentation, including the broker connection and the number of workers. Each worker must point at the same tenants database and the same broker as the coordinator. Start the workers and check in the broker console or the application logs that each worker registers with the coordinator before any job is launched. A worker that does not appear is a configuration error to fix before the next step.
Secure broker and database credentials
Replace the default development login and password before any shared environment is used, and store broker and database credentials in a secrets manager rather than in plain environment files. Enable HTTPS and the SSL settings documented for Fineract, restrict database and broker network access to the Fineract nodes, and confirm that the batch and worker nodes use service accounts with only the permissions they need. Done means a scan of the configuration shows no default credentials and no unencrypted connection on the batch path.
Dry run on production-sized data
Before a batch window is scheduled, the team runs Close of Business on a copy of production-sized data in a non-production environment and records the run duration, partition count, failed partitions and any retries. Compare account counts and ledger totals before and after the run to confirm the job posts what it should. The dry run tells the team whether the window is realistic, because the Fineract README notes that the job can run for several hours on deployments with millions of accounts. Done means the team has a signed-off run report with reconciled totals.
Schedule the batch window and monitor it
Once the dry run passes, the operations team sets the nightly schedule with a defined window, alerts on job failure and on partitions that stall, and tracks run duration over time, along with broker queue depth and database load. They confirm with business owners which processes must finish before the next business day. The check is a scheduled run in the nightly window with alerts confirmed to reach the on-call team, followed by a review of the first live run's report.
How the batch setup changes across single node, Kubernetes and air-gapped deployments
A single-node or small deployment usually runs the write, batch and read roles on one or few application instances against one PostgreSQL server. Remote partitioning is not needed at this size, so the Close of Business Day job runs in its local form and no message broker has to be operated for batch. The main risk is that one host carries interactive API traffic, reporting reads and the nightly run at the same time, so the team has to decide when the batch window opens and how it stays clear of branch hours.
- Instance layout: Keep one write instance and one batch instance, even on a single host where they are separate processes, so that Liquibase migrations and nightly work follow the documented role split.
- Broker operation: Confirm that no ActiveMQ or Kafka broker is required for the local batch run, and that business event publishing stays disabled unless a downstream consumer needs it.
- Release handling: Plan upgrades as full stop-and-start windows, since there is no second node to take traffic during a database migration.
- Scheduling: Set the nightly start time outside branch and reporting hours, and record how long the last run took against the batch window.
Confirm with the platform owner who holds the database backup schedule, the host sizing for overlapping processes and the procedure for rerunning a failed business date.
On Kubernetes, the batch role can be separated from the write role as its own deployment, and worker pods can be scaled for remote partitioning. Fineract's documentation notes that Liquibase migrations can run separately with the liquibase-only Spring profile, which lets the platform run schema changes as a controlled step before the write and worker pods roll out. The broker is a separate service in the cluster, so its availability, storage and upgrades must be owned by someone.
- Instance layout: Run the batch manager and worker pods from the same image, and scale workers with cluster policy rather than fixed host counts.
- Broker operation: Decide whether ActiveMQ or Kafka runs in the cluster, as a managed service or on separate infrastructure, and set retention and persistence so partition messages survive a pod restart.
- Release handling: Run the liquibase-only profile as a job before the write deployment rolls, and keep batch and write images on the same release.
- Observability: Expose job execution metrics and logs from every worker so one failed partition can be traced to its pod.
Confirm with the platform owner the resource quotas for worker pods, the broker's high availability setup, the image promotion path and who approves a rollback when a migration has already run.
In an air-gapped network, nothing reaches the cluster from the internet during the batch run or during an upgrade. The Fineract images, the PostgreSQL driver, the broker software, the monitoring stack and their dependencies must be mirrored into the network and verified before they are used. Because updates arrive in batches, release handling becomes a planned transfer with its own review, not a routine pull.
- Instance layout: Keep the same write, batch and read split as the connected design, and size worker capacity against the internal network rather than against any external service.
- Broker operation: Deliver the broker, its client libraries and its configuration inside the network, and test failover on internal hosts only.
- Release handling: Transfer each Fineract release with its checksums and migration scripts, test the Liquibase steps in a staging copy first, and keep the previous release's artifacts available for rollback.
- Monitoring: Ship dashboards, alert rules and exporters as internal artifacts, since hosted monitoring services will not be reachable.
Confirm with the platform owner the approved transfer process for images and packages, the offline vulnerability review cycle and who signs off each release before it enters the network.
What drives the cost of planning Close of Business batch jobs
This table lists the main drivers of planning and delivery effort for Close of Business batch jobs in Apache Fineract, with one way to keep each one down. Read it as a checklist for what a fixed-scope quote should price separately, and note which drivers are one-time work and which recur after go-live.
| Driver | How it raises effort | How to keep it down |
|---|---|---|
| Account and transaction volume | The nightly job can run for several hours on deployments with millions of accounts, so partitioning design, performance runs and tuning grow with volume. | Ask for a load profile based on your real account counts and a sized test run before choosing the worker count. |
| Number of tenants and their schedules | Each tenant may need its own run window, cut-off rules and reconciliation checks, multiplying test cases and operator runbooks. | Agree on a shared run window and a common job definition across tenants where regulation and products allow it. |
| Broker choice and existing estate | Building on ActiveMQ or Kafka without an existing team, monitoring or broker operations adds setup, hardening and training work. | Reuse the broker your organization already operates and confirm its support model and access controls up front. |
| Environments and performance test runs | Each environment needs its own data, worker topology and timed batch runs, and tuning usually takes several iterations. | Limit environments to those needed for testing and reuse a representative data set across them. |
| Custom batch or reporting jobs | Each added job extends the nightly window, changes ordering and failure handling, and needs regression testing against core accounting. | Keep custom jobs out of the Close of Business run where possible, or schedule them after it completes. |
| Compliance evidence requirements | Auditors and internal control teams may ask for run logs, reconciliation records, failure procedures and access evidence for each batch run. | Agree the evidence list before design so logging, retention and reports are built once, not retrofitted. |
| One-time versus recurring work | One-time work covers design, partition setup, performance testing and runbooks. Recurring work covers monitoring, broker and worker maintenance, and retesting after each quarterly Fineract release. | Ask the quote to split one-time and recurring items so the ongoing support cost is visible before signing. |
How to prove a Fineract Close of Business run is correct and restartable
The first proof is a rehearsal on a production-sized copy, not a test database with a few hundred accounts. The Close of Business Day Spring Batch job can run for several hours on deployments with millions of accounts, and its runtime, partitioning and locking only show up at that volume. Run the job on a restored copy of production data with the same worker count, the same batch instance configuration and the same broker or Kafka setup you plan to use live. Record the start time, end time and per-partition durations, then compare them with the window you have for end-of-day processing. If the rehearsal does not finish inside that window with margin, the design is not ready, whatever the functional tests say.
Correctness is shown by reconciliation, not by the job reporting success. Before the run, take account balances, loan principal and interest outstanding, savings balances and general ledger totals from the source copy, and have finance supply independent figures for the same date, such as the figures from the prior day's approved reports and the expected accruals and postings calculated outside Fineract. After the run, compare the totals by product and by ledger account, and investigate every difference before sign-off. Keep the pre-run and post-run extracts, the reconciliation workbook with the named approvers, the job execution records from the database, the job and worker logs, and the exact software release and configuration used. Agree with finance in writing what counts as an acceptable variance and who may accept one.
Restartability needs two deliberate tests. First, stop a worker node mid-partition during the rehearsal, then confirm the job resumes or is re-run and that no account receives a second interest posting, fee or accrual. Compare the affected accounts' transaction history against the expected result, not only the totals. Second, break the broker connection during a run and confirm that the failure is detected, the job is marked as failed or stalled rather than silently completing, and an alert reaches the on-call team. Restart behavior depends on the Fineract release, the Spring Batch version and your database, so confirm with the project's platform documentation and by testing on your exact release before you rely on it. Record the results of both tests as evidence for the operations runbook.
What to monitor, back up, upgrade and document after go-live
Once Close of Business runs in production, the batch window becomes an operational risk in its own right. The cards below cover what operators watch during and after each run, how backups and reruns fit around it, and how quarterly upgrades can change batch behavior.
Job duration and window tracking
Record the start time, end time and total duration of every Close of Business run, and compare each night against the window your institution has agreed for end-of-day processing. The trend matters more than any single run: a job that gets slower each week usually signals growing account volume or a query that no longer scales. Flag runs that overrun into business hours and keep the history so capacity reviews have real data.
- Typical run on large deployments
- Several hours
Partition failures and retries
With remote partitioning, one failed worker can leave part of the account population unprocessed while the rest of the job reports progress. Track each partition separately, record which worker ran it, and confirm that retries are idempotent before you allow them to run automatically. Ask your DeployOpen or internal team to document which failures are safe to retry and which require a stop and review.
Broker health and lag
The broker carries the messages that coordinate partitions across worker nodes, so a slow or full ActiveMQ or Kafka cluster slows the whole batch even when every worker is healthy. Watch queue depth or consumer lag, connection counts and disk usage during the batch window. Confirm the retention settings on the broker so that unconsumed messages from a failed night are not lost before the rerun.
Database load during the batch window
Close of Business is a write-heavy job that runs against the primary database, so its load competes with the read instances that serve customers. Watch connection pool use, lock waits and replica lag on the PostgreSQL primary and replicas during the window. If the batch consistently squeezes read traffic, adjust the schedule or instance sizing before the account base grows further.
Backups timed around the batch
Schedule the database backup so it does not start while Close of Business is writing, or confirm that your backup tool produces a consistent snapshot during the run. Test a restore after each change to the backup schedule, not only during an incident. Record which backup corresponds to the start of the business day, since that is the point you would restore to if a batch run corrupts balances.
Runbook for reruns after failure
Write a runbook that states who decides to rerun, how to confirm the failed state, what must be checked before restarting, and how to verify balances and ledger totals after completion. Include the expected behavior for a partial run and the rule for whether a business day can be reopened. Rehearse the runbook in a non-production environment with a copy of production-sized data before you need it at night.
Upgrade planning and batch regression
Fineract releases are created quarterly, so plan a regression run of Close of Business against each new release in a staging environment that matches production scale. Liquibase migrations run only on write instances, so confirm the migration order before you point batch instances at the new version. Compare interest, fee and accrual results against the previous release with the same test data before approving the upgrade.
- Official release cadence
- Quarterly
What buyers ask about Apache Fineract Close of Business batch jobs
How much effort does designing the Close of Business batch setup take?
The effort depends mainly on how many accounts the institution will hold, how many products run nightly, and how many worker nodes the design needs. A single-node setup for a small book is a much smaller task than a partitioned design for millions of accounts. The README notes that the Close of Business Day job can run for several hours on deployments with millions of accounts, so the design work centers on measuring that runtime in your own environment, sizing the batch instance, and deciding whether remote partitioning is needed. Ask any partner to break effort into load testing, partition design, worker sizing, monitoring setup and runbook writing, and to show which of those depend on your volume figures.
How long does the planning phase for batch jobs take?
The planning phase depends on scope and volume, and a written scope sets the actual duration. The inputs that move it most are the size of the account book, the number of products that accrue or post interest and fees each night, the target batch window your operations team accepts, and whether your infrastructure team already runs a message broker. Planning usually starts with a volume and timing baseline from a representative data set, then moves to design decisions. Ask for a timeline tied to named milestones in the written scope rather than a generic estimate.
Can our own team run the nightly batch without outside help?
Yes, many teams run Fineract's batch jobs in-house, but the work requires PostgreSQL administration, Spring Boot operations, and familiarity with the Close of Business job and its failure modes. The Fineract README warns that a production deployment can be complex, costly and time-consuming and that the project does not provide a comprehensive production deployment guide, so you should check whether your staff can own the runbook, restart procedures and capacity reviews. Outside help is most useful for the initial partition design, load testing and monitoring setup. Confirm the skills you have before deciding which parts to buy.
Is Kafka or ActiveMQ the better choice for remote partitioning?
Neither broker is better in general. The Fineract README states that remote partitioning is coordinated through ActiveMQ or Kafka, so the choice should follow what your organization already operates and supports. Consider the broker's operational maturity in your environment, your team's experience with monitoring and failover, your existing event platform (Fineract can also publish business events to either), and the retention and replay needs of other consumers. Mixing brokers adds operational load, so pick one unless a specific requirement forces a second. Confirm the exact configuration keys and versions with the Fineract documentation for the release you deploy.
What does the batch design need from our infrastructure and staff?
The design needs several items from your side before work starts:
- A non-production environment with a representative account volume and PostgreSQL, since the README recommends PostgreSQL and deprecates MariaDB and MySQL under FSIP-9.
- Separate batch, write and read instances, which the documentation describes through environment variables.
- Worker nodes and a message broker (ActiveMQ or Kafka) that your platform team can provision, monitor and patch.
- Named staff for accounting sign-off, operations for batch windows, and security for credentials and TLS settings.
Ask the partner to list each item with its owner.
How do Fineract upgrades affect the nightly batch run?
Upgrades can change the batch job's schema, behavior and runtime, so each release needs regression testing of the Close of Business run before it reaches production. Fineract publishes official releases quarterly, and the documentation states that Liquibase migrations run only on write instances, with a liquibase-only Spring profile available on Kubernetes. Plan the upgrade so the batch instance and the write instance move in a controlled sequence, and rehearse a full nightly cycle on a copy of production data. Your upgrade process should also cover rollback and a check that accounting totals match after the first run on the new release.
What should a fixed-scope quote for batch job work include?
A fixed-scope quote should name each deliverable and the environment it applies to. Ask that it covers the volume and runtime baseline, the list of nightly steps and products in scope, the partition design and worker sizing, the chosen broker and its configuration, monitoring and alert thresholds, a restart and failure runbook, load test results and a rehearsal of the full nightly cycle. It should also state which parts are one-time (design, load testing, initial setup) and which recur (upgrade testing, capacity reviews, support). Any figure should trace to a written assumption about account volume and infrastructure, so you can check it when your data changes.
How DeployOpen scopes, builds, hands over and supports Close of Business batch work
DeployOpen approaches Apache Fineract Close of Business batch jobs as a bounded piece of platform work: the nightly job is mapped to your accounts and products, the batch instance and any remote partitioning are built inside your own infrastructure, and the result is documented so your team can run it. Engagements are fixed-scope, with the scope agreed in writing before work starts.
How we scope
- Inventory the products, account volumes and posting steps that the Close of Business job touches in your deployment.
- Agree in writing whether the work covers batch instance sizing, remote partitioning, monitoring or all three.
- Confirm the infrastructure, broker choice (ActiveMQ or Kafka) and environments the job will run in before quoting.
How we build
- Configure the batch instance and run the job against representative data volumes in a non-production environment first.
- Test partitioned runs across worker nodes, including what happens when a worker fails partway through the job.
- Set up monitoring for job duration, failed steps and broker lag, with alert thresholds agreed with your operations team.
How we hand over
- Deliver a runbook covering the nightly sequence, restart procedure, partition configuration and escalation contacts.
- Walk your operations and platform engineers through a scheduled run and a deliberate failure recovery.
- Record configuration, environment variables and known limits so your team can reproduce the setup.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer, with coverage defined in the written agreement.
- Retest batch behavior after each Fineract upgrade, since quarterly releases can change job configuration and schema.
- Review job duration trends with your team so capacity changes are planned before the batch window is at risk.

