Tomcat can handle high number of incoming requests, efficiently using a combination of load balancing multiple server “workers” to process the balanced load.
Download Apache Tomcat (/opt/cs/tomcat).
Extract tar.gz.
cd /opt/cs/tomcat
tar -zxvf apache-tomcat-9.0.0.M9.tar.gz
Change configuration:
You will find a block of code for Connector port. Replace that code with the one mentioned below:
vim /opt/cs/tomcat/apache-tomcat-9.0.0.M9/conf/server.xml
<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,image/svg+xml,application/x-javascript,application/json"/>Also add IP. You will find this at the end of the file.
Create a file bin/setenv.sh and specify the memory configuration.
touch /opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/setenv.sh vim /opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/setenv.sh and add the following line: export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms4216m -Xmx13312m"
Start up the application.
Stop Tomcat
/opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/shutdown.shORfuser -k 8080/tcp
Note: fuser is used just to kill the process if it is running even after using 'shutdown.sh'.
Start Tomcat
cd /opt/cs/tomcat/apache-tomcat-9.0.0.M9/bin/
./startup.sh
Remove/Add war.
Remove war
cd /opt/cs/tomcat/apache-tomcat-9.0.0.M9/webapps/
rm edeka.war
rm -r edeka
Add war
cp <Path of CS-Refactored>/CS-Refactored/REST/build/libs/edeka.war /opt/cs/tomcat/apache-tomcat-9.0.0.M9/webapps/
Note: Before copying edeka.war to webapps directory of tomcat, make sure you have built the war.
Last updated: Jul 27, 2018