Hacker News new | ask | show | jobs
by smallerfish 1733 days ago
> to optimize Java microservices for cloud architecture

I'm kind of curious about this. What kind of lifetimes are you looking at for JVMs? Are you trying to use Java in lambdas on demand to user requests? What kind of warmup time are you seeing right now?

2 comments

I'm personally interested in reducing RAM consumption. Right now Spring Boot application with very little functionality (like few REST endpoints, talking to database) easily eats few hundreds of megabytes RAM. Similar node.js application eats few dozens of megabytes RAM. Cost of using Java is high, when there are plenty of those services, especially when we're talking about resilient services and launching 2-3 instances of every service.

Fast startup time is just a good bonus.

That's for my use-case. Lambdas, obviously, demand fast start-up.

To be fair, that's spring boot. It's a bloated ecosystem. If you write using lean libraries (which you'd want to do for lambda anyway) then you're looking at 0.1-0.3s jvm startup times. If that's supposed to be serving a user then it may be taking too long, but in that case use an EC2 instance rather than trying to be serverless.
what woud be a lean alternative for microservices to spring boot?
The most lean and interesting alternative IMO is Helidon SE. It's backed by Oracle and uses very sane approach.

The most pragmatic alternative IMO is Quarkus. I don't really like it, but it seems to be the most popular alternative to Spring and probably will become standard de facto, unless Spring will jump ahead with some revolutionary changes. It's backed by Red Hat and seems to have the most momentum.

The best approach IMO is not here yet. Frameworks, mentioned above, rely heavily on reactive architecture. It's just not needed with Project Loom, so there's plenty of unnecessary complications. They even rewriting JDBC drivers.

I'm going with Quarkus for now, but I'm waiting for ideal framework to appear.

What's your opinion on vert.x vs quarkus? For more general purpose web stuff, it seemed to me vert.x had more libraries.

Also, as for database, I really got fed up with hibernate (all configuration and stuff), do you know any simpler asynchronous / reactive alternative that handles object mapping? (automatically serializing from / into SQL objects).

Quarkus uses vert.x for web. What it does is provides a standard way with instructions to build a native image (along with some added functionality). I don't know if it's easy to build a native image from just vert.x app.

About database, sorry, I have no idea. Check out JDBI, JOOQ, those are most popular ones, AFAIK.

Also Quarkus adds reactive API to hibernate and some API to simplify some mundane Hibernate API, so maybe you'll like it.

Micronaut is worth a look
Lambdas, commandline applications, everything which needs startup times in the range of a few milliseconds.