This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Zero to AI - A non-technical, hype-free guide to prospering in the AI era and have Nicolò Valigi and Gianluca Mauro on-line!
See this thread for details.
Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Should I use EJB?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi-
I was wondering if anyone could offer some architectural advice. I need to create a service that does the following:

1.take a plain text file provided by a client
2.run some non-java executables on that file
3.return the binary output file to the client (could be anywhere from 2-60 meg)

Would it be appropriate to use a stateless session bean for this purpose? Is it not wise to transfer large, serialized binary files over the RMI protocol used in EJB?

Thanks
 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The questions you need to ask yourself is do you need transactional support, easy access to the persistance api, inter-ejb communications, etc

These are services the EJB container gives you at a complexity and performance overhead, so if you're not using those services, a Session bean probably isn't a good choice.

If you do choose to use a session bean that transfer the data in a Data Transfer Object (Value Object) to avoid unnecessary RMI overhead - or use local interfaces.
 
Dudley Dawson
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really need transaction management or persistence (I thought that they were only applicable to entity beans anyway)
What i really need is loose coupling and remote access to this service. And it would also have to scale in a way that is transparent to the remote clients.

If you do choose to use a session bean that transfer the data in a Data Transfer Object (Value Object) to avoid unnecessary RMI overhead - or use local interfaces.



Can you elaborate on this? The DTO would still have to be passed back through the call to the EJB, which uses RMI, correct?
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, sorry I was talking about EJB 3.0

In EJB 2.x transaction management can be done with entity beans and sessions for different reasons, but since you're not using persistance I won't go into detail (though session bean transaction management is not limited to entity beans).

You make a remote call to an EJB over RMI and yes what ever you send back gets serialised in the call-back - but a DTO holds a copy of all the data, so subsequent calls to get individual properties just access the DTO in memory on the client rather than being RMI calls, for example:

User user = myBean.registerUser(email);

user.getEmail()
user.getPassword()

Any method calls on the user object have no remote overhead, the data (the serialised user object) is already with the client at that point.

I don't think performance would vary greatly puting 60Mb of data into a DTO and sending via an EJB callback or some other remote object serialisation method.

There are several other ways you could get the data back to the client without serialisation - an IO stream perhaps?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Daniel that 60G of data will not affect the performance if we implement this service as Session bean. But pure RMI implementation if designed well will be better option.

Explore this article "http://martin.nobilitas.com/java/thruput.html"
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by service ?
do you need to implement this functionality or it is decided that you implement it inside a container (application server or servlet container)?

I should say that It is not a case for EJB or RMI it is better that you do not envolve with them.

what i suggest is a simple network server that listen on specific tcp port for your clients request.
you can transform your text/binary file easily and there is no burdon of RMI or application server around.
 
This guy is skipping without a rope. At least, that's what this tiny ad said:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic