Reputation: 381
I am trying to find a way to run async tasks in cloud for java application.
For example, we are running our application in GCP and there is a way to run Deferred Tasks through Task Queues. But there is a problem with serialization of tasks. I am not always able to make entire hierarchy serializable.
Also there is a possibility to use ExecutorService, but there is a downside to that: it cannot run background threads for instances with auto scaling.
Main purpose of my task is to separate request thread from long running tasks. Also it would be good to run those tasks on separate machines. I guess there should be some way to achieve my goal, but I am not able to see it yet.
Upvotes: 1
Views: 350
Reputation: 75940
When you have Java object that you want to defer, there is no secret, you have to serialize them. This can take several form
In all these possibilities, you have to serialize the data (in binary, in JSON, in text,...)
Anyway, for "long running job", all depend of the "long" and the resources required. Today, Cloud Run is a great candidate for this with 15 minutes of timeout (soon 4x more) and 2vCPU/2Gb of memory (soon more). If that fit your requirement, I strongly encourage you to have a look on it.
Upvotes: 2