"Rajat Gupta05" <rajat_gupt...@infosys.com> wrote in message news:784ae6e0ec8c2343975b7ff4daeaa34b0ce6638...@blrkecmbx06.ad.infosys.com... >Hi, > >I am trying to create a AJP connector on Tomcat5.5 which is running in >Embedded mode by using following API's > > Embedded em = new Embedded(); // create new engine >StandardEngine engine = (StandardEngine) em.createEngine(); >engine.setName("Catalina"); >engine.setDefaultHost("localhost"); > >String ajp13_address = "127.0.0.1"; >String ajp13_protocol = "ajp13"; >org.apache.catalina.connector.Connector ajp13Connector = null; >ajp13Connector = em.createConnector(ajp13_address, ajp13_port, >ajp13_protocol); > >With Tomcat5.0 there were methods available in CoyotoConnector through >which we could set the MinProcessors and >MaxProcessers which are similar >to MinSpareThreads and MaxThreads in tomcat5.5. >
You use the setProperty method on the Connector Object (the names are the same as in the Tomcat docs for setting it via server.xml). So something like: ajp13Connector.setProperty("maxThread", "200"); ajp13Connector.setProperty("minSpareThreads", "25"); >In tomcat5.5 how do I set these values, Can you I use >ChannelSocket/ChannelNioSocket for the same? What is >difference between >these two? > ChannelSocket is the standard Java AJP/1.3 Channel for 5.5.x. With this channel, the Threads will block after handling a request waiting for the next request on that particular Socket to come from Apache (or until it hits the connectionTimeout, which ever happens first). ChannelNioSocket is the experimental (due to a lack of community interest) non-blocking Java Channel. It works somewhat like the APR AJP/1.3 Connector in that Threads return to the pool after processing a request. Then when another request comes in from Apache on a Socket, it gets a Thread from the pool, and uses it to process the request. This means that the only active Tomcat Threads are those that are processing requests, so depending on your site's traffic pattern means that you can possibly handle a big pool of Socket connections between Apache and Tomcat with relatively few Threads. To use this one, you would specify an ajp13_port value of 0 in the createConnector call above, and use: ajp13Connector.setProperty("channelNioSocket.port","8009"); // required ajp13Connector.setProperty("channelNioSocket.maxThreads", "200"); ... Property name are generally the same as for ChannelSocket, but prefixed with channelNioSocket.<property>. >Please let me know if there is other alternative as well available. > >Thanks >Rajat > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org