Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About JSP performance

 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is it bad to have too many jsps in a web app since every single jsp gets converted to a servlet. More jsps will create many servlet
instances.
Thanks in adv.
 
Ryan Bailey
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not bad to have a lot of JSPs. During translation time every JSP is converted to a servlet. This servlet is then loaded into memory and instantiated when requested. Only one servlet instance will be loaded per servlet(jsp) on the Container unless you are implementing the SingleThreadModel.
Hope this helps.
Cheers,
Ryan
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I access all the pages of a web app then many servlet instances(= # of JSP's) are created.
If I use jsp:include tags in my pages there will be more jsps which means more servlet instances.
Does it mean to say that avoiding jsp:include (by replacing jsp:include tag by the code of the pages refered by jsp:include )is better?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My opinion would be to use as many JSPs as makes sense for the structure of your application without worrying about the number. It is unlikely that the number of servlets in your app is the cause of performance problems (if any).
Is this an academic exercise, or are you actually trying to track down a performance issue?
bear
[ May 06, 2003: Message edited by: Bear Bibeault ]
 
Ryan Bailey
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you create a servlet instance for a class, there will NEVER be more than one servlet instance for that particular class. That is, unless you implement the SingleThreadModel. If you are accessing X pages then there will never be more than X + 0 instances.
Does this make sense?
I personally follow the MVC design pattern. The only time I use a JSP page is for the presentation layer of my program. I never include business logic in a JSP.
Cheers,
Ryan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic