contribsys / faktory

Language-agnostic persistent background job server
https://contribsys.com/faktory/
Other
5.66k stars 226 forks source link

Re-implement pages using html/template #463

Closed mperham closed 5 months ago

mperham commented 5 months ago

Faktory's webpages were originally implemented by copying Sidekiq's ERB templates and using Ben Johnson's EGO tool. This tool isn't really maintained so it is a security concern.

Now that the Web UI is very stable, this PR ports the pages to use Go's standard html/template library.

mperham commented 5 months ago

Sadly html/template seems to be a little slower and consume more memory.

EGO:

12016 KB RSS

I 2024-01-23T17:00:54.334Z GET / 2.552292ms
I 2024-01-23T17:00:56.326Z GET /busy 1.434875ms
I 2024-01-23T17:00:56.798Z GET /queues 1.3465ms
I 2024-01-23T17:00:57.430Z GET /retries 729.375µs
I 2024-01-23T17:00:58.025Z GET /scheduled 822.625µs
I 2024-01-23T17:00:58.695Z GET /morgue 1.538583ms
I 2024-01-23T17:00:59.949Z GET /queues 1.310833ms
I 2024-01-23T17:01:01.788Z GET /queues/default 2.303625ms
I 2024-01-23T17:01:03.159Z GET /morgue 1.241375ms
I 2024-01-23T17:01:03.903Z GET /scheduled 914.084µs
I 2024-01-23T17:01:04.978Z GET /queues 934.292µs
I 2024-01-23T17:01:06.022Z GET /busy 783.208µs
I 2024-01-23T17:01:07.992Z GET /morgue 2.009209ms
I 2024-01-23T17:01:09.063Z GET /morgue/2024-07-02T00:34:20.027960062Z|f214bfb1d3205e35 5.05125ms
I 2024-01-23T17:01:11.987Z GET /debug 13.243042ms

html/template:

17952 KB RSS

I 2024-01-23T17:04:44.402Z GET / 2.362833ms
I 2024-01-23T17:04:45.550Z GET /busy 1.861333ms
I 2024-01-23T17:04:46.331Z GET /queues 1.976667ms
I 2024-01-23T17:04:47.063Z GET /retries 1.496708ms
I 2024-01-23T17:04:47.746Z GET /scheduled 1.431875ms
I 2024-01-23T17:04:48.426Z GET /morgue 2.430375ms
I 2024-01-23T17:04:50.425Z GET /morgue/2024-07-02T00:34:20.027960062Z%7cf214bfb1d3205e35 2.05325ms
I 2024-01-23T17:04:53.011Z GET /queues 2.891375ms
I 2024-01-23T17:04:54.412Z GET /queues/default 4.750833ms
I 2024-01-23T17:04:56.901Z GET /debug 24.531375ms
mperham commented 5 months ago

It just keeps getting worse. Binary size:

html/template: 7,772,424 ego: 5,566,340

mperham commented 5 months ago

I suspect including the html/template package requires many extra megabytes in the built binary. I don't like this.

mperham commented 5 months ago

macOS binary

EGO: 9,865,154 html/template: 15,135,826

I can't justify a 50% increase in memory and binary size. We'll stick with EGO until someone can show me a good reason to stop using it.