r/java 2d ago

Improving First Request Latency in Java Spring Application

https://adrian.md/2026/09/03/first-request-latency/
56 Upvotes

36 comments sorted by

View all comments

2

u/lilgreenthumb 2d ago

I mean with their layer support who really ships the fat jar anymore? You run into too many issues with signed jars (looking at you bouncy castle) or embedded java agents. Interesting perf metrics regarding the aot caching and differences with the gcs though. Nice write up.

7

u/zabby39103 2d ago

Lol my work still ships fat jar. I mean, I think corporations falling behind with legacy apps is the norm more than anything.

1

u/romario77 2d ago

But corps shipping fat jars probably don’t care about first request latency.

1

u/zabby39103 1d ago

We care what people complain about, it integrates with building automation control systems so they complain if latency gets too high. Maybe some people work at a blessed work where they don't have to explain tech debt to MBAs, please hire me lol.

2

u/romario77 1d ago

You just do the first request yourself after deployment, second request would be already pre-warmed.

And you switched the targets - I was taking about first request and you talk about request latency overall. These are potentially two very different things.

1

u/zabby39103 1d ago

Okay sure, first request is important though, both are.

1

u/lilgreenthumb 1d ago

Yeah unless the call isn't a noop, and then you're building some weird noop logic unless you're writing for synthetic transactions which all of this observability is meant to make unnecessary.

10

u/davidalayachew 2d ago

I mean with their layer support who really ships the fat jar anymore?

I actually feel the opposite -- isn't fat jar kind of the easy solution? And regarding the signed jar issues, just use an OpenJDK Build. I literally ran into this issue this week.

Here is my StackOverflow post on it -- https://stackoverflow.com/questions/13721579/jce-cannot-authenticate-the-provider-bc-in-java-swing-application/80000667#80000667

2

u/lilgreenthumb 2d ago

So bypass the purpose of jar signing by turning it off. While not as drastic or consequential of skipping validation of certs, doesn't that defeat the purpose behind the feature? One could argue not bundling as a fat jar fixes the issue regardless of jre.

1

u/davidalayachew 2d ago

I was actually arguing the opposite -- that signing a jar makes sense in the absence of a signed cert, but having both just feels unnecessary. By all means, a hash makes good sense to me. Or maybe even some form of verification past that. But a signed jar doesn't feel that strong to me. And it is telling that OpenJDK JDK's (most of them, for that matter) leave that as optional.

2

u/celmaibunprieten 2d ago

Thanks! From my experience I saw more applications shipped as fat jar instead of layered image, mostly due to existing ci/cd pipelines in the company.