• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How does Apache Tomcat server handle the HTTPrequests?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone..

What i mean in the above question is that, when we send a HTTP request to the apache tomcat server in which data structure does it get stored for further action(like processing it and serving the request)

I am designing a testing tool to check the performance of a server . So am simulating huge number of HTTP requests by creating threads and sending HTTP requests.....So WHERE DOES APACHE TOMCAT server store these request for processing.

I want to change this implementation according to one IEEE paper. I have downloaded the source code of apache tomcat server and want to know where i can change this implementation (in which file???) . Some one said there will be FIFO queue to store the requests.. But i am not sure about that.. I want to implement RED(Random Early Detection)queue instead of FIFO queue .
PLese please help me
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand why this is giving you a problem. Right there in the API we see the interfaces javax.servlet.ServletRequest and HttpServletRequest.

These are the basic structures for holding the data - you can get the actual source code for the implementations in Tomcat!

You will see that typical Java structures are used for the headers and parameters and input stream.

An incoming request is handled by a Thread from the thread pool which creates (or reuses) a request object, extracts the headers before the service method is called. It also prepares a response object with the matching output stream. So it is a Thread that is holding the request and response objects. The number of Threads is of course configurable.

Admittedly, the tomcat packages and classes are a bit hard to follow.

Bill
 
vinod kumar h v
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much william for the reply


But am new to tomcat and after your reply i found two java files (HttpServlet and HttpServletRequest) i didnt go through that , i thought i first make clear the problem am trying to solve as part of my academic project

I have written a tool which measures the maximum load a server can handle and i want to run it first on local server, which is actually not my goal. I have read this IEEE paper "Tuning Web Server for Web Traffic in stochastic Web Applications" which talks about tuning performance of the web server by implementing a RED(Random Early Detection) queue in the server for holding the requests from the clients instead of using FIFO queue to hold the requests . So the notion is i have the RED algorithm and i have to implement it in tomcat instead of FIFO data structure( algorithm) so that i can compare both the results . That's my goal "To compare the results obtained from server implementing a FIFO queue and the server implementing RED queue when the server is loaded above threshhold level" . I think you got my point and am really waiting for your reply. I dont know what am saying make sense or the architecture of tomcat is not like what am thinking. I just need that part which stores the requests and i want to change it .And tell me if i could do that or not. So am eagerly waiting for your reply.

with regards,
Vinod
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the clarification.

If this was my problem, I would not work with Tomcat. Tomcat has accumulated a LOT of "cruft" as it has developed which will (in my opinion) make it a lot harder to experiment with the way requests are matched with Threads.

A much more interesting project is the Grizzly server - an open source development using the "NIO" model for servicing sockets.

Furthermore, the grizzly project might benefit from your research and you might make a real contribution.

Bill
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat's primary intention is not to enqueue incoming requests, but to immediately transfer them to processing threads. Which, I think is where the confusion lies.

The actual incoming HTTP request stream is compiled to form an Http[Servlet]Request Implementation object (as defined by Tomcat in conformance with the J2EE API), which is augmented by various environmental considerations, including the user's Session (if it exists) and paired with an Http[Servlet]Response object in order to facilitate the application's processing of the request. A very crude description I fear, but mostly accurate.

Tomcat keeps a pool of threads to hand incoming requests to. Now in actual fact, I do believe that once that pool is exhausted, a limited (configurable) number of requests can be queued, but once that resource reaches capacity, Tomcat will simply bounce further requests.

Apache/jakarta contains a rich set of component projects including resource pooling components. I know they're used by Tomcat's default DB connection pooler (which is itself an Apache commons component - DBCP). They may also be the plugin queueing mechanism for Tomcat, although I'd have to go back and look at the source code myself.

Tomcat is itself built out of components, so I'd expect any queuing to be done in either the Host or Engine subsystems (probably Engine), where it would then pipe requests through the Valve chains and eventually into user code.

I don't know if this is going to help - especially since I may be remembering some things incorrectly, but that's the approach I would use in trying to track down and replace whatever queueing mechanisms Tomcat actually does use.
 
vinod kumar h v
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you William and Tim for your replies

Tim your explanation is so deep, i need to go through all of the source code to get all your points.. thank you ..

And William thank you again, sorry for late reply went to my home town for some time.. And what you said about using Grizzly server, without you i would have never come to know about it. I will try it out.. And hope for the best (I have time limit of about 45 days further to complete this project) so i will try my best to contribute to the server .. I will go through the source code.

Regards,
Vinod
 
vinod kumar h v
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
William, help me am not getting how to download.'';. Thank you in advance

Regards,
Vinod
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ugh! - I see what you mean!

The Grizzly project doesn't seem to want to give you a simple way to get started with one download. The last time I looked at it a couple of years ago they had something simpler.

Bill



 
vinod kumar h v
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William

I was busy in my internal evaluation process and was not able to reply . And am very new to apache tomcat and the Grizzly server that you told me, in fact i came to know it only by you. And the problem is still i was not able to figure out which files to download to configure the Grizzly server . So if you could please guide me which file to download. And if possible help me knowing the architecture of the Grizzly server and the part which i can implement the desired algorithm.Thank you

Regards
Vinod
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, it has been a while since I worked with the Grizzly server and I cant help you with the current version.

You should contact the active developer community.

Bill
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic