Prerequisites for enabling HTTP2
Applies to: Kyvos Enterprise Kyvos Cloud (SaaS on AWS) Kyvos AWS Marketplace
Kyvos Azure Marketplace  Kyvos GCP Marketplace Kyvos Single Node Installation (Kyvos SNI)
HTTP/2 (originally named HTTP/2.0) is a major revision of the HTTP network protocol used by the World Wide Web. It was derived from the earlier experimental SPDY protocol, originally developed by Google. HTTP/2 was developed by the HTTP Working Group (also called httpbis, where bis means "second") of the Internet Engineering Task Force (IETF). HTTP/2 is the first new version of HTTP since HTTP 1.1, which was standardized in RFC 2068 in 1997.
The key differences HTTP/2 has to HTTP/1.x are as follows:
It is binary, instead of textual
It is fully multiplexed instead of ordered and blocking
It can use one connection for parallelism
It uses header compression to reduce overhead
It allows Server Pushing to add responses proactively into the Browser cache.
Click here to read more about the above-mentioned points.
Setting up Tomcat native and APR
Configuring HTTP2 without APR doesn’t work when upgrading from org.apache.coyote.http11.Http11AprProtocol to HTTP2. It throws an error for APR Library.
If upgrading from org.apache.coyote.http11.Http11NioProtocol, it doesn’t work. It just serves over HTTP1.
After installing APR, all worked well with HTTP2. Hence, APR and Tomcat Native should be installed to use HTTP2.
References:
https://community.akamai.com/customers/s/article/Building-HTTP2-enabled-Apache-server?language=en_US
https://stackoverflow.com/questions/30855281/tomcat-support-for-http-2-0/37889873#37889873
APR (Apache Portable Runtime)
The Apache Portable Runtime (APR) is a supporting library for the Apache web server. It provides a set of APIs that map to the underlying operating system (OS), where the OS does not support a particular function, APR will provide an emulation. Thus, programmers can use the APR to make a program truly portable across platforms.
APR originally formed a part of Apache HTTP Server, but the Apache Software Foundation spun it off into a separate project. Other applications can use it to achieve platform independence.
The range of platform-independent functionality provided by APR includes:
Memory allocation and memory pool functionality
Atomic operations
Dynamic library handling
File I/O
Command-argument parsing
Locking
Hash tables and arrays
Mmap functionality
Network sockets and protocols
Thread, process, and mutex functionality
Shared memory functionality
Skip list functionality
Time routines
User and group ID services
For more details, please refer to the following:
Tomcat Native
The Apache Tomcat Native Library is an optional component for use with Apache Tomcat that allows Tomcat to use certain native resources for performance, compatibility, etc.
Specifically, the Apache Tomcat Native Library gives Tomcat access to the Apache Portable Runtime (APR) library's network connection (socket) implementation and random-number generator.
Click here for more details.
For Linux-based systems
Building, and Installing, and Using APR and Tomcat Native (some dependencies also).
# install dev tools for CentOS
Prerequisites:
yum install openssl-devel
yum groupinstall "Development Tools"
Inputs:
JDK version 1.8 as input
OpenSSL version >= 1.0.2
-----------------------------------------------------
# Download and Install APR
wget http://apachemirror.wuchna.com//apr/apr-1.7.0.tar.gz
tar -zxvf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure
make
make install
# The default installation path is /usr/local/apr
# Download and Install APR-util
wget http://apachemirror.wuchna.com//apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --with-apr=/usr/local/apr (#Location of apr library)
make
make install
# The default path of installation is /usr/local/apr/lib
# now go to CATALINA_HOME/bin and build tomcat-native library
# Install JNI Wrapper for APR used by Tomcat (libtcnative)
# JAVA_HOME environment variable should be set or use --with-java-home=/usr/java/jdk1.7.0_25 to build tomcat-native
cd $CATALINA_HOME/bin
tar -zxvf tomcat-native.tar.gz
cd tomcat-native-#.#.#-src/native
./configure --with-apr=/usr/local/apr
make
make install
NOTE:
1. For APR and APR-util, use the latest available installer from the https://apachemirror.wuchna.com/apr/apr-util-1.6.1.tar.gz website.
2. The APR-util is dependent on the expat libraries. If you do not have already, build and install the expat library. For this, download and install expat using the following steps. (read about Expat dependency of APR-UTIL, read here https://downloads.apache.org/apr/CHANGES-APR-UTIL-1.6)
wget https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.gz
tar -xvzf expat-2.2.9.tar.gz
cd expat-2.2.9
./configure
make
make install
3. ./configure of tomcat-native may throw error of Incompatible OpenSSL Version. So, to solve this. Just remove existing OpenSSL and install compatible version shown in the message.
APR will be installed on /usr/local/apr/lib path, say TCNATIVE_LIB_PATH.
Reference:
https://sheroz.com/pages/blog/installing-apache-tomcat-native-linux-ubuntu-1204.html
Copyright Kyvos, Inc. All rights reserved.