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

Compress the HTML content #62

Open
redakker opened this issue Nov 25, 2023 · 2 comments
Open

Compress the HTML content #62

redakker opened this issue Nov 25, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@redakker
Copy link
Owner

redakker commented Nov 25, 2023

Change to code to serve gzipped content to the browser

  • change the webserver
  • change the pre-build script which prepares the HTML for the C++ code

It will save some space on the ESP device and probably the web serving will be faster.

@redakker redakker changed the title Gzip the HTML content Compress the HTML content Nov 25, 2023
@redakker redakker added the enhancement New feature or request label Nov 27, 2023
@BalazsM
Copy link
Contributor

BalazsM commented Dec 27, 2023

I profiled the site loading network trafic, and found that the full reload time is above 2000ms. Which breaks up like this:

  1. 16,6% (332 ms) is building up TCP sockets
  2. 29.35% (587ms) is waiting for response
  3. 20.05% (401ms) is content delivery
  4. 34% (680ms) is doing nothing

The most of the loading time (4th point) is came from functions.js line 382-401 where are setTimeouts to load data, css files and chip info. When I removed these setTimeouts to load files instantly and moved css files into big one, the load time dropped under 1000ms, because waits were removed, and 2 of 9 TCP socket build up are also removed. But, an issue camed up: sometimes the webserver did not provide content (ex: css file is empty)!

I will improve pre_build_web.py to minify further css files (ex: remove comments, line endings) and place into one. With this modificítion we can move loading around 1000-1500ms, becouse removing 3 of 5 setTimeouts and TCP socket build ups.

I found an another issue, but don't know yet where it came from: sometimes content delivery pauses for seconds. With detailed logging I will investigate which function is locking in loop().

I think we need a better webserver implementation, which can do at least one of these:

  • can handle multiple queries in order without problems
  • can handle multiple queries in same time (not multithreaded, just finite state machine driven)
  • can reuse TCP socket

@redakker
Copy link
Owner Author

@BalazsM
Thanks for your effort!
Yes, your points make sense.
The timeouts were implemented to mitigate the heavy load of the chip. Sometimes stuck because of "big data" even if that is a very small HTML page.
All improvements are appreciated.

I profiled the site loading network trafic, and found that the full reload time is above 2000ms. Which breaks up like this:

  1. 16,6% (332 ms) is building up TCP sockets
  2. 29.35% (587ms) is waiting for response
  3. 20.05% (401ms) is content delivery
  4. 34% (680ms) is doing nothing

The most of the loading time (4th point) is came from functions.js line 382-401 where are setTimeouts to load data, css files and chip info. When I removed these setTimeouts to load files instantly and moved css files into big one, the load time dropped under 1000ms, because waits were removed, and 2 of 9 TCP socket build up are also removed. But, an issue camed up: sometimes the webserver did not provide content (ex: css file is empty)!

I will improve pre_build_web.py to minify further css files (ex: remove comments, line endings) and place into one. With this modificítion we can move loading around 1000-1500ms, becouse removing 3 of 5 setTimeouts and TCP socket build ups.

I found an another issue, but don't know yet where it came from: sometimes content delivery pauses for seconds. With detailed logging I will investigate which function is locking in loop().

I think we need a better webserver implementation, which can do at least one of these:

  • can handle multiple queries in order without problems
  • can handle multiple queries in same time (not multithreaded, just finite state machine driven)
  • can reuse TCP socket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants