HP, JMeter, LoadRunner, Performance Testing, Testing, Tools

Brotli Compression in Performance Testing

Brotli Compression in Performance Testing Data compression plays paramount importance in web speed. GZIP is the most famous and widely used compression technique across WWW. Couple years ago Google conceived Brotli compression whole new lossless data compression alternative to gzip, deflate and zopfli. Apache JMeter 3.3 started supporting Brotli compression in its HTTP Sampler. This article focusses about brotli and how to validate brotli compression in performance testing.

What is Brotli?

Well, this is brötli. Google named after Swedish pastry. Brotli is an open source data compression library developed by Jyrki Alakuijala and Zoltán Szabadka. It is tailored based on Lz77 and Huffman coding.

Brotli weighs about 120 kb; it contains about 13K common words and phrases.

Brotli Compression in Performance Testing
Brotli

If the server implemented brotli compression, then the page will respond with the content-encoding as br.

Brotli Compression in Performance Testing
Brotli Compression in Performance Testing

Browser Support

All modern browsers support brotli compression. Chrome from version 49, Edge from version 15, Firefox from version 44 and so on. You can check the support matrix over here http://caniuse.com/#feat=brotli

Brotli Browser Support Matrix
Brotli Browser Support Matrix

Did you know? Brotli is written in C. It does has bindings for Java, Python, C# and Go.

How to enable brotli in Google Chrome?

Install the latest version of Chrome and visit chrome://flags/#enable-brotli. Select Enabled as shown below.

How to enable brotli in Google Chrome
How to enable brotli in Google Chrome

How to validate whether brotli supported or not?

Visit https://tools.keycdn.com/brotli-test and enter the website and hit Test.

Brotli Testing
Brotli Testing
Brotli Testing
Brotli Testing

How to validate Brotli in Apache JMeter 3.3?

In Apache JMeter 3.3, it is possible to test brotli compression. Follow the below steps to validate the brotli in the application under test.

  1. In the Thread Group, add a HTTP request and HTTP Header Manager
  2. In HTTP Request, enter the URL which needs to be validated.
  3. In HTTP Header Manager, add the following accept-encoding header as br as shown below.
Brotli in JMeter
Brotli in JMeter
  1. Add View Results Tree listener
  2. Save the test plan
  3. Click on Run button.

Once the run is successful, in View Results Tree, you can see the content-encoding as br

Brotli in JMeter
Brotli in JMeter

How to validate Brotli in Micro Focus LoadRunner?

Create a new Web HTTP/HTML script and paste the below code.

web_add_header(“accept-encoding”,

“gzip, deflate, br”);

web_set_sockets_option(“SSL_VERSION”,

“TLS1.2”);

web_url(“web_url”,

“URL=https://tools.keycdn.com“,

“TargetFrame=”,

“Resource=0“,

“Referer=”,

LAST);

Before you execute it, in Runtime Settings, enable the extended log to view the detailed log messages.

Once the run is successful, in the Output pane, you could see there will be a warning message for brotli, but in the response, you could still see the content-encoding as br.

Brotli in LoadRunner
Brotli in LoadRunner

Content Delivery Network started promoting HTTP/2 in their ad banner, sadly not many CDN supports brotli compression except keycdn.

Quick Comparison b/w gzip and br

Below is the difference between gzip and br performance for 1 request of the same URL. br performs better than gzip in terms of load time, size etc.

br
=====
Thread Name: Thread Group 1-1
Sample Start: 2017-10-05 23:10:22 CDT
Load time: 452
Connect Time: 369
Latency: 452
Size in bytes: 8990
Sent bytes:141
Headers size in bytes: 2722
Body size in bytes: 6268
Sample Count: 1
Error Count: 0
Data type (“text”|”bin”|””): text
Response code: 200
Response message: OK

gzip
=====
Thread Name: Thread Group 1-1
Sample Start: 2017-10-05 23:31:40 CDT
Load time: 977
Connect Time: 786
Latency: 969
Size in bytes: 10467
Sent bytes:143
Headers size in bytes: 2724
Body size in bytes: 7743
Sample Count: 1
Error Count: 0
Data type (“text”|”bin”|””): text
Response code: 200
Response message: OK

Did you know? If Google has brolti, Facebook has Zstandard.

Your turn: Is your test scripts has headers for brotli? In your next non-functional requirements, shout about brotli compression.

Once a week we send a digest with the most popular articles.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Performance Testing Jobs real quickClick here to apply now
+ +