How to speed up starting up Tomcat

### Reference

 http://www.skybert.net/java/improve-tomcat-startup-time/


### How to speed up Tomcat launch

 set **startStopThreads="0"** in **conf/server.xml**

- before

```xml:sever.xml
    <Engine name="Catalina" defaultHost="localhost">
...
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
```

- after

```xml:sever.xml
    <Engine name="Catalina" defaultHost="localhost" startStopThreads="0">
...
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true" startStopThreads="0">
```

### Before

StartStop-1 single thread

```shell-session:catalina.log

18-Jan-2018 17:36:50.808 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/etc/tomcat/Catalina/localhost/examples.xml]
18-Jan-2018 17:36:51.698 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/etc/tomcat/Catalina/localhost/examples.xml] has finished in [889] ms

18-Jan-2018 17:36:57.855 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/etc/tomcat/Catalina/localhost/manager.xml]
18-Jan-2018 17:36:58.239 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/etc/tomcat/Catalina/localhost/manager.xml] has finished in [384] ms

18-Jan-2018 17:36:58.239 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/etc/tomcat/Catalina/localhost/host-manager.xml]
18-Jan-2018 17:36:58.531 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/etc/tomcat/Catalina/localhost/host-manager.xml] has finished in [292] ms

```


### After

StartStop-1,2,3,4 multiple threads = 4 CPUs

```shell-session:catalina.log

19-Jan-2018 14:37:39.768 INFO [localhost-startStop-3] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/etc/tomcat/Catalina/localhost/manager.xml]
19-Jan-2018 14:37:39.768 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/etc/tomcat/Catalina/localhost/examples.xml]
19-Jan-2018 14:37:39.769 INFO [localhost-startStop-4] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/etc/tomcat/Catalina/localhost/host-manager.xml]

19-Jan-2018 14:37:41.130 INFO [localhost-startStop-3] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/etc/tomcat/Catalina/localhost/manager.xml] has finished in [1,362] ms
19-Jan-2018 14:37:41.192 INFO [localhost-startStop-4] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/etc/tomcat/Catalina/localhost/host-manager.xml] has finished in [1,423] ms
19-Jan-2018 14:37:41.282 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/etc/tomcat/Catalina/localhost/examples.xml] has finished in [1,514] ms

```

Hummmm :confused: