akvo / akvo-rsr

Akvo Really Simple Reporting
http://rsr.akvo.org
GNU Affero General Public License v3.0
39 stars 20 forks source link

Bug: Excel and PDF reports are slow #4986

Open MichaelAkvo opened 2 years ago

MichaelAkvo commented 2 years ago

What were you doing?

What should've happened?

The PDF and excel should've been generated way more quickly, or at least done asynchronously (email with download link).

My environment

No response

Additional context

The endpoints called are:

MichaelAkvo commented 2 years ago

For the PDF endpoint, we could move to using headless chromium for printing. Here's a stackoverflow script that uses selenium.

There are multiple ways to do this:

One off call

This means starting Chromium every time a PDF has to be printed. It adds a few seconds to the call.

Persistent background process

A persistent headless Chromium could be run in the background.

Printing services

Chromium is run another container. With a small HTTP process that receives the link to the page to print, Chromium could then open a tab, print it, and the HTTP process would send the PDF back as a response.


To get this "just working" we could start with the "one off" function. It'll be slow than the service, but probably much faster than the current printing process.

MichaelAkvo commented 1 year ago

They are done asynchronously now, but it doesn't hurt to keep this open.