Hi Konstantin, -----Original Message----- From: Konstantin Kolinko [mailto:knst.koli...@gmail.com] Sent: 27 November 2015 09:15 To: Tomcat Users List <firstname.lastname@example.org> Subject: Re: Can tomcat serve MPI (parallel) applications?
2015-11-26 23:18 GMT+03:00 Martijn Slouter <martijnslou...@gmail.com>: > Hello, > I am looking for a solution for a tomcat container, which is supposed > to serve a web application, which is using MPI (openmpi) internally. > (The servlet is making JNI calls to C library functions. I have > validated that this Java-MPI connection runs without problems when NOT > using tomcat.) > > In catalina.sh, I have changed the lines which actually starts tomcat > eval "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER ... > into the same command preceded by mpirun: > eval mpirun -n 2 "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" > $LOGGING_MANAGER ... > > However, in catalina.out I get errors like > "... java.net.BindException: Address already in use ..." > This makes sense, because both MPI processes will try to bind to the > same address. > > Is there any chance to have tomcat serve a web application which is > using native MPI functions inside one of its servlets? > > I am using apache-tomcat-7.0.65 on Ubuntu 15.04. What is your goal, your expectation of Tomcat? What these n instances should do that 1 instance cannot? Is is possible to start several Tomcats with the same CATALINA_BASE in parallel, but you have to 1. Disable shutdown port (set port="-1" on <Server> element if I remember correctly) It means that these Tomcats have to shut themselves down eventually (like explicitly calling System.exit()), or you have to kill them by sending a signal (knowing pid of the process). 2. Remove connectors, or disable them (port="-1" if I remember correctly), or configure them to autoselect a random port number (port="0" if I remember correctly) A connector can be configured, reconfigured, started/stopped programmatically via JMX. 3. Do not perform any writing activity in CATALINA_BASE - Do not deploy war files (so that Tomcat does not need to unpack them) - Do not deploy any new applications while Tomcat is running. Turn off autoDeploy feature on Host. Do not use Tomcat Manager web application. - Do not compile JSP pages. Turn them into servlets by precompiling them with Jasper JspC. - Do not write serialized session data (configure <Manager> with pathname=""). - Turn off logging (or turn a deaf ear to it trying to concurrently write into the same log files). Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org In reply to - " Is it possible to start several Tomcats with the same CATALINA_BASE in parallel, but you have to 1. Disable shutdown port (set port="-1" on <Server> element if I remember correctly)" The approach I've taken is to create a port standard for each JVM instance, where each protocol in use within the JVM has its own unique port number, this prevents conflict between multiple Tomcat instances. E.G. Where there are four Tomcat instances calling shutdown - tomcat0/conf/server.xml:<Server port="10005" shutdown="SHUTDOWN"> tomcat1/conf/server.xml:<Server port="10105" shutdown="SHUTDOWN"> tomcat2/conf/server.xml:<Server port="10205" shutdown="SHUTDOWN"> tomcat3/conf/server.xml:<Server port="10305" shutdown="SHUTDOWN"> The same approach applied for HTTP connector - tomcat0/conf/server.xml:<Connector port="10080" protocol="HTTP/1.1" tomcat1/conf/server.xml:<Connector port="10180" protocol="HTTP/1.1" tomcat2/conf/server.xml:<Connector port="10280" protocol="HTTP/1.1" tomcat3/conf/server.xml:<Connector port="10380" protocol="HTTP/1.1" And so on each other protocol. Regards, Theo Avios Group (AGL) Ltd is a limited company registered in England (registered number 2260073 and VAT number 512566754) whose registered address is Astral Towers, Betts Way, London Road, Crawley, West Sussex RH10 9XY . Avios Group (AGL) Limited is part of the IAG group of companies This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.