title: How do I scale a Java app with a REST API and a Database?
body: <p>I have a typical stateless Java application which provides a REST API and performs updates (CRUD) in a Postgresql Database.</p>
  
  <p>However the number of clients is growing and I feel the need to</p>
  
  <ul>
  <li>Increase redundancy, so that if one fails another takes place</li>
  <li>For this I will probably need a load balancer?</li>
  <li>Increase response speed by not flooding the network and the CPU of just one server (however how will the load balancer not get flooded?)</li>
  <li>Maybe I will need to distribute the Database?</li>
  <li>I want to be able to update my app seamlessly (I have seen a thingy called kubernetes doing this): Kill each redundant node one by one and immediately replace it with an updated version</li>
  <li>My app also stores some image files, which grow fast in disk size, I need to be able to distribute them</li>
  <li>All of this must be backup-able</li>
  </ul>
  
  <p>This is the diagram of what I have now (both Java app and DB are on the same server):</p>
  
  <p><a href="https://i.stack.imgur.com/D1AFj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/D1AFj.png" alt="enter image description here"></a></p>
  
  <p>What is the best/correct way of scaling this?</p>
  
  <p>Thanks!</p>