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

🎉 Need help with v3 alpha|beta testing #288

Closed
tarampampam opened this issue Jun 29, 2024 · 12 comments
Closed

🎉 Need help with v3 alpha|beta testing #288

tarampampam opened this issue Jun 29, 2024 · 12 comments
Assignees

Comments

@tarampampam
Copy link
Owner

tarampampam commented Jun 29, 2024

Hello everyone!

I've been working hard over the past few weeks on a major version of this project, and my work is nearly complete. The most important parts are done and ready to be tested. Please note that the following changes are not backward-compatible, which is why this is a major update:

  • The configuration file (error-pages.yml) is no longer needed. Everything is now configured using CLI flags and environment variables
  • The app is built with templates from this repository (they are built-in to the app binary file), and you can still use custom templates using the flag --add-template /path/to/your/tpl.htm
  • While most CLI flags and environment variables remain the same as in v2, some have changed. Please update your charts accordingly. For the latest information, check here. The README file is still in progress, but the CLI documentation is available
  • The error pages can now be accessed using the following URLs - /{code}, /{code}.html, and /{code}.htm. Additionally, you can use the flag --send-same-http-code to retain the same HTTP status code as the page, if needed
  • To override or append a custom code, you can do this using the flag --add-http-code="…" in the format %code%=%message%/%description%. Moreover, you can use "placeholder" codes like 4**, which means if the requested code is not described but is between 400 and 499, the provided message with its description will be returned. This approach is similar to the one used in the OpenAPI specification, where instead of describing each code individually, you can describe a pattern
  • The default content type for error pages is now PlainText. This means that when you curl an error page, you will receive more readable content without tons of HTML tags. This change should not cause any issues, but it may
  • I am still deciding on two things - whether to keep the fasthttp HTTP server or switch to the stdlib HTTP server, and whether to keep the templates caching mechanism used in v2. Currently, I have switched to the stdlib HTTP server (due to better support and built-in HTTP/2 support, though with lower performance - 40k RPS has dropped to 11k). I've also removed the caching mechanism, which should reduce memory consumption but may increase CPU load slightly. I haven't finalized these decisions yet, so please share your thoughts
  • The templates have been redesigned to be more responsive. A dark theme is now automatically applied if the user prefers it. Themes l7-dark and l7-light have been merged into a single l7 theme, and the matrix theme has been removed (because I created it and it wasn't very appealing)
  • The templates no longer download anything from the far-far galaxies - everything is now embedded, including the localization script, which is now inlined into the page. Additionally, custom fonts have been removed
  • The metrics endpoint /metrics has been not implemented yet, If someone found it useful and has used it - just tell me, and I'll re-implement it
  • I'll add any other important updates here later

I'm reaching out to see if anyone would like to assist with early testing of the app. I can provide early builds (Docker image tags) via messages in this thread. It would be fantastic if you could run them locally or on your staging cluster and provide feedback on whether everything is working smoothly or if you encounter any issues.

Please leave a comment to let me know if you're willing to help. Your assistance would be greatly appreciated!

/cc @deffcolony @moschlar @r2DoesInc @fuog @kfirfer @CodeAnthem @NicosKaralis @GoliathLabs @onedr0p @modem7 @ToshY

@tarampampam
Copy link
Owner Author

And yes - the first tag is ghcr.io/tarampampam/error-pages:3.0.0-alpha-1 😆

@tarampampam tarampampam pinned this issue Jun 29, 2024
@r2DoesInc
Copy link

r2DoesInc commented Jun 29, 2024 via email

@cathelijne
Copy link

cathelijne commented Jul 1, 2024

Used the alpha version on my internal ingress for a couple of days. No issues at all.

Configured an ingress to test error codes:

location /418 {
  return 418;
}

and so on, and it picked up all codes beautifully.

Text-only results for curl much appreciated!

Planning to test the drop-in templates with --add-template later, but it might be a few days before I come around to that.

Like the previous poster I love these error pages, I haven't looked back since I found them.

@tarampampam
Copy link
Owner Author

fasthttp is back! ghcr.io/tarampampam/error-pages:3.0.0-alpha-2

Note

RPS 11k → 18k

@r2DoesInc
Copy link

r2DoesInc commented Jul 1, 2024

@tarampampam You mentioned in #257 that this v3 update would work to resolve the issue described.

Is this something that is currently achievable or still in the works? I see the ability to override the json response, but I need to do so per request rather than at the serve level.

Ive not yet tried the update, hoping to get some time this week to start working on things again.

@tarampampam
Copy link
Owner Author

tarampampam commented Jul 2, 2024

After getting some sleep and rerunning the performance tests, I obtained some interesting results:

Version Description RPS Mem usage (under load / idle) Screen
2.27.0 fasthttp + templates caching 102k ~25MiB / ~20MiB v2-27-0
3.0.0-alpha-1 stdlib.http 25k ~53MiB / ~28MiB v3-a1
3.0.0-alpha-2 fasthttp + --read-buffer-size 5120 39k ~100MiB / ~93MiB v3-a2-5k
3.0.0-alpha-2 fasthttp + --read-buffer-size 5242880 # 5 MiB 45k ~2GiB v3-a2-5mb
3.0.0-alpha-3 fasthttps + templates caching + --log-level warn 122k 🔥 ~75MiB v3-a3

Note

To run performance tests the following command was used: wrk --timeout 1s -t12 -c400 -d30s -s ./test/wrk/request.lua http://127.0.0.1:8080/

Increasing the read-buffer-size significantly affects memory usage. Therefore, I have reinstated the CLI flag --read-buffer-size to allow for fine-tuning, instead of the previously hardcoded buffer size used for experiments 😆


I've encountered a bit of a challenge - in order to cache templates, I need to cache everything, including the results of functions like fetching current timestamps. With a cache TTL of 1 second, it's impossible to render timestamps with milliseconds or nanoseconds in the template (and this caching approach could potentially affect other aspects). In short, I'm facing a classic programming dilemma — cache invalidation. I'm still contemplating how best to resolve it


Update: I have implemented template caching for 900 milliseconds, and as expected, it boosted the RPS by approximately 220%. Since no issues have been reported for the previous versions, I will keep it.

The tag with template caching is ghcr.io/tarampampam/error-pages:3.0.0-alpha-3.

@tarampampam
Copy link
Owner Author

I've released the first beta version: v3.0.0-beta-1 (ghcr.io/tarampampam/error-pages:3.0.0-beta-1).

I'll wait a few days for testing. If you confirm that everything is okay and no issues are found, I'll go ahead and release a stable version. Does that sound good?

@tarampampam tarampampam self-assigned this Jul 3, 2024
@tarampampam tarampampam added the type:enhancement New feature or request label Jul 3, 2024
@deffcolony
Copy link

@tarampampam Does this include the support of my issue at #285 ?

@tarampampam
Copy link
Owner Author

tarampampam commented Jul 3, 2024

Does this include the support of my issue at #285 ?

Since there is no longer a config file - simply mount the HTML file with your template, set the --template-name to it, and that's it! This is why I closed your issue. If I've missed something, please let me know.

Note

I have updated the readme file:

error-pages/README.md

Lines 111 to 153 in b4e9ea5

<details>
<summary><strong>🚀 Start the HTTP server with my custom template (theme)</strong></summary>
First, create your own template file, for example `my-super-theme.html`:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ code }}</title>
</head>
<body>
<h1>YEAH! {{ message }}: {{ description }}</h1>
</body>
</html>
```
And simply start the server with the following command:
```bash
docker run --rm \
-v "$(pwd)/my-super-theme.html:/opt/my-template.html:ro" \
-p '8080:8080/tcp' ghcr.io/tarampampam/error-pages:3 \
serve --add-template /opt/my-template.html --template-name my-template
```
And test it:
```bash
$ curl -H "Accept: text/html" http://127.0.0.1:8080/503
<!DOCTYPE html>
<html lang="en">
<head>
<title>503</title>
</head>
<body>
<h1>YEAH! Service Unavailable: The server is temporarily overloading or down</h1>
</body>
</html>
```
</details>

@ToshY
Copy link
Contributor

ToshY commented Jul 3, 2024

Hey @tarampampam 👋

I have some questions looking through the (new) README. I have compose configs which still contain DEFAULT_HTTP_CODE (introduced in v2.3.0) and CATCH_ALL (introduced in v2.5.0) environment variables. I don't see a mention that they have been deprecated, removed or replaced by something else. Will they still be used in v3 or will they be replaced/removed entirely?

If that's clear to me, I can adjust my configs and start trying out the new v3 beta image too 👌

p.s.

Thank you for your continued hard work 🥇

@tarampampam
Copy link
Owner Author

tarampampam commented Jul 3, 2024

@ToshY I'm currently collecting all the changes in the first comment in #287, which will become the release description. This is why I haven't yet written an upgrade guide in the README file. Yes, those environment variables have been removed and are no longer needed. If you could share your experience upgrading from v2 to v3, I would greatly appreciate it, as it may help others have a smoother upgrade process!

p.s. TY for your help with testing!

@deffcolony

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants