[Dancer-users] recommended way to return large dynamic data?

sawyer x xsawyerx at gmail.com
Wed Oct 17 23:20:39 BST 2012


Nice! :)

On Wed, Oct 17, 2012 at 11:48 PM, Assaf Gordon <gordon at cshl.edu> wrote:

> sawyer x wrote, On 10/17/2012 04:10 PM:
> > On Wed, Oct 17, 2012 at 10:02 PM, Assaf Gordon <gordon at cshl.edu <mailto:
> gordon at cshl.edu>> wrote:
> >
> >
> >     Several people suggested "send_file" (on and off the mailing list),
> >     but from what I gathered, "send_file" requires either a physical
> file (which I don't have),
> >     or a scalar-ref containing the entire buffer to be sent (which I
> don't have).
> >
> >     I couldn't find a working example of using "send_file" while
> dynamically generating the output.
> >
> >
> > True. This is not really supported well in Dancer. The stream support
> was added for streaming an actual file. The fact that we can fake files
> from in-memory scalars is just an added benefit. :)
> >
>
> Got it to work. Thanks to everyone who helped.
>
> See a working demo here:
>  http://cowbell.cancan.cshl.edu/dispatch.cgi/dynamic_content
>
> and the code here:
>
> https://github.com/agordon/dancer_bootstrap_fontawesome_template/blob/master/lib/examples/dynamic_content.pm
>
> Hope this will save some time for other people.
>
> >
> >     Also, I'm using apache as a front-end, and I'm not sure about the
> "streaming" capabilities of the apache/psgi/plack/dancer stack in this
> situation - would it work ?
> >
> >
> > I'm not sure. I know that almost no servers (including Apache) support
> non-buffered file uploads, for example, so even if Dancer supports it (and
> it will), the servers will buffer it completely for you. I'm not sure how
> it is on downloads though.
>
> From preliminary testing, it seems Apache doesn't buffer the data before
> sending it to the client.
> I was able to generate and transmit 1GB of data without either HTTPD or
> Perl consuming more memory than usual.
>
> -gordon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20121018/54a9867a/attachment.htm>


More information about the dancer-users mailing list