aspose file tools*
The moose likes Web Services and the fly likes How does Axis2 interact vs Tomcat? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How does Axis2 interact vs Tomcat?" Watch "How does Axis2 interact vs Tomcat?" New topic
Author

How does Axis2 interact vs Tomcat?

Enrico Tamellin
Greenhorn

Joined: Nov 09, 2008
Posts: 23
Hello everybody.

I have a question:

If you run Axis2 with Tomcat as container,
How do EXACTLY they interact each other?

Tomcat should manage the in-requests and they it passes it to Axis2, but I would like to know with modules they use to communicate?

I didn't find any documentation about it.


Thank you in advance!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42906
    
  69
Hello "Enrico T"-

You may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, what do you mean by "interact"? Axis is implemented as a web app, with the AxisServlet mapped to all requests for URLs starting with "/services/*". So in that respect it works like any other servlet.
I realize this is probably not what you were asking; maybe you can provide some more detail what you are asking.
Enrico Tamellin
Greenhorn

Joined: Nov 09, 2008
Posts: 23
Originally posted by Ulf Dittmer:
Hello "Enrico T"-

You may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.


I am sorry ... I have just updated! :-)

Originally posted by Ulf Dittmer:

As to your question, what do you mean by "interact"? Axis is implemented as a web app, with the AxisServlet mapped to all requests for URLs starting with "/services/*". So in that respect it works like any other servlet.
I realize this is probably not what you were asking; maybe you can provide some more detail what you are asking.


Thank you for the quick answer! You answer was very useful because it coinfirms what I understood.

Ok I ll add more details: I have Axis2 1.4 over Tomcat 6.0.16.

I didn't understand very well how a requests is handled by the 2 software. I would like to know exactly all the steps there are for a request with this configuration and which modules is going to use. I am writing down what I understood and please you are welcome to correct me or add more details when you want! :-)

A) Axis2 runs over Tomcat so Tomcat manages the connections of Axis2. Tomcat provides a Connection Thread Pool for the Axis2's requests.

B) Tomcat associated a Thread to a new request. The threads are stored in the Connection Thread Pool (with the maximum of MaxThreads) and there is also a Request Queue (with a max of AcceptCount). The configuration file for it is "\apache-tomcat-6.0.16\conf\server.xml". The documentation of it is here

C) Axis2 has his Thread Pool Connection and you can configure it in the "\apache-tomcat-6.0.16\webapps\axis2\WEB-INF\conf\axis2.xml". This Thread Pool Connection is managed by a transport receiver.
You can set all this options (see quote)
<transportReceiver name="http"
class="org.apache.axis2.transport.http.SimpleHTTPServer">
<parameter name="port">8080</parameter>
<!-- Here is the complete list of supported parameters (see example settings further below):
port: the port to listen on (default 6060)
hostname: if non-null, url prefix used in reply-to endpoint references (default null)
originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
requestTimeout: value in millis of time that requests can wait for data (default 20000)
requestTcpNoDelay: true to maximize performance and minimize latency (default true)
false to minimize bandwidth consumption by combining segments
requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
requestMaxThreadPoolSize: number of threads available for request processing if queue fills up (default 150)
note that default queue never fills up: see HttpFactory
threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
note that no such threads can exist with default unbounded request queue
threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
-->
<!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
<!-- <parameter name="originServer">My-Server/1.1</parameter> -->
<!-- <parameter name="requestTimeout">10000</parameter> -->
<!-- <parameter name="requestTcpNoDelay">false</parameter> -->
<!-- <parameter name="requestCoreThreadPoolSize">50</parameter> -->
<!-- <parameter name="RequestMaxThreadPoolSize">100</parameter> -->
<!-- <parameter name="threadKeepAliveTime">240000</parameter> -->
<!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter> -->
</transportReceiver>


D) BUT This connector is used ONLY for the axis2 STANDALONE and this is not that case. (I am not sure in this part, so correct me if it is not correct)

E) So for every request it happens

- 1) the request "http://localhost:8080/axis2/services/myService" arrives in Tomcat
- 2) Tomcat associates this request to one of the threads in his Connection Thread Pool.
- 3) Tomcat understands that it has to send this request to the AxisServlet (because the request matches with the /services/*)
- 4) Axis2 receives the request and it understands it's a myServer service. But IT DOES NOT CREATE ANY OTHER THREADS

- 5) My service has its transport receiver. The receiver is NOT the receiver quoted before, but is defined in the file "services.xml" inside the service my Service. Common receivers are "org.apache.axis2.rpc.receivers.RPCMessageReceiver" for POJO Classes or "org.apache.axis2.receivers.RawXMLINOutMessageReceiver" or "org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver". THESE RECEIVERS HAVEN'T A CONNECTION THREAD POOL, SO THEY DON'T CREATE A NEW THREAD

- 6) THE THREAD OF TOMCAT CONNECTION THREAD POOL EXECUTES THE SERVICE IN AXIS2. This generates a return message.

F) Conclusion: THE THREAD OF TOMCAT CONNECTION THREAD POOL is not free until it finishes the Axis2 service.

G) I know Axis2 can has some ThreadPool API, but I don't think it uses it in this process.

I would like to know if this process it the right one or there is other steps in the interaction between Tomcat and Axis2.

Please DON'T HESITATE TO CORRECT ME! :-)

I didn't find so much documentation for it so you are welcome to suggest it to me.

THANK YOU IN ADVANCE!!!
[ December 02, 2008: Message edited by: Enrico Tamellin ]
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Enrico Tamellin:
F) Conclusion: THE THREAD OF TOMCAT CONNECTION THREAD POOL is not free until it finishes the Axis2 service.


Just out of curiosity - what is motivitating this line of inquiry?

Your point F.) (the conclusion) has nothing to do with Axis2 and everything to do with the Servlet API that Tomcat implements. The Servlet API always assumed that each incoming request would be processed in an extremely timely manner - so a thread-per-request-response model made sense. That was before AJAX arrived on the scene with its use of long-lived HTTP connections in Comet applications - for which the thread-per-request-reponse model is an extremely ill fit. It was because of this that Jetty introduced continuations to more effectively implement Comet web applications. This technology will be replaced by "suspendable requests" as specified in the Servlet 3.0 API specification. Tomcat 6 only implements the Servlet 2.5 API - i.e. it is still limited to the thread-per-request-reponse model. So Axis2 running under Tomcat is bound to that limitation. Currently Grizzly seems to be used for Comet web applications (Dead Simple Comet Example on Glassfish v3 / Grizzly).

I suspect that Axis2 isn't particularly well equipped for dealing with long lived requests (i.e. capable accepting a request in one thread and then emitting the response with another).
Enrico Tamellin
Greenhorn

Joined: Nov 09, 2008
Posts: 23
Originally posted by Peer Reynders:


Just out of curiosity - what is motivitating this line of inquiry?



Yes I am happy to explain to you! Basically I have a system to tune and I would like to know the exactly amount of Threads all the system(Tomcat+Axis2) is going to generate per request. The number of threads is an important parameter in order to determinate the resource thrashing of the system and this can have a huge impact to the performance. I just want to optimize it!

Thank you very much for your links, they are very useful and I managed to understand some unclear aspects. :-)

Luckily, I don't have a HTML page to serve. So I don't have AJAX systems. I have simple a thread-per-request-reponse mode. My system is composed by 2 pc that communicate each other by web services (using SOAP messages). Each pc has his service in Axis2 (same version) than runs over Tomcat(same version). The messages are quite frequently and I need to tune the configuration.

so I would like to know:

a) during the connection from Tomcat and Axis2 there is a generation of a new Thread, or if the Thread in the Tomcat's Connection Thread Pool is preforming all the service in Axis2.

b) are correct all the steps I posted before or I made some mistakes?

Thank you again
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
Yes, the Tomcat request handling Thread is doing all the work in Axis SOAP handling. Why would it be otherwise?

The Tomcat management application is very handy for watching active Threads, I heartily recommend it.

Bill
 
jQuery in Action, 2nd edition
 
subject: How does Axis2 interact vs Tomcat?