5 ms·
How are Java programmers implementing RESTFUL APIs these days?
by 0db532a0 7y ago
How are Java programmers implementing RESTFUL APIs these days?
- atoko 7y agoSpring Boot with Webflux and any rx supporting libraries you can get your hands on
- 0db532a0 7y agoThanks.
- lenkite 7y agoMany developers don't want to think too much and generally choose Spring boot for a stable, highly-popular and well-documented framework. There is nothing wrong with this choice but I find it too bloated for lean container based micro-services. Dropwizard and Micronaut are pretty good for getting a smaller and saner footprint. If you need more than REST, say you want a lean MVC-based web-framework, then Blade is also a good choice. You can also choose not to use a framework and say use code-generation from a swagger/openAPI REST document and implement the remaining bits on your own. If your deployment target is AWS, you can also choose to leverage Netflix's fantastic set of libraries. Java has tonnes of options, so you usually need to spend some time evaluating what goes into your stack.
- jjjensen90 7y agoI'm curious to hear what specifically is too bloated in Spring Boot in your opinion for container based microservices. I've been writing microservices that run in docker in Java for a few years, then moved to Kotlin recently, all using Spring Boot, and I haven't run into anything that made me feel like they were bloated. I've also written Go and Node microservices for contrast.
- lenkite 7y agoSpring boot has a large startup time, heavy dependency trail and a lot of dynamic class-loading based off auto-configuration. This makes it un-suitable for some areas: if you desire fast scaling micro-services that respond quickly to incoming load. Or say you want to transform your micro-service to a server-less function. One can do that with Graal VM to compile your micro-service to a single binary with microscopic start-up time. However, native-image tends to fail more often than not with Spring boot apps. (I haven't tried this recently though so my knowledge could be out of date).
- jacques_chester 7y agoSpring Boot does what it's asked to do, which is to load everything it finds. The dynamic class work has basically nil effect on load time. The core performance constraint is that classes are loaded essentially linearly. If you ship with something enormous like Hibernate, that's thousands of files read individually from a zipfile. Spring folks are actively involved with Graal. I see a lot of excitement internally at Pivotal. Watch this space.
- erik_seaberg 7y agoI'm reminded of the crazy stunts from the 1980s where people would start some big, slow program (Emacs was huge!), dump core, and then "undump" to make a pre-initialized binary that would start as fast as the OS could read it. It actually worked, as long as it wasn't relying on open file descriptors, or signal handlers, or env vars, or …
- alexhutcheson 7y agoI’m pretty sure Emacs still does this. There was a patch committed to change it to use a more portable method of dumping state, but I don’t think that change made it into the 26.2 release.
- BoyRobot777 7y agoYou should checkout new RedHat framework - [Quarkus](https://quarkus.io/ https://quarkus.io/). This is a framework which leverages Graal to create native images. Those images are very small and optimized. For example one of Quarkus developers showcase the size of native image, spoilers - it's [19MB](https://youtu.be/BcPLbhC9KAA?t=103 https://youtu.be/BcPLbhC9KAA?t=103). It takes 0,004s to start. In [this](https://youtu.be/7G_r1iyrn2c?t=3104 https://youtu.be/7G_r1iyrn2c?t=3104) session, RedHat developer shows how Quarkus application is being scaled. Comparing to Node, it's both faster to respond to first request and have smaller memory footprint (half the size of node).
- matwood 7y agoSpring boot + jOOQ for RDMS support.
- CountHackulus 7y agoI can't speak for others, but I work in games and we've spun up a bunch of servers and we use Netty/Jersey for REST and sockets. It's been incredibly stable and a joy to program for compared to our previous Node servers. Granted we were using bleeding-edge Node 5 years ago which is not the Node of today.
- gerbilly 7y agohttps://www.dropwizard.io/ https://www.dropwizard.io/ Quoting from the site: Dropwizard is a Java framework for developing ops-friendly, high-performance, RESTful web services. It's a nice microframework which comes with built in health-checks, and metrics and it's also ops friendly because it deploys as a single JAR file.
- guggle 7y agoNot really related to Dropwizard but... this: > mvn archetype:generate -DarchetypeGroupId=io.dropwizard.archetypes -DarchetypeArtifactId=java-simple -DarchetypeVersion=[REPLACE WITH A VALID DROPWIZARD VERSION] Why is it that everytime I read something about Java I have a feeling it was not meant for humans ? Not as bad as C++ projects setup though, I'll give it that.
- meddlepal 7y agoI use javalin.io which was written by one if the maintainers of sparkjava (not to be confused with Apache Spark). I'm a big fan.