Search code examples
javaspring-bootjms

Should I install JMS broker on a separate machine?


I am using Spring Boot mail and a JMS broker to build an email system. I followed this example project. Because our application QPS is small one server is enough to handle the requests. In the example project the broker, sender, and receiver are all on the same server. Is this a good practice for small application? Or I should put the broker, sender, and receiver on three separate machines?


Solution

  • It's depends...

    The size of the application is irrelevant. It depends more on your requirements for availability, scalability and data safety.

    If you have everything on the same machine you have a single point of risk. If the machine crash you lost everything on that machine. But this setup is the most simple one (also for maintenance) and the change that the server will crash is low. Modern machines are able to handle a big load.

    If you have a really high load and/or a requirement for guaranteed delivery you should use multiple systems with producers that sends messages to an ActiveMQ cluster (also distributed over multiple machines). The consumers, also on more than one machine. Use also load balancers to connect/interface to the machines.

    You can also have a setup in the middle of both example setups (simple and complex).

    If you are able to reproduce all the messages (email messages in your example), and the load is not so high, I will advise you to put it simple all on the same machine.