Get your CodeRanch badge!*
The moose likes Performance and the fly likes Memory size for each http request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Memory size for each http request" Watch "Memory size for each http request" New topic
Author

Memory size for each http request

Stephane Philippart
Greenhorn

Joined: Jul 29, 2004
Posts: 12
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

Joined: Mar 22, 2000
Posts: 12682
    
    5
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


Java Resources at www.wbrogden.com
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

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.).


http://home.arcor.de/hirnstrom/bewerbung
Stephane Philippart
Greenhorn

Joined: Jul 29, 2004
Posts: 12
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

Joined: Mar 22, 2000
Posts: 12682
    
    5
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Memory size for each http request
 
Similar Threads
Monitor Size
Any performance monitoring tool ?
Tomcat OutOfMemory Exception
Monitoring threads in a pool and evicting hung threads
Tomcat OutOfMemory Exception