Hi All,
I have some doubts using
EJB in the FlyByNight project.
What is the rationale of using EJB here.
An architecture without EJB can be more performant and scalable.
Collacated architectures (web container based- single JVM) can be scaled well and more performant than EJB centric approach.
EJB here can only be good for its declarative transaction management and its capability of transparently handling transactions accros transaction resources behind the scenes.
Making FlyByNight project as a distributed application can be an overkill and over engineering.
Distributed applications can be better scaled when the session state is stoed in the web tier not in the EJB tier. Sun recommends us storing session state in the EJB tier. That makes the scability harder to handle. Cause EJB containers has more overhead then web containers when it comes to state replication.
The only thing I see here to use EJBs in this project is because SUN wants it being used, transaction handling can be done automatically by the EJB container and You do not need to write SQL for CMP beans.
By the way, Swing clients can be handled through a
servlet. That way we do not need to open our business objects to outher world through a session bean. Getting browser and swing requests thru the web tier is a better approach and one do not get into firewall issues at all. (calling session bean from a swing client directly will get into firewall issues)
Are these reasons enough for EJB being used even when the perfomance and scability issues suffers...
One last thing, Session beans should be used just to wrap the business logic in POJO's. and Entity beans should be used only to access data sources. Putting business logic into EJB would not make that design maintainable. Say you want to remove EJB's for some reason in the future.If you kept your business logic in POJO's you can do that. But If you used EJB for business logic, you need to rewrite the whole thing in POJOS..
EJB does not make sense to me unless It is used in environment where scability is needed at highest levels, components are scattered around the world and a distributed architecture is needed and the state session is stored in web tier not in EJB tier...
Thanks
Cengiz