Spring Remoting Services (via HTTPInvoker) is more lightweight than EJB 3.1 Stateless? - performance

I have two java web-app in the same application server (JBoss 7). And one web-app makes some remote calls to the other one.
Today I'm using Stateless EJB 3.1 to expose the services. Do you think that exposing the services with Spring Remoting (via httpinvoke or hessian) performs better?

Assuming that you currently expose the EJB via #WebService, there is a good chance that Hessian would be faster since it is a binary protocol.
The standard webservice serializer (JAXB) is fairly wasteful.

Here you can see a benchmark of remoting technologies:
http://daniel.gredler.net/2008/01/07/java-remoting-protocol-benchmarks/

Related

Running Camunda BPMN Spring boot using Netty instead of Tomcat

I am using Camunda Spring boot starter library for running my Camunda BPMN engine and also done some custom Java implementation. I am planning to run the project using Netty instead of Tomcat servlet. Please help me for running the Java spring boot application with Netty (Reactive way). Thanks in advance for your help.
You did not elaborate why you want to do this. Speculating about your requirements, I would recommend to look into Camunda Cloud (possibly self-managed https://docs.camunda.io/docs/self-managed/overview/). It uses a different process engine (and Netty) under the hood, which has a complete different modern architecture (no relational DB, CQRS style) and is designed as a cloud native distributed system for highest volumes.

Spring Cloud Netflix - how to access Eureka/Ribbon from traditional web app?

Everything I found on the internet about Spring Cloud Netflix is about running microservices from Boot applications using #EnableEurekaClients and so on.
Now I'm trying to connect my logging microservice within a traditional war application (springmvc, jaxws etc) - piece of legacy which can not be converted to Boot or modified in any way (by technical task).
I've created a new maven module "log-server-client" that knows nothing about upper web layer and intended to be used as a simple dependency in any maven project.
How should I configure access to Spring Cloud Netflix for this simple dependency? At least, how to configure Eureka and Ribbon?
I just extracted some lines of code from RestTemplate and created my custom JmsTemplate (microservice works with jms remoting with apache camel and activemq), exactly how it is done in RestTemplate, but this code stil lacks connection to infrastructure
afaik, we can create a global singleton bean, run a separate thread from this bean, and run Boot app from this thread, but don't you think that it is very ugly and can lead to problems? How it really should be used?
Great question!
One approach is to use a "sidecar". This seems to be a companion Spring Boot application that registers with the Eureka Server on behalf of your traditional web app.
See e.g.:
http://www.java-allandsundry.com/2015/09/spring-cloud-sidecar.html
http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html#_polyglot_support_with_sidecar
Another approach is to use the following library:
"A small lib to allow registration of legacy applications in Eureka service discovery."
https://github.com/sawano/eureka-legacy-registrar
This library can be used outside of Spring Boot.

Spring Remote, configure httpinvoker and JAX on the same server

I have a server running on tomcat exposing Spring services using HttpInvoker.
I have exposed the methods of 5 services using HTTPInvoker.
This works very well.
The spring configuration is described in a file named remoting-servlet.xml; and the remoting servlet (DispatcherServlet) is described in the web.xml.
I now have an additional need to expose one additional service using JAX-WS this time (I will have C# clients).
I will use Spring support to JAX-WS.
I have the option to use the default deployment, or to use JAX-WS RI's to deploy this additional service to the same server as the remoting servlet.
I would prefer this last solution, because I would have only one server providing the remote services (whether they are web services or httpinvokers).
My question is: is this possible?
I think that I can I put the 2 servlets on the same port. But my issue is that it seems to me that I will have to provide 2 different application contexts. One for the DispatcherServlet, and one for the WSSpringServlet.
Is that correct?
Is it possible to put the WSSpringServlet context definition to the same file as the one for the httpinvokers (remoting-servlet.xml)?
Many thanks
Gilles

Spring and EJB integration

In my project we are using JSF and Spring WS (web tier), EJB 3.0 (service layer) and JPA (integration layer). We have exposed EJB in Spring container.
All technologies are used with Spring. So, Spring is a used to bind all layers together. Hence, Spring is common for all layers of architecture.
I read that, many features provided by EJB is also available in Spring. Can't we replace EJB with Spring? Why, EJB and Spring both are used together.
I want to understand, what are benefits of using such architecture.
Spring is an alternative for EJB. Usually EJB and Spring are not used together unless it is a legacy application which is already developed based on EJB and Spring is wired later to support dependency injection and other framework benefits.
EJB is a heavy weight container which requires App containers like JBoss, WebSphere, or Weblogic.
Spring is a very light weight container which can be used in in web containers like Tomcat and even in Standalone applications. Also it provides support for many modules from front-end to back-end.
If there is a chance, you should consider replacing EJB with Spring bean in service layer.
Does it means that Spring provides all features which are available from EJB 3.0. Clustering and all other features of EJB can also be acheived from Spring.

With Spring do you still need a java application server and when?

looks to me you need tomcat or some other servlet engine for the web part.
what about data access part using hibernate and jms? Thanks.
No, you don't need an application server, you can see Spring as a proprietary, modular application server implementation / adapter. But you still need an a servlet container.
Data access part: you can use hibernate and some standalone connection pool
jms: Spring is not a JMS provider, but it nicely integrates POJOs with any JMS provider
Spring also has comprehensive transactions support
Finally you have jmx and aop support built-in and easy integration with bean validation, jpa, web services, rmi, jci, task scheduling, caching...
As you can see you can either use certified application server and Java EE stack or built on top of Tomcat and pick Spring modules you need. Sometimes Spring uses standard Java EE APIs (like JPA), more often it builts its own.

Resources