This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Performance: MVC versus Single JSP

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I code, lets say, retrieval from a database a list of records that match some criteria. I can do this basically one of two ways, a) Servlet that runs a query, populates a bean and then displays in a JSP -OR- b) do the lot in the JSP.
Which is faster? Does one consume significantly more resources than the other?
Let's ignore for the purpose of this post usual MVC benefits (maintenance & separation of duties etc).
 
Saloon Keeper
Posts: 21618
147
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically you should see any performance differences from how the logic is broken out are minimal compared to the overhead of the network and database connections.
When the overhead for keeping things well-structured actually causes significant performance degradation in the server, it's probably time to consider a faster language than Java!
Finally, there's the cardinal rule for optimization: It's virtually ALWAYS easier to optimize a well-structured program than it is to debug an "optimized" one. Along with its corrollary: The bottleneck is almost NEVER where you "know" it is.
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am fairly new to server side java... are you saying that sometimes it is OK and won't hurt performance if you lump everything into the JSP, assuming maybe it is a very small app with not much worry about code maintanence?
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!