Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I *want* multiple sessions from multiple clients logged in from one machine

 
Joe Gilvary
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've searched in this forum to see if anyone has worked through something like this before. I see a lot of people working on ways to prevent multiple simuultaneous accesses by a single client, but that is just what I want to create.

I want to use a multi threaded client to simulate load on a web app. The application stores some persistent data in the session. Each thread will request different information to model real world behavior more closely.

The problem is that the app server sees each thread as the same client (via cookies) coming from the same process on the same machine and subsequently lets them step all over one another's session-stored data.

I need to fix this on the client side. The purpose is testing the web app we will deploy, not changing the app to something we can more easily test. The real world clients are locked down and will use cookies, so URL rewriting is testing something besides what we will deploy.

I know I can use separate JVMs instead of threads, but then I need more hardware to simulate the same load. I prefer threading if I can find such a solution.

TIA,

Joe
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're writing the client, you can set whatever you want for the headers.
Just don't pass the JSESSIONID header and the server will treat each request as a new session.
 
Joe Gilvary
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
Just don't pass the JSESSIONID header and the server will treat each request as a new session.
Thanks, Ben.

I didn't give you enough information. I don't want every request to be a new session. I want every thread to have an individual session for its use over several requests. Each thread should pull data from the backend to the client, possibly modify it, and send it back through the web app to the persistent store. To look more like the real world, each thread should access different records. Currently they step on one another's requests because they're all in a single session.

Thanks,

Joe
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have each thread hit the app once to get a JSESSIONID.
Then set the header with that value for all subsequent hits by that thread.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds to me like you need the HttpClient package from the Apache Jakarta commons project.
I have used this to simulate large numbers of "clients" with separate sessions from a single machine.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic