0

I have a Java application which consists two kind of long running processes, let's say Server and Client, and usually the number of Clients is greater than 10.

Some of the application behavior are:

  • Server asks Client to perform some tasks by sending command to it
  • Server pulls the task status/result from Client
  • Client sends some heartbeat messages to Server
  • Server querys some process status from Client

Now I implement this just by transporting serialized object over TCP/IP socket. But I soon discovered that's too much details (e.g. reliability, workload monitoring) I have to deal with. So I'm looking for the various options to implement something like this. I'm currently considering message brokers like ActiveMQ, RabbitMQ or even ZeroMQ.

Any advice and suggestions will be greatly appreciated.

ps. Speed is not a concern for me

KF Lin
  • 1,273
  • 2
  • 15
  • 18
  • 1
    possible duplicate of [ActiveMQ or RabbitMQ or ZeroMQ or](http://stackoverflow.com/questions/731233/activemq-or-rabbitmq-or-zeromq-or) – user3145373 ツ Jun 10 '14 at 03:40
  • Those three are just options, still looking forward to some suitable (since my application logic is simple) approaches. – KF Lin Jun 10 '14 at 03:49
  • 1
    You'll find ZeroMQ to be most similar to the type of TCP/IP development you've been doing; it'll be a simple replacement, but it won't manage everything for you out of the box, you'll have to figure out how to use it to achieve the reliability you're looking for (and you have to do [a lot of reading](http://zguide.zeromq.org/page:all) to make that happen). The other tools are "heavier", and probably overkill for you, but they come out of the box as a message broker system and "do more" by default. We can't know what is appropriate for your application, so can't provide a real answer. – Jason Jun 10 '14 at 15:43
  • You can try the [WebSocket API](http://dev.w3.org/html5/websockets/). [Here](http://java-websocket.org/) and [here](http://jwebsocket.org/about-jws) you can find some java implementation – bardi Jun 11 '14 at 12:24

1 Answers1

1

Welcome, KF Lin

Try first to identify and sort your key design priorities in a Top/Down List and assign the correct priorities:

  1. Server-side scaleability of the solution aproach
  2. Client [worker]-side performance scaleability of the solution architecture
  3. Serialisation overheads
  4. Transport reliability
  5. Need for many trasport-classes { TCP | ipc | inproc } working at the same time
  6. Transport capacity / traffic-flow-management for respective transport-classes
  7. Transport-wide / transport-class load-balancing
  8. Deserialisation overheads
  9. Heterogenous implementation languages for various nodes / roles participating in solution
  10. Limited time-budget for analysis/design/testing
  11. Resilience to unstable problem definitions

You may have already found, that ZeroMQ is a broker-less solution. That is important for performance scale-ability and for designing a fail-safe architecture ( one may design so that a single element failure does not stop the properly designed architecture )

ZeroMQ has fabulous capabilities, once you can deploy the Scaleable Formal Communication Patterns for your problem you win a lot of power by re-use of the well-thought framework.

user3666197
  • 1
  • 6
  • 50
  • 92
  • Thanks for your advice! Also I've found an useful post talking about [RPC over AMQP](http://www.hydrogen18.com/blog/rpc-over-amqp.html), I'm trying to implement mechanism like that now. – KF Lin Jun 13 '14 at 07:42
  • 1
    Fathers of broker-based **AMQP** have years ago moved farther forward to create a faster & smarter **ZeroMQ** and later on to a spin-off **nanomsg** that is even more efficient. For professional grade Projects it is worth time to read a book on rather principles of the efficient & scaleable MQ from these smart guys >>> [Code Connected, Vol.1] available also in PDF from Pieter Hintjens. If you start with Fig.60 & Fig.62 before reading about details, you may IMHO build faster your full imagination of the power hidden inside real-world application MQ-layer design needs. Skip any code, get ideas. – user3666197 Jun 13 '14 at 09:51