We are using new relic to monitor tomcat threads. The graph shows increase of thread count,but it never decreased even the application is idle. We noticed that when it increase CPU also increased and CPU got reduced when application is idle. But tomcat threads are not reduced. Is it expected or how to bring the thread count ?
To answer your question, it depends on how you've configured Tomcat. It'll use a pool of threads to process your requests and that pool can shrink. See the minSpareThreads and maxIdleTime of the Executor object.
If you're not using an Executor and are relying on the default pool created by the connector you have less control. You can set minSpareThreads, but not maxIdleTime. If you're not using an executor, switching is easy. Just create one in your configuration (i.e. server.xml) and set the executor attribute on your connector. The default server.xml has an example, although it's commented out.
Beyond that, it's worth mentioning that other things in the JVM can be creating threads. I don't know specifically what you're monitoring, if it's all threads in the JVM or just the ones Tomcat is using to handle requests, but your applications and libraries used by those applications may be causing the problem. If you're seeing unbounded thread growth, you should take some thread dumps and see exactly what threads are being created. It may not be Tomcat that is creating these threads.