1

Preamble

Inspired by the presentation by Barret Schloerke at studio::global(2021) (I will add the link as soon as it becomes available), I tried to implement an app to see the differences between using {future}, {plumber}, both or none into a Shiny app running a sequence of fast-slow-slow-fast computations (both on distinct output and in a sequence within the same one).

Gist

You can find here my attempt, including the app.R Shiny app and the plumber.R APIs.

Results

execution selected (5 s for "slow") result expectation comments
Standard run ~20 seconds before anything appear, next everything appears in the same moment ~20 seconds, appearing sequentially somehow Why did not appear sequentially?
{future} only ~5 seconds before anything appear, next everything appears in the same moment ~20 with "first fast" and "second fast" appearing almost immediatly and next (~5) "first slow" or "second slow," next (~10) the other, and finally (~20) "Sequential") I would expect that something similar to what happened here for the combined type of run... how is possible that "sequential" completed in 5 seconds???
{plumber} only same as the standard run (r should remain busy until each API call would be resolved, right?) same time (~20) but appearing sequentially some how why shiny rendered everything the same time?
{future} and {plumber} same as the standard run I do not expect this at all!, What I expected here is to have "_fast"s appearing immediately, "_slow"s quite the same time after ~5 seconds, and "sequential" after ~10 seconds from the start (i.e., ~10 seconds overall) I am totally confused here :-(

Doubts

One of the main things I did not understand is why when activating {future} (both with or without {plumber}), "first fast" does not appear immediately. And in general, why the output does not appear in a single sequence when {future} is not involved. And how is it possible that with {future} alone, "sequential" stay ~5 seconds?

So, clearly, I made something the wrong way, and I do not understand something correctly.

Questions

Can someone help me understand where/what (and maybe try to infer "why") I made the app wrong, and/or the API wrong, or their interaction wrong?

Thank you, Corrado.

Corrado
  • 625
  • 6
  • 12
  • I have added an additional (second) version of app and API including `{future}` into the API. It does not change from the first version. – Corrado Jan 22 '21 at 20:22
  • from first glance, I see that you did something a bit differently. in the presentation, the code inside the plumber expression was wrapped in a future. What you did is wrap the call to the plumber Api into a future, I do not think it is the same. – Bruno Tremblay Jan 23 '21 at 02:12
  • I think of that, and created the second version of both the files, but things doesn't change. – Corrado Jan 24 '21 at 15:37
  • 1
    @Corrado could we use plumber and shiny together, if yes could you send me a link for the app or git repo and user documentation which really helps me alot – Arun kumar mahesh Dec 13 '21 at 07:37

0 Answers0