Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to distribute Java long running process to remote servers

My php web server receive requests and needs to launch a java program that runs between 30 sec and 5 minutes or even more. That long process needs to be distributed on the available servers in my LAN.

What i need:

  • a job queue ( that's done in a db)

  • A DB watch. Get notified of new or completed job (to start another job in the queue)

  • Start a java process on a remote and available computer.

It seems that it needs to be a DB watch since I need to evaluate which remote computer is available and a DB stored procedure wouldn't accomplish that easily.

What is the best or at least a good way to achieve this in a OS independant way using JAVA.

I guess I could use a FileWatch and manage the queue in a folder but it seems prehistoric.

Thanks

like image 556
Bastan Avatar asked Feb 23 '26 00:02

Bastan


1 Answers

I would use a JMS queue. You add tasks/messages to a queue and the next available process takes a task, performs it and sends back any result on another queue or topic. This supports transparent load balancing and you can restart tasks if a process fails. No polling is required.

like image 139
Peter Lawrey Avatar answered Feb 24 '26 14:02

Peter Lawrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!