• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

APIs in Spring

 
Author
Posts: 49
5
MySQL Database PHP Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What would be the alternatives to gRPC and GraphQL with REST in Spring Boot? And How is the choice governed in business situations?

Is Spring API code a good choice for SMBs? Considering that SMBs run on shared hosting, and mostly choose PHP?

Compared to the Enterprise culture that chooses Java, the smaller agencies go for an everything Javascript approach. Your comments?
 
Saloon Keeper
Posts: 28749
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It used to be that a lot of SMBs ran their least expensive services on relatively weak VMs with little RAM. No problem for LAMP servers, but Java is pretty hungry.

These days, however, even the bottom tier can generally run Java and some (such as Amazon) actually have special services for running stuff like Spring Boot or Tomcat instances.

Spring itself has many Modules, so you can use as many or as few of its API's as you need.

As for JavaScript, the more I work with it, the more infuriated I get. Bad enough when I was just struggling with getting it to determine the difference between a null string, a null object that was supposed to be a string an empty string, a blank string and so forth, but I've been using NodeJS to to my quick-and-dirty webapp servers and the infinitely-deep stacks of callbacks that come from not having a civilised threading architecture are really beginning to get on my nerves.

Any enterprise of any size, however, is likely have a mix of technologies, not only Java and JavaScript but Python, maybe some Ruby and .Net.
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:As for JavaScript, the more I work with it, the more infuriated I get. Bad enough when I was just struggling with getting it to determine the difference between a null string, a null object that was supposed to be a string an empty string, a blank string and so forth, but I've been using NodeJS to to my quick-and-dirty webapp servers and the infinitely-deep stacks of callbacks that come from not having a civilised threading architecture are really beginning to get on my nerves.


Callback hell is definitely something to stay away from as far as possible. There's a quite promising ( ) alternative, but of course the API needs to support it.

I recommend using TypeScript instead of JavaScript, as it makes it clearer (at least to me) what everything is. I especially had problems knowing what "this" is at any point of time, but TypeScript will just tell you.
 
Tim Holloway
Saloon Keeper
Posts: 28749
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where I really got my wrath aroused was the Node sqlit3 package. It's ALL done in asynchronous callbacks even though the actual low-level functions are synchronous and blocking (just like in JDBC).

There's an alternative "better-sqlite3" which deals with sqlite synchronously, but it requires installation of a raft of C++ build tools and it won't build clean on CentOS 7. So that blew away the "better" part for me.
 
Author
Posts: 16
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java 17 is optimized for performance. App running on Java 17 JVM can be light-weighted (if you package your artifacts intelligently). Spring boot can run on embedded web servers such as Tomcat/Jetty. Therefore, you don't need to install the webserver separately. Running your backend is straightforward such as `java -jar <path>/<app>.java`

Choice of technology should be considered based on functionalities and load rather than based on the organization size. If you think you might need to scale in the future then JVM based solution is the preferred choice.

gRPC should be preferred if you have more than 1 service deployed in the backend and these services communicate with each other.

GraphQL should be preferred over REST if you have a plan to serve handheld devices to optimize the number of calls.

You can use one of the samples from https://github.com/PacktPublishing/Modern-API-Development-with-Spring-and-Spring-Boot in your VM box to check the performance.
reply
    Bookmark Topic Watch Topic
  • New Topic