问题
I'm using Spring boot 1.5.8 with Embedded tomcat and Thymeleaf for the view. The problem is that from time to time when some request is sent, the tomcat is blocked and process the request too long time ~10 -~15 sec. From the log file, i saw that this delay comes from org.apache.catalina.connector.RequestFacade.
2017-12-07 08:36:34.005 TRACE 15354 --- [https-jsse-nio-8443-exec-8] ationConfigEmbeddedWebApplicationContext : Publishing event in org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1c6b6478: ServletRequestHandledEvent: url=[/tiles/add]; client=[IP]; method=[GET]; servlet=[dispatcherServlet]; session=[32AC651D46CA6EC730F651BBC9F9B573]; user=[admin]; time=[9ms]; status=[OK]
2017-12-07 08:36:34.005 DEBUG 15354 --- [https-jsse-nio-8443-exec-8] o.s.b.w.f.OrderedRequestContextFilter : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@7de5a5db
2017-12-07 08:36:34.682 DEBUG 15354 --- [https-jsse-nio-8443-exec-13] o.s.b.w.f.OrderedRequestContextFilter : Bound request context to thread: org.apache.catalina.connector.RequestFacade@7de5a5db
2017-12-07 08:36:43.796 TRACE 15354 --- [https-jsse-nio-8443-exec-13] o.t.TemplateEngine : [THYMELEAF][https-jsse-nio-8443-exec-13] STARTING PROCESS OF TEMPLATE "tile/add" WITH LOCALE en_US
As you can see, the first line is when the first request is finished, and when the new request is bound to the thread in the third line. The time between third and fourth row is ~10 seconds. When thymeleaf starts to process the view.
来源:https://stackoverflow.com/questions/47689278/embedded-tomcat-slow-process-the-requests-spring-boot