34
$\begingroup$

Note: I originally thought to post this as a non-answer/extended comment to this question; however I feared that I would end up hijacking the original question. It is likely a duplicate with the exception that a specific example is provided.

With the effective death of the Wolfram CDF plugin, I am looking for alternatives to provide interactive (mainly through Manipulate) content on my website. As an example, I would like to deploy m = Manipulate[Plot[Sin[a x], {x, 0, 10}], {a, 1, 10}]. I'm currently using a free Wolfram Cloud account, which provides me with 12000 cloud credits per month. I watch those cloud credits with a simple dynamic plot:

$cca = Association[];
ccatask = CreateScheduledTask[$cca[Now] = $CloudCreditsAvailable, 5];
StartScheduledTask@ccatask;
Dynamic@DateListPlot@$cca

I created the CloudObject and the appropriate embed code with:

m = Manipulate[Plot[Sin[a x], {x, 0, 10}], {a, 1, 10}]
cd = CloudDeploy[m, Permissions -> "Public"]
EmbedCode[cd]

Over the course of approximately 4 minutes of testing this rather trivial interactive object, my $CloudCreditsAvailable dropped about 150 points.

enter image description here

Below is a "real time" animated gif showing the responsiveness of this Manipulate when run in animation mode alongside a plot counting my cloud credits.

enter image description here

The responsiveness of the deployed object is clearly terrible, and it appears that I am charged credits for each time a new value of the Manipulate iterator is passed to the cloud. Assuming that the responsiveness were acceptable, there is little chance that a deployed object with meaningful calculations even slightly more complex than this toy code would be usable by more than a few visitors to my website before my cloud credits were exhausted.

Question 1. What are some general guidelines for constructing efficient (in terms of cloud credits) interactive content deployed via the cloud?

Question 2. Since the lack of a plugin necessitates (at least as of right now) that computations be performed server-side, what are some design choices that can be implemented to reduce the need to contact the server and thereby improve responsiveness?

$\endgroup$
9
  • 8
    $\begingroup$ If the user push the button Play of the Manipulate object, then your CloudCredit will automatically go down endless (!) $\endgroup$
    – andre314
    Mar 6, 2016 at 19:04
  • 3
    $\begingroup$ Probably the best is to talk to WRI and tell them you are an enthousiast and making kids aware of science and Mathematica and you should get a million cloud credits for free from them. Or you ask for a private cloud. $\endgroup$ Mar 6, 2016 at 19:27
  • 1
    $\begingroup$ @flip I'm hoping - I was making some significant progress in developing effective web-based teaching tools using CDFs. I recognize that functionality isn't likely to return, and i'd like WRI to (a) provide us with a long-term framework for educational tool development and (b) some guidance on how they think it can be implemented effectively. $\endgroup$ Mar 6, 2016 at 21:37
  • 2
    $\begingroup$ Precisely. I've mentioned this bit to some friends at WRI (and I see a few occasionally chiming in here and there :) It's something that seems like it's got to be fixed somewhere. On another note, bokeh for Python seems to be able to do lots of this stuff pretty well... so we know that it's possible. $\endgroup$
    – flip
    Mar 8, 2016 at 11:31
  • 2
    $\begingroup$ I've been thinking about ways around this. One possibility: you get a few thousand credits per account when it's made, you can make like 10 accounts with 10 Gmails, deploy 10 versions of the same thing (just write a function that switches accounts and deploys), deploy one APIFunction that randomly picks an account to HTTPRedirect to. It's a bad solution, of course, but it could be automated and fix part of the problem. Of course Manipulate crushes your credits so fast I don't think it'll help you here... I tend to just auto-export Manipulate to GIF. $\endgroup$
    – b3m2a1
    Sep 1, 2017 at 2:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.