Sampson is right... We can specify multiple ports for different protocols...
Paul Erion, if you are trying to assign multiple port for a single protocol, how can Tomcat know which protocol to use, when it get a certain request with different port numbers.... Tomcat will use to a suitable protocol, according to the port number it gets...
The reason for this is this. The Connector element represents a connector. Upon startup, Tomcat will parse the server.xml file and create objects based on the content of the file. A Connector element will cause Tomcat to create a Connector object. Another Connector element will give you another instance of Connector. With the above configuration, you have 2 connectors listening on port 8080 and 8081 respectively. You only have one container though. The connectors create a request and response object for each incoming HTTP request and pass it to the container.
You can read Chapter 3 of our How Tomcat Works book that discusses connector. This chapter is freely available from www.brainysoftware.com
Author of <a href="http://www.amazon.com/exec/obidos/ASIN/097521280X/ref=jranch-20" target="_blank" rel="nofollow">How Tomcat Works</a>
Ko Ko Naing
Joined: Jun 08, 2002
Thanks for the great explanation, Budi... I got them clearly now also...
Even though we can have two connectors listening to different ports, there is only one container which handle the requests from them...
Joined: Apr 09, 2003
What's the advantage to having more than one connector if they both process connections for the same container?
Joined: Jul 11, 2003
Originally posted by Budi Kurniawan:
I think what Paul wanted to know was whether a protocol (HTTP or HTTPS) can listen on multiple ports. The answer is yes.
Thanks for the response! And in figuring out what I trying to ask -- I didn't mean to be difficult ... it just always seems to work out that way.
p.s., I apologize for my signature ... I typically precede my first name with a colon (it's a Lisp thing) and didn't realize it would end up being interpreted as a emoticon. [ September 16, 2004: Message edited by: Paul Erion ]
Tomcat is actually a set of components wired together. While mostly it's employed in the out-of-the-box wiring configuration, you can add elements to server.xml to provide multiple Host, Engine, Connector and other such items in a custom architecture.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Nov 09, 2009
My problem is the performance lost.
My server.xml is configured like this:
I had to do this because the applications communicate with them selfs.
app1 --> app2 --> app3
app2 --> app1 --> app3
When I use all threads for one of the applications, they enter in deadlock (they always need to wait for another application to end).
You don't need a separate set of ports for each webapp just because they're talking to each other. One port is sufficient. Tomcat will route the requests based on their URL context.
You can get race conditions, "deadly embrace" and resource contention issues without any web architecture at all, however, so I recommend drawing a detailed map of what calls what when, how the components interact, and maybe slap some performance-monitoring on the server in case both apps are trying to make large database operations at the same time.
Joined: Nov 09, 2009
Thanks for the answer Tim.
I have 2 applications, wayback and nutchwax, they belong to a search server.
*Nutchwax -> Index -> User
*Wayback -> *Nutchwax -> Index -> User
*Wayback -> *Nutchwax -> Index -> *ArcProxy -> *Browser -> User
* means that this is a application of tomcat
The fact is when I configure Tomcat to have 100 MaxThreads and then I make 100 simultaneous requests to Wayback the threads stop responding, keeps waiting for the arcproxy application, this application doesn't have any free thread to use.