How to optimize the app performances

by Michela Frigerio
418 views Published on Feb 16, 2023
Applies to: 9.0 or higher
Table of contents

Introduction

When deploying an application is important to apply all known best practice to get the best performance possible. WebRatio Platform simplifies this task generating a release artifact that is optimized for production. However there are some best practice related to the execution environment that can improve the performances even better. This how to reports some interesting guidelines about performances.

Enable HTTP/2 Protocol

If you directly serve the content to the browser then enabling HTTP/2 can drastically reduce the application load time and overall improve the performance. HTTP/2 (originally named HTTP/2.0) is a major revision of the HTTP network protocol used by the World Wide Web. You can find detailed information here.

Tomcat Configuration

Before starting, make sure you have completed the following prerequisites:

  • Full HTTP2 support is added to the latest version of Tomcat 9.x. Please download Tomcat 9 from here.

  • Tomcat must be secured with SSL/TLS certificate before implementing HTTP2. If you need help with the implementation, then check out this guide.

The configuration of HTTP/2 requires to edit the "server.xml" file stored in the "conf" directory of the Tomcat installation directory. Please open that file and edit the SSL Connector element adding the following

<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />

Save the file and restart the Tomcat. In the console you should see the following line, which confirms the enabling of the HTTP/2 protocol

24-Mar-2022 10:00:00.559 INFO [main] org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol The ["https-openssl-apr-443"] connector has been configured to support negotiation to [h2] via ALPN

You can test whether Tomcat is serving requests using HTTP/2 protocol with a browser. Let’s suppose to use Google Chrome. You just need to do the following:

  • Launch Google Chrome

  • Open Developer Tools by pressing F12

  • Go to the network tab

  • Verify that the "Protocol" column is available, otherwise add it right clicking on one column and select it from the list.

  • Access your Tomcat application and pay attention to the "Protocol" column, which must report h2