Avoiding a network call when the client and REST server are on the same server

I have a web application in which the two main components are a website (implemented in Groovy and Grails) and a RESTful web service for the backend (implemented using JAX-RS (Jersey) and Spring). Both will work at Glassfish. The website will call the RESTful web service. In many cases, these components will be hosted on separate servers, so the website will call RESTful over the network. If, however, I run both applications on the same Glassfish server, are there any optimizations that can be made to avoid a network call? In other words, I'm looking for some equivalent remote / local EJB interfaces for REST. Thank!

+5
source share
3 answers

Do not sweat the network call. Usually your traffic never leaves the local interface, so you will not consume any bandwidth. You lose a little performance from serialization / deserialization, but you need to ask yourself whether to reduce the impact of this, it is worth developing a complex proxy architecture. I think in most cases you will find the answer negative.

+8
source

, - : , , -, . I/O (localhost 127.0.0.1) , .

Spring ( http://static.springsource.org/spring/docs/2.0.x/reference/remoting.html), : , " " - . , HTTP, , , , , .

, , , , Spring Glassfish : , , stick HTTP-.

+1

, , JVM. API- HTTP- /. , - http://www.theotherian.com/2013/08/jersey-2.0-server-side-client-in-memory-connector.html

IMHO, unnecessary network overhead should be avoided at all costs. Despite the fact that these overheads will be only a few milliseconds, but when creating functions for your web application, you would increase such a service call, and all these milliseconds will add a sufficient number of delays in your application.

0
source

All Articles