Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 1 year has passed since last update.

Build a High Loads Tomcat Environment

Posted at

What is "simultaneous connection" in the WEB system?

The term "simultaneous connections" is often used in web system development, but it is often misused without a clear definition. This time, I will try to create a strict definition by including some related terms.

Item Explanation
Maximum number of logged-in users After logging in, session information is created and takes up a certain amount of memory. Depending on the method of the system, if the session memory is large, you should be careful about the number of users who log in within the session timeout period.
Maximum number of simultaneous connections A TCP connection is considered to be "connected" from "Established" to "Closed". The number of connections that are open at any given time is the number of concurrent connections. Two connections occur with a single screen operation. ※JSP and various static contents. After the output is completed, the connection will be maintained for 15 seconds.

If you exceed the maximum number of simultaneous connections, the server will not accept connection requests and you will receive a "This site cannot be accessed" error. ※This is not 404.

Maximum number of concurrent executions Number of requests that the server can handle simultaneously.
< In the case of a good start > ※Exhibitions, information sessions, seminars, etc.
Only one operation at a time Possible number of people who can operate without error = maximum number of simultaneous connections / 2
Continuously operate once per second ※Light processing within 1 second, Possible number of people who can operate without error = maximum number of simultaneous connections / 2/15
Continuously operate once per second ※Heavy processing、 Possible number of people who can operate without error = min (maximum number of concurrent executions, maximum number of concurrent connections/2/15)

System Conceptual Diagram

The system conceptual diagram below is an example of various setting information when supporting high load with efw application + tomcat.
image.png

Item Default Explanation
ListenBackLog Window32/64: 200
Solaris32/64,Linux32/64: 511
Maximum number of connection waiting queues for queuing requests with established TCP connections Specified range for the maximum number of connection queues. Window32/64: 1~200 Solaris32/64,Linux32/64: 1~2147483647
MaxClients 256 Number of simultaneous requests that can be answered.
ServerLimit 256 Set the maximum value that can be set for MaxClients while the Apache process is running, and there is a limit of 20000 or less.
maxConnections NIO: 10000
NIO2: 10000
APR/Native: 8192
Maximum number of connections that the server will accept and process at any given time. Setting the value to -1 disables the maxConnections feature and does not count connections.
acceptCount 100 Maximum queue length for incoming connection requests when all possible request processing threads are used. Requests received when the queue is full are rejected.
maxthreads 200 The maximum number of threads (maximum concurrency) that this connector will create for request processing. A Connector attribute that does not specify an Executor attribute constitutes a thread pool. The maximum number of threads that the thread pool will actually process requests from the waiting queue.

Setting Location

image.png

image.png

System Conceptual Diagram Explanation

If there are a large number of connections from clients,

  • First store it in Apache's ListenBacklog queue and pass 1000 connections in it to Tomcat.
  • Tomcat receives connection requests and stores them in the Connection queue.
  • Route 100 connections from the Connection queue to the Accept queue for processing.
  • Fill up any empty space in the Connection queue with subsequent connection requests.
  • Match the MaxClients and maxConnections values to avoid exceeding the maximum Connection queue.
    When processing connection requests in the Connection queue using the EFW framework,
  • Configure concurrent processing queues for each event for heavy processing. Returns an error when the queue maximum is reached.
  • Do not set concurrent processing queues for light processing.

There are two types of event queue maximum value reaching errors.

  • If set to allow retry, an error message will be displayed and a 30 second countdown will occur.
  • If you set it to not allow retry, just display an error message.
    "The function in question is busy. Please wait for a while."

ListenBackLog queue over

image.png

If you perform a new operation when the server connection is full, the error message shown on the left will be displayed.

Event queue over (retry possible)

image.png

When heavy operations reach a limit, the countdown message shown on the left will be displayed (30 seconds total). Retry possible.

Event queue over (retry not possible)

image.png
When operations become restricted, the congestion message shown on the left will be displayed. Retry not possible.

0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?