Spring Boot Embedded Tomcat Configuration

1
2
3
4
5
6
7
8
# HTTP Access Logging
application.properties
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.file-date-format=yyyy-MM-dd
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.suffix=.log
server.tomcat.accesslog.rotate=true

Remote Connection Properties

1
2
3
4
5
6
7
8
9
10
application.properties
server.connection-timeout=10s
server.max-http-header-size=8KB

server.tomcat.accept-count=100
server.tomcat.max-connections=10000
server.tomcat.max-threads=200
server.tomcat.min-spare-threads=10
server.tomcat.max-swallow-size=2MB
server.tomcat.max-http-post-size=2MB
  • server.connection-timeout

Time that connectors wait for another HTTP request before closing the connection. When not set, the connector’s container-specific default is used. Use a value of -1 to indicate infinite timeout.

  • server.max-http-header-size

Maximum size of the HTTP message header.

  • server.tomcat.accept-count

Maximum queue length for incoming connection requests when all possible request processing threads are in use.

  • server.tomcat.max-connections

Maximum number of connections that the server accepts and processes at any given time.

  • server.tomcat.max-threads

Maximum amount of worker threads in server under top load. In other words, maximum number of simultaneous requests that can be handled.

  • server.tomcat.min-spare-threads

The minimum number of threads always kept running. This includes both active and idle threads.

  • server.tomcat.max-swallow-size

The maximum number of request body bytes (excluding transfer encoding overhead) that will be swallowed by Tomcat for an aborted upload. An aborted upload is when Tomcat knows that the request body is going to be ignored but the client still sends it.
If Tomcat does not swallow the body the client is unlikely to see the response. If not specified the default of 2097152 (2 megabytes) will be used. A value of less than zero indicates that no limit should be enforced.

  • server.tomcat.max-http-post-size

Maximum size of the HTTP post content.

HTTP Access Logging

1
2
3
4
5
6
7
application.properties
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.file-date-format=yyyy-MM-dd
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.suffix=.log
server.tomcat.accesslog.rotate=true
  • server.tomcat.accesslog.enabled – Enable access logging or not.
  • server.tomcat.accesslog.directory – Directory in which log files are created. Can be absolute or relative to the Tomcat base dir.
  • server.tomcat.accesslog.file-date-format – Date format to place in the log file name.
  • server.tomcat.accesslog.prefix – Log file name prefix.
  • server.tomcat.accesslog.suffix – Log file name suffix.
  • server.tomcat.accesslog.rotate – Whether to enable access log rotation.

参考文章

评论