• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory size for each http request

 
Stephane Philippart
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

First post in JavaRanch !! Sorry for my poor english !

So I want to monitor the size in memory for each http request for my web application (under tomcat and wls).

Do you know a tool (not expansive ) or a way to do that.

The tools that I found (jprobe, jprofiler, ...) only allow to monitor global memory but don't allow to separate results by http requests.

Thanks for your answers.

sph
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Determining the size in memory for any single object is difficult. You should be able to get an idea by looking at the source code (I'm assuming you are using Tomcat and can get the source code). Basically there are a bunch of Strings for the various headers and parameters and some sort of Map to provide for lookup.

Of all the things that consume memory in servlet applications, the request should be the least of your worries since the attached objects are available for GC as soon as the response is returned.

Bill
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Test it with 0, 1, 10, 100 and 1000 requests.
Build the differences.
Make a graph.

Probably a single request needs more memory, than (2 requests)/2, because they share some memory (static variables i.e.).
 
Stephane Philippart
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answers, ly aim isn't to measure the reuest itself but the size
of the memory used between the moment where the appserver received the request and the moment where it send the response. This is for evaluate the memory need for several parallele users.

stef
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could write a load tester specific to your application that emulates a number of users. I have used the HttpClient toolkit free from this Apache Commons site.

Not only can you then look at the memory usage, but also at the response times under a varying load. In my case I wrote an XML file defining the user transactions to drive the load tester. I also stuck a simple response time histogram collector in the servlet.

The HttpUnit (see the Sourceforge project) could also be used.
Bill

[ EJFH: Fixed typo ]
[ July 30, 2004: Message edited by: Ernest Friedman-Hill ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic