We have a product in which the UI is packaged as a separate WAR and server is packaged as a separate WAR file. Right now both these WARs are deployed in the same app container. Below are the pros and cons of this approach that i have found:
Pros of having different wars:
1. I feel having two different WARs allows me the flexibility of refactoring either UI or server side code without affecting the other.
2. To maximize memory usage, i can deploy it in two different containers. so if earlier i was using 2 GB for the entire jboss (say i am using jboss), now i can potentially use 4 gb if deployed in two
different jboss app servers (ofcourse different port no.)
3. I can scale my application. If tomorrow, i see that server is my bottleneck, then i could create a server farm,(for my server module only), since the server itself is a different WAR, without bothering about UI WAR.
4. Loosely coupled and gives me various integrations points
Cons:
1. For UI, i use primefaces. i do not see a use case where i could see an integration framework like seam adding value. Can someone tell me if having an integration framework would make sense
for my UI war? Basically, the whole fun of seam, is the wonderful integration that its provides with UI, EJB among other stuff. Therefore, i do not see too much value here because my form would ask the rest API to do all the processing.
Can someone tell me if having multiple wars actually help in scalability and maintenance. e.g.,one benefit that i see is that if i have two wars and i need to upgrade server platform, i do not need to bring down my UI. Any other benefit apart from what i have listed above?
Also, i want to understand if everything is packaged as an EAR, how would you scale specific layers of our architecture. As mentioned above, if i feel server layer is the bottleneck, in case of one WAR/EAR, how would i scale my application?
I am still not sure if i need to carry on with my model of different WARs in different application servers, or should i have just one WAR for my entire application? Please guide…
If you backend if independent and you comunicate with client using some REST or SOAP web service – this is good. Try to imagine that tommorow you drop your client with java and create other one with .NET. Does backend need some changes? If not – this is good. If yes – I think it does not coast to have 2 wars.