struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "adam" <aa...@columbiaexchange.com>
Subject RE: multithreading within one session
Date Tue, 27 Apr 2004 15:54:45 GMT

Yes, but I was hoping to understand how the Struts framework handles
a scenario where the server receives n "simultaneous" requests for the same
session. Let's just suppose that the requests are really simultaneous(or at
least arrive in an amount of time that is far less that it would take for
the action class to complete a single threaded request.)


-----Original Message-----
From: Jason Miller [mailto:jason.miller@danteconsulting.com] 
Sent: Tuesday, April 27, 2004 10:17 AM
To: Struts Users Mailing List
Subject: Re: multithreading within one session

The behavior you are describing is a platform-dependent artifact of the 
process model for the OS you are using.  There is no guarantee regarding 
the execution order for Threads.  There is not even a guarantee that 
Threads will multiprocess - it is entirely feasible for the VM to 
schedule their execution one after the other, just as it is for the VM 
to round robin using timeslicing.

So far as multithreading within a session, there isn't anything that 
prevents it, although the synchronization issues always give me pause.

So as an answer, what you are experiencing is a result of the OS you are 
running, the VM you are running, and the implementation of the app 
server you are running.  In general, you shouldn't rely on these details 
unless you are locked to this combination.

A good book to read - Java Threads 
(http://www.oreilly.com/catalog/jthreads2/)

Sorry if I rambled and danced around
Jason

adam wrote:

> Hello all.
> 
>  
> 
> I have done the following experiment, and I am curious of why I am getting
> these results:
> 
>  Basically I wanted to know what happens if I send parallel requests
within
> the same session
> 
> for the same action class/path.
> 
>  
> 
> Ie, I am doing the following:
> 
> -          get the session id cookie from the server 
> 
> -          log in
> 
> -          then schedule n threads for execution at the same moment in
time.
> Each thread has the same session id
> 
> cookie and makes a request for the same path(action class)
> 
> Now, the results I am getting are a bit different from what I was
expecting.
> 
> Basically I thought that I couldn't have multithreading within the same
> session, but that I would get a response for request 1 after milliseconds,
> then a response for request two after 2n milliseconds and so on.
> 
>  
> 
> Instead it seems that I am (roughly ) getting all responses after m*n time
> where the m is the number of threads and n is the length of time to
service
> one request. Actually it may not be exactly that time(i.e. m*n) but the
idea
> is that the more threads I have the longer the response time for all
> threads, and all threads finish at about the same time..
> 
>  
> 
> So, my question is: what exactly is happening when multiple threads access
> the same action class within one session?
> 
> Regards, Alex Adam
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message