Tomcat optimization summary

Tomcat supports three processing methods for receiving requests : BIO, NIO, and APR.

1. BIO needs to create a thread to process each request, the thread overhead is relatively large, and the performance is also the lowest in scenarios where high concurrency cannot be achieved.
2. NIO is a buffer-based Java API that provides non-blocking I/O operations with better concurrent performance than traditional bio .
3. APR (Apache Portable Run-time libraries) is simple to understand, it is to solve the asynchronous IO problem from the operating system level, greatly improve the processing and response performance of the server, and it is also the preferred mode for Tomcat to run high-concurrency applications

The main functional modules provided by APR include: memory allocation and memory pools, atomic operations, file I/O, locks, memory mapping, hash tables, network I/O, polling, process and thread operations, etc. The list of all modules can be For details, see:

http://apr.apache.org/docs/apr/1.5/modules.html

By using APR, Tomcat can obtain high scalability and superior performance, and can better integrate with local server technology, so that Tomcat can be used as a general-purpose web server, not just as a lightweight application server . In this case, Java will no longer be a backend-focused programming language, but can also be used more as a full-fledged web server platform.

When Tomcat starts, it will automatically detect whether APR is installed in the system. If it is installed, APR will be automatically used for I/O processing (unless the protocol attribute of Connector is specified as a specific protocol class).

 

See the official introduction to APR: https://tomcat.apache.org/tomcat-9.0-doc/apr.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325073961&siteId=291194637