We have a Java Play Framework Application which we want to scale out into a cluster. The only issue is that there are services ran by the Akka Scheduler once per day, and we don't want these services triggered by all the instances. Here are some of the options we have thought of:
- Extracting the scheduler operations as a separate service: But these operations require certain utilities and services from the main application which will be needed to be replicated in the new service. Not sure if this repetition is the best way to go.
- Expose the scheduler operations as an API and hit it from a separate application/service once every day.
- Remote Method Invocation of the scheduler operations from another service.
- Using the Akka Cluster services to scale and coordinate the scheduler operations.
- Using Zookeeper like services to run the application: However, as the application is not distributed per se, maintaining a zookeeper configuration for just the scheduler operations seem a lot of effort.
Moving forward, we want the best way to make fewer code changes and maintain the application. This may include changing the time of the day these services are running via an environment variable or conf file or something else in the easiest fashion without touching the code. Considering these needs, what would be the best way to scale out the application?