The synchronising Timer can help here: http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Synchronizing_Timer
Just have N threads and set the Timer to synchronise N threads. Howver as AJ says, it may not actually hit the servlet at the same time. Not only because of JMeter timing, but the server may not process the requests at the same time. You will also need to ensure that both threads use the same session; how to achieve that depends on how the session is aquired. To have different threads talk to different servlets, there are various options: * use a Switch Controller with one sample for each thread number * use a Javascript/JEXL/Beanshell function to return a value from an array indexed by thread number * use CSV DataSet with a separate file for each thread (i.e. include the thread number in the name) * etc If you have access to the servlet code, you can increase the chance of hitting them together by putting some delays into the parts that update the session object. S On 10/02/07, git <[EMAIL PROTECTED]> wrote:
Andrew, It is possible to simulate synchronised access to two different servelets simply by putting samplers sequentially under the same thread. Forcing Jmeter to asychronously hit the two servelets in such a way as to simulate a race condition is much harder. The problem is that you can only 'ask' a thread to run, it is up to the operating system to choose when it will actually perform a given task. We have similar issues with some of our software. The way that race conditions are avoided for us is to use MS SQLServer transactions to serialise access to shared data. To test that this is working, I use large numbers of threads sequentially hitting different pages (which shared data). The threads are 'ramped up' so that the best chance of race conditions is achieved. I am only happy that there are no race conditions when the test has run without data conflict for several hours. It is an inexact science - but it is all we have! Cheers AJ On Fri, 2007-02-09 at 13:08 -0800, maskkkk wrote: > I read in my Servlets book that you should synchronize data that is shared > between multiple servlets. > > An example of this would be if two servlets were to modify the user's > session object at the same time. > (Meaning that one user has 2 browser windows open accessing 2 different > servlets which are both modifying the same session object) > > Without synchronization it is possible that this may result in a session > object in an invalid state (since it is being modified by both threads) > > Is there anyway to recreate/test this functionality with JMeter so that it > may be tested? > > Thank you, > > Andrew J. Leer www.cubicalland.com www.nerds-central.blogspot.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

