large files etc

170 views
Skip to first unread message

mojon00b

unread,
May 26, 2012, 5:40:05 PM5/26/12
to Mojolicious
Starting out with a little prototype for internal enterprise web
services. Read the docs and can do basic rendering examples but how do
you, in a RESTful way I guess,
* download a large file to the client

* serve a delayed response to a client (like a result of a db query)
* maybe run some things on a server, while a client can pull job
status, and render results?


The first one is the most pressing, but if you can point me to
anything mojolicious on the other two bullets, I would also much
appreciate.

Виктор Турский

unread,
May 26, 2012, 6:00:35 PM5/26/12
to mojol...@googlegroups.com
2012/5/27 mojon00b <vitaly...@gmail.com>:
> * download a large file to the client
Maybe "Mojolicious::Plugin::RenderFile" (
https://metacpan.org/module/Mojolicious::Plugin::RenderFile ) will be
useful for this purpose.

--
Viktor Turskyi
http://webbylab.com
http://koorchik.blogspot.com

mojon00b

unread,
May 26, 2012, 6:06:18 PM5/26/12
to Mojolicious
Spasibo, Viktor, I'll try it out. I see also that in a prior
discussion sri points to Controller::render streaming example, I'll
try that too.



On May 26, 3:00 pm, Виктор Турский <koorc...@gmail.com> wrote:
> 2012/5/27 mojon00b <vitaly.kup...@gmail.com>:> * download a large file to the client
>
> Maybe "Mojolicious::Plugin::RenderFile" (https://metacpan.org/module/Mojolicious::Plugin::RenderFile) will be

Charlie Brady

unread,
May 29, 2012, 11:16:34 AM5/29/12
to mojol...@googlegroups.com

On Sun, 27 May 2012, �~Rик�~Bо�~@ Т�~C�~@�~Aкий wrote:

> 2012/5/27 mojon00b <vitaly...@gmail.com>:
> > * download a large file to the client
> Maybe "Mojolicious::Plugin::RenderFile" (
> https://metacpan.org/module/Mojolicious::Plugin::RenderFile ) will be
> useful for this purpose.

That does look interesting. Has anybody done something similar for reading
from another process (pipe)?

Benjamin Hitz

unread,
May 29, 2012, 1:37:55 PM5/29/12
to mojol...@googlegroups.com

>
> * serve a delayed response to a client (like a result of a db query)
> * maybe run some things on a server, while a client can pull job
> status, and render results?

I did implement something like this - but in reverse. client uploads a large file and it gets processed on server chunk by chunk and sent back to the client.

I am not extremely happy with it, and the tests aren't complete but it seems to work (uses fork)

https://github.com/hitz/RegulomeDB

Following on the discussion from last week, I thought it could be reimplmented with WebSockets using something like this:
http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Streaming_multipart_uploads

But there are two issues with that:
1) I wanted the client to be able to close the webserver and get the results later
2) Project is currently not funded, and hence somewhat deprioritized.

Ben


--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO Consortium
Stanford University ** hi...@stanford.edu




Siddhartha Basu

unread,
May 30, 2012, 12:08:55 PM5/30/12
to mojol...@googlegroups.com

For downloading large files particularly in prod Xsendfile could be a viable option.
You just need to activate the option(s) in your webserver(either of
apache or nginx), set the xsendfile header from your controller and
serve the response using Mojo::Asset::File module.

-siddhatha
> > --
> > You received this message because you are subscribed to the Google Groups "Mojolicious" group.
> > To post to this group, send email to mojol...@googlegroups.com.
> > To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
> > For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.
> >
Reply all
Reply to author
Forward
0 new messages