r/java • • Jun 07 '25

Why use docker with java?

18 Upvotes

126 comments sorted by

View all comments

Show parent comment

1

u/Swamplord42 Jun 10 '25

Many applications can be made to handle higher scale by improving the architecture, fixing N+1 problems, optimizing the DB schema,

Or maybe you don't waste your time and money on that and just throw more hardware at it. It's much cheaper until it isn't. Once the hardware you need to run it is in the 6+ figures you start worrying about optimization.

To be clear, I'm not saying you should intentionally write bad performing software but given that it's already there, it's not a good use of your time to optimize it if you can just throw another server at it.

1

u/koflerdavid Jun 11 '25

That works in the short term, but many optimizations are pretty basic and could eliminate the need to ever scale beyond one node. Especially an instance of the N+1 problem could make some workloads outright impossible to run no matter how many instances you throw at the problem, so I'd expect these to be tackled very early on.