Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rachana gzip compression #1186

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open

Rachana gzip compression #1186

wants to merge 4 commits into from

Conversation

RachanaZha
Copy link

@RachanaZha RachanaZha commented Dec 20, 2024

Description

The website now includes gzip compression using the compression library. This middleware is configured to compress responses based on content type while considering streaming requirements and server load. Testers should verify that compression works correctly and evaluate overall server performance with and without compression enabled.

Related PRS (if any):

This backend PR is NOT related to any other PR

Main changes explained:

  1. Added "compression": "^1.7.5" in the package.json file to include the compression library.
  2. Integrated gzip compression in app.js using compression middleware. The configuration includes:
    • level: 6: Balanced compression level for performance and efficiency.
    • threshold: 0: Ensures all responses are compressed regardless of size.

These changes optimize response sizes to improve application performance and reduce bandwidth usage.

How to test:

Dont forget to npm install before building and running the application.

  1. Run the application on localhost.
  2. Before logging in, open the browser Developer Tools by pressing Ctrl + Shift + I.
  3. Switch to the Network tab in Developer Tools.
  4. Login to the application.
  5. Observe the requests appearing in the Network tab (e.g., {i} users or {i} login).
  6. Click on any request to inspect its details.
  7. Under the Headers tab, locate the Content-Encoding field. It should display "gzip", indicating compression is applied.

Screenshots or videos of changes:

zha_rachana_gzip_comp_testing_video.mp4

Note:

Include the information the reviewers need to know.

@RachanaZha RachanaZha changed the title Rachana gzip comp Rachana gzip compression Dec 21, 2024
@mashpotato9
Copy link

I've reviewed this pr and the compression middleware worked as expected
Screenshot 2024-12-28 at 1 01 47 PM
Screenshot 2024-12-28 at 12 58 03 PM
Screenshot 2024-12-28 at 12 57 45 PM

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Jan 3, 2025
Copy link

@kobakvantrishvili kobakvantrishvili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, the gzip Compression is applied. Not all Requests have gzip content encoding though, which I am not sure if it's supposed to be that way (please view the second image).

Screenshot 2025-01-06 232155 no

@one-community one-community added Do Not Review Do not review or look at code without full context Needs New Developer This is a PR that is partially developed but needs someone new to take it over and finish it. and removed High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible labels Jan 12, 2025
@one-community
Copy link
Member

Works as expected, the gzip Compression is applied. Not all Requests have gzip content encoding though, which I am not sure if it's supposed to be that way (please view the second image).

Screenshot 2025-01-06 232155 no

Good catch. All requests are supposed to have gzip compression. I'm opening this up for someone else to debug and check whats going wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Review Do not review or look at code without full context Needs New Developer This is a PR that is partially developed but needs someone new to take it over and finish it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants