• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Guru: Speed Up Web Pages Using Apache’s mod_deflate

    July 9, 2018 Alan Seiden

    If your web applications run on HTTP Server (Powered by Apache) for i, you can enable a powerful Apache extension, mod_deflate, to speed up your site. Just as zipping up files on your PC saves space and accelerates file transfers, mod_deflate “allows output from your server to be compressed before being sent to the client over the network.” (See https://httpd.apache.org/docs/2.4/mod/mod_deflate.html for more information.) My tests show a speed improvement of 10 to 50 percent.

    You can compress any text-based output, including HTML (whether plain .html files, output from RPG CGI programs, PHP, or other languages), Cascading Style Sheets (CSS), and Javascript (JS) — pretty much anything except compressed images and other binary formats.

    Content is compressed automatically, sent over the network to the browser as usual, and then automatically decompressed by the user’s browser. By default, the gzip compression protocol is used because most browsers support it.

    Follow these easy steps to enable mod_deflate.

    1. Edit the appropriate Apache instance configuration file. Its location will depend on your web server instance name. For example, if your Apache instance is named GURU, then the file is likely to be located at /www/guru/conf/httpd.conf. This is a simple text file, so you may choose from several editors: IBM’s HTTP Server Admin GUI at port 2001 (if *ADMIN is started), the WRKLNK/EDTF command, or your favorite text editor/.
    2. Add the following two directives to httpd.conf’s main section (pound signs are comments):
    # Load the extension that deflates (compresses) content
    LoadModule deflate_module /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.SRVPGM
    # Specify what content to compress (example: html, json, css, javascript)
    # Make sure this directive has no line breaks; it should fit on one line in your .conf file.
     AddOutputFilterByType DEFLATE application/x-httpd-php application/json text/css application/x-javascript application/javascript text/html
    
    1. Use the Start TPC/IP Server CL command to restart your Apache instance (in this case, “GURU”).
    STRTCPSVR SERVER(*HTTP) RESTART(*HTTP) HTTPSVR(GURU)
    

    If your site is public, you can type its URL into the box at https://checkgzipcompression.com/ to learn whether compression has been enabled, and how much bandwidth you saved. When I tested my site, seidengroup.com, I learned that compression was, indeed, enabled, reducing page size from 73,911 bytes to 15,171 bytes, quite a savings.

    If your site is not public, you can use your browser’s “developer tools” to check for compression. Instructions for Google Chrome’s browser are at https://www.conetix.com.au/support/article/how-to-check-gzip-is-enabled.

    Smart developers may ask whether the dynamic compression/decompression causes any performance penalty. In my experience, any minor slowdown from on-the-fly compression/decompression is far outweighed by the benefits of smaller file sizes. Compression algorithms have been optimized over the years to be very fast.  I say, therefore, compress first and ask questions later!

    Try mod_deflate on your IBM i-based sites (and other sites) and let us know your results.

    An IBM Champion and founder of Seiden Group, Alan Seiden leads a team that mentors clients in building APIs and web/mobile applications using open source, PHP, and IBM i business logic. Alan’s passion for the IBM i community inspires him to host the bi-annual CIO Summit and offer a free monthly tips newsletter.

    RELATED STORIES

    HTTP Server (Powered by Apache) for i

    Apache Module mod_deflate

    Check gzip Compression

    How to check gzip is enabled (Deflate)

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: Apache, CSS, FHG, Four Hundred Guru, HTTP Server, IBM i, JavaScript, JS, PHP, RPG CGI

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Four Hundred Monitor, July 9 VACAVA’s Low-Code Approach To Modernization

    One thought on “Guru: Speed Up Web Pages Using Apache’s mod_deflate”

    • Ted Holt says:
      January 27, 2025 at 11:34 am

      An update from Amanda:

      I wanted to try the Gzip Compressor tool you mentioned on your page here: itjungle.com/2018/07/09/guru-speed-up-web-pages-using-apaches-mod_deflate/, but the link appears to be broken (this tool: checkgzipcompression.com/). I checked, and it doesn’t work anymore, so I thought you’d want to know.

      While I’m at it, I’d like to suggest a working alternative that I recently found. It’s simple and free of ads, and I think it would be a good replacement for the broken one:

      https://www.websiteplanet.com/webtools/gzip-compression

      This tool allows you to compress Gzip quickly and easily at no cost. I hope this helps!

      Reply

    Leave a Reply Cancel reply

TFH Volume: 28 Issue: 45

This Issue Sponsored By

  • Profound Logic Software
  • COMMON
  • RPG & DB2 Summit
  • Computer Keyes
  • Manta Technologies

Table of Contents

  • Removing The Last Governor: Core Software Pricing
  • VACAVA’s Low-Code Approach To Modernization
  • Guru: Speed Up Web Pages Using Apache’s mod_deflate
  • Four Hundred Monitor, July 9
  • IBM i PTF Guide, Volume 20, Number 26

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle