You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by David Cherryhomes <dc...@yahoo.com> on 2002/05/10 23:27:08 UTC

Scalability question

Have there been any solid tests in regards to the scalability of
using the Action Servlet and Action class (as opposed to using a
single Filter servlet which forwards to other Servlets)? I am
especially concerned since my Action class connects (thru a
BusinessDelegate) to one or more EJB's that are really
responsible for processing the business logic. 

Any thoughts on this would be greatly appreciated.

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Scalability question

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 10 May 2002, David Cherryhomes wrote:

> Date: Fri, 10 May 2002 15:14:34 -0700 (PDT)
> From: David Cherryhomes <dc...@yahoo.com>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: Struts Developers List <st...@jakarta.apache.org>
> Subject: RE: Scalability question
>
> I'm sorry, maybe I was unclear. I am not challenging the
> usefulness of Struts, I am well aware of the vast amount of
> functionality that the framework encompasses. I am currently
> using Struts as a core part of the MVC approach in my enterprise
> application. My question is about the scalability of Struts
> Action classes.
>
> It is my understanding that a Servlet engine will create new
> instances/threads of a Servlet as needed (similar to stateless
> session beans), and hence is very scalable for multiple
> concurrent requests.

This is true only if your servlet implements the SingleThreadModel (STM)
interface.  If it doesn't, a single instance of your servlet is allocated
and is shared by all concurrent requests.  The Struts controller servlet
is an example of this (it is not an STM servlet) -- there is one and only
one instance of this servlet for your webapp.

> My understanding is that an Action class,
> on the other hand, is stored as an instance variable.

The set of Action instances that have been created are stored in a servlet
instance variable, but they are reused on multiple requests for the same
action.  In fact, Struts makes a similar guarantee about Action instances
to what the servlet container promises about non-STM servlets -- there
will be at most one occurrence of any given Action implementation class.

> The
> question is this: if I have a class that performs a massive
> amount of business processes (inclusive of attaching to multiple
> EJB's), will the multiple concurrent requests end up queued in a
> wait status until each one is finished processing, or is there a
> multiple instance/thread approach to Action classes (similar to
> a Servlet engine with Servlets)?
>

Action instances have exactly the same thread processing characteristics
as non-STM servlets - the single instance is utilized by multiple requests
(on different threads) simultaneously.  This has two important
implications:

* You (and Struts) don't have to worry about pooling Action instances -
  the same one is reused continuously, with no locking or allocation
  overhead.

* You must program your Action instances in a thread-safe manner.
  The most important rule is to not store any per-request state
  information in instance variables in the Action class.

> The enterprise application I'm working on isn't for some
> website, but a truly web-deployed enterprise app which must
> scale to thousands of concurrent users with millions of records
> in the DB. Thus, performance is a HUGE concern (e.g., a wait of
> 500 miliseconds is about the max permitted).

As long as the servlet container you're running on can support the number
of simultaneous requests you need, you're going to find that Struts is
basically irrelevant to scalability on the business logic side of things.
You will definitely have to configure your EJB server to support adequate
pools of bean instances, because they do act like STM servlets.

In the presentation layer, using Struts (or more precisely, using the
Struts tag libraries) can have a performance and response time impact,
depending on the quality of the code generated by the JSP page compiler in
your servlet container.  As long as you don't exceed the simultaneous
response capabilities of your container, this is primarily an issue of CPU
time in the web tier servers.

>
> Thanks

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Scalability question

Posted by David Cherryhomes <dc...@yahoo.com>.
These last two answers addressed exactly what I was looking for.
The framework is handling the instance variables and threading
as expected/hoped-for. Thanks all!

--- Hal Deadman <ha...@Tallan.com> wrote:
> As long as there are no synchronization issues with your
> Action class
> then it shouldn't be a bottleneck. I don't even know why an
> application
> server would create more than one instance of a servlet. The
> doGet()
> method on a servlet or the process() method on an Action class
> can be
> called by as many concurrent threads as your application
> server wants to
> use and it shouldn't be a problem.    There is no waiting or
> queueing
> going on. 
> 
> Every thread gets their own copy of the local variables in the
> method.
> You can have instance variables in the Action class (like a
> Business
> Delegate or session bean home interface) as long as they are
> created
> once in the constructor and only contain "thread safe" methods
> with no
> synchronization issues. 
> 
> This is not to say that Struts doesn't have some overhead but
> so do
> EJBs, databases, networks, etc. You use them because they make
> your code
> more maintainable and increase productivity. Performance
> problems are
> almost always going to come from bad code or database mis-use
> rather
> than a framework like Struts. 
> 
> Hal
> 
> > -----Original Message-----
> > From: David Cherryhomes [mailto:dcherryhomes@yahoo.com]
> > Sent: Friday, May 10, 2002 6:15 PM
> > To: Struts Developers List
> > Subject: RE: Scalability question
> > 
> > 
> > I'm sorry, maybe I was unclear. I am not challenging the
> > usefulness of Struts, I am well aware of the vast amount of
> > functionality that the framework encompasses. I am currently
> > using Struts as a core part of the MVC approach in my
> enterprise
> > application. My question is about the scalability of Struts
> > Action classes.
> > 
> > It is my understanding that a Servlet engine will create new
> > instances/threads of a Servlet as needed (similar to
> stateless
> > session beans), and hence is very scalable for multiple
> > concurrent requests. My understanding is that an Action
> class,
> > on the other hand, is stored as an instance variable. The
> > question is this: if I have a class that performs a massive
> > amount of business processes (inclusive of attaching to
> multiple
> > EJB's), will the multiple concurrent requests end up queued
> in a
> > wait status until each one is finished processing, or is
> there a
> > multiple instance/thread approach to Action classes (similar
> to
> > a Servlet engine with Servlets)?
> > 
> > The enterprise application I'm working on isn't for some
> > website, but a truly web-deployed enterprise app which must
> > scale to thousands of concurrent users with millions of
> records
> > in the DB. Thus, performance is a HUGE concern (e.g., a wait
> of
> > 500 miliseconds is about the max permitted).
> > 
> > Thanks
> > 
> > --- James Mitchell <jm...@telocity.com> wrote:
> > > Yes, you can create your entire web site with only servlet
> > > filters, jsp, and
> > > a few beans.
> > > 
> > > And at some point you will find out what struts does for
> you
> > > (the hard way)
> > > and why it is superior to all other Java Web Application
> > > Development
> > > Frameworks.
> > > 
> > > I hope this helps.
> > > 
> > > JM
> > > 
> > > "Its a dog-eat-dog world out there, and I feel like I'm
> > > wearing milkbone
> > > underwear!"
> > >   Guess who?
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: David Cherryhomes [mailto:dcherryhomes@yahoo.com]
> > > > Sent: Friday, May 10, 2002 5:27 PM
> > > > To: Struts Developers List
> > > > Subject: Scalability question
> > > >
> > > >
> > > > Have there been any solid tests in regards to the
> > > scalability of
> > > > using the Action Servlet and Action class (as opposed to
> > > using a
> > > > single Filter servlet which forwards to other Servlets)?
> I
> > > am
> > > > especially concerned since my Action class connects
> (thru a
> > > > BusinessDelegate) to one or more EJB's that are really
> > > > responsible for processing the business logic.
> > > >
> > > > Any thoughts on this would be greatly appreciated.
> > > >
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Yahoo! Shopping - Mother's Day is May 12th!
> > > > http://shopping.yahoo.com
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <ma...@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > > > <ma...@jakarta.apache.org>
> > > >
> > > >
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:  
> > > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Shopping - Mother's Day is May 12th!
> > http://shopping.yahoo.com
> > 
> > --
> > To unsubscribe, e-mail:   
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail: 
> > <ma...@jakarta.apache.org>
> > 
> 

> ATTACHMENT part 2 application/x-pkcs7-signature name=smime.p7s



__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Scalability question

Posted by Hal Deadman <ha...@Tallan.com>.
As long as there are no synchronization issues with your Action class
then it shouldn't be a bottleneck. I don't even know why an application
server would create more than one instance of a servlet. The doGet()
method on a servlet or the process() method on an Action class can be
called by as many concurrent threads as your application server wants to
use and it shouldn't be a problem.    There is no waiting or queueing
going on. 

Every thread gets their own copy of the local variables in the method.
You can have instance variables in the Action class (like a Business
Delegate or session bean home interface) as long as they are created
once in the constructor and only contain "thread safe" methods with no
synchronization issues. 

This is not to say that Struts doesn't have some overhead but so do
EJBs, databases, networks, etc. You use them because they make your code
more maintainable and increase productivity. Performance problems are
almost always going to come from bad code or database mis-use rather
than a framework like Struts. 

Hal

> -----Original Message-----
> From: David Cherryhomes [mailto:dcherryhomes@yahoo.com]
> Sent: Friday, May 10, 2002 6:15 PM
> To: Struts Developers List
> Subject: RE: Scalability question
> 
> 
> I'm sorry, maybe I was unclear. I am not challenging the
> usefulness of Struts, I am well aware of the vast amount of
> functionality that the framework encompasses. I am currently
> using Struts as a core part of the MVC approach in my enterprise
> application. My question is about the scalability of Struts
> Action classes.
> 
> It is my understanding that a Servlet engine will create new
> instances/threads of a Servlet as needed (similar to stateless
> session beans), and hence is very scalable for multiple
> concurrent requests. My understanding is that an Action class,
> on the other hand, is stored as an instance variable. The
> question is this: if I have a class that performs a massive
> amount of business processes (inclusive of attaching to multiple
> EJB's), will the multiple concurrent requests end up queued in a
> wait status until each one is finished processing, or is there a
> multiple instance/thread approach to Action classes (similar to
> a Servlet engine with Servlets)?
> 
> The enterprise application I'm working on isn't for some
> website, but a truly web-deployed enterprise app which must
> scale to thousands of concurrent users with millions of records
> in the DB. Thus, performance is a HUGE concern (e.g., a wait of
> 500 miliseconds is about the max permitted).
> 
> Thanks
> 
> --- James Mitchell <jm...@telocity.com> wrote:
> > Yes, you can create your entire web site with only servlet
> > filters, jsp, and
> > a few beans.
> > 
> > And at some point you will find out what struts does for you
> > (the hard way)
> > and why it is superior to all other Java Web Application
> > Development
> > Frameworks.
> > 
> > I hope this helps.
> > 
> > JM
> > 
> > "Its a dog-eat-dog world out there, and I feel like I'm
> > wearing milkbone
> > underwear!"
> >   Guess who?
> > 
> > 
> > > -----Original Message-----
> > > From: David Cherryhomes [mailto:dcherryhomes@yahoo.com]
> > > Sent: Friday, May 10, 2002 5:27 PM
> > > To: Struts Developers List
> > > Subject: Scalability question
> > >
> > >
> > > Have there been any solid tests in regards to the
> > scalability of
> > > using the Action Servlet and Action class (as opposed to
> > using a
> > > single Filter servlet which forwards to other Servlets)? I
> > am
> > > especially concerned since my Action class connects (thru a
> > > BusinessDelegate) to one or more EJB's that are really
> > > responsible for processing the business logic.
> > >
> > > Any thoughts on this would be greatly appreciated.
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Shopping - Mother's Day is May 12th!
> > > http://shopping.yahoo.com
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > >
> > >
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Mother's Day is May 12th!
> http://shopping.yahoo.com
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 

RE: Scalability question

Posted by David Cherryhomes <dc...@yahoo.com>.
I'm sorry, maybe I was unclear. I am not challenging the
usefulness of Struts, I am well aware of the vast amount of
functionality that the framework encompasses. I am currently
using Struts as a core part of the MVC approach in my enterprise
application. My question is about the scalability of Struts
Action classes.

It is my understanding that a Servlet engine will create new
instances/threads of a Servlet as needed (similar to stateless
session beans), and hence is very scalable for multiple
concurrent requests. My understanding is that an Action class,
on the other hand, is stored as an instance variable. The
question is this: if I have a class that performs a massive
amount of business processes (inclusive of attaching to multiple
EJB's), will the multiple concurrent requests end up queued in a
wait status until each one is finished processing, or is there a
multiple instance/thread approach to Action classes (similar to
a Servlet engine with Servlets)?

The enterprise application I'm working on isn't for some
website, but a truly web-deployed enterprise app which must
scale to thousands of concurrent users with millions of records
in the DB. Thus, performance is a HUGE concern (e.g., a wait of
500 miliseconds is about the max permitted).

Thanks

--- James Mitchell <jm...@telocity.com> wrote:
> Yes, you can create your entire web site with only servlet
> filters, jsp, and
> a few beans.
> 
> And at some point you will find out what struts does for you
> (the hard way)
> and why it is superior to all other Java Web Application
> Development
> Frameworks.
> 
> I hope this helps.
> 
> JM
> 
> "Its a dog-eat-dog world out there, and I feel like I'm
> wearing milkbone
> underwear!"
>   Guess who?
> 
> 
> > -----Original Message-----
> > From: David Cherryhomes [mailto:dcherryhomes@yahoo.com]
> > Sent: Friday, May 10, 2002 5:27 PM
> > To: Struts Developers List
> > Subject: Scalability question
> >
> >
> > Have there been any solid tests in regards to the
> scalability of
> > using the Action Servlet and Action class (as opposed to
> using a
> > single Filter servlet which forwards to other Servlets)? I
> am
> > especially concerned since my Action class connects (thru a
> > BusinessDelegate) to one or more EJB's that are really
> > responsible for processing the business logic.
> >
> > Any thoughts on this would be greatly appreciated.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Shopping - Mother's Day is May 12th!
> > http://shopping.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Scalability question

Posted by James Mitchell <jm...@telocity.com>.
Yes, you can create your entire web site with only servlet filters, jsp, and
a few beans.

And at some point you will find out what struts does for you (the hard way)
and why it is superior to all other Java Web Application Development
Frameworks.

I hope this helps.

JM

"Its a dog-eat-dog world out there, and I feel like I'm wearing milkbone
underwear!"
  Guess who?


> -----Original Message-----
> From: David Cherryhomes [mailto:dcherryhomes@yahoo.com]
> Sent: Friday, May 10, 2002 5:27 PM
> To: Struts Developers List
> Subject: Scalability question
>
>
> Have there been any solid tests in regards to the scalability of
> using the Action Servlet and Action class (as opposed to using a
> single Filter servlet which forwards to other Servlets)? I am
> especially concerned since my Action class connects (thru a
> BusinessDelegate) to one or more EJB's that are really
> responsible for processing the business logic.
>
> Any thoughts on this would be greatly appreciated.
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Mother's Day is May 12th!
> http://shopping.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>