Swazoo streaming (was Serving (big) files securely)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Swazoo streaming (was Serving (big) files securely)

Janko Mivšek-2
Hi guys,

You need to implement output streaming in Iliad to serve big files with Swazoo. Here is a general description:


AFAIK only Aida currently implements both input and output streaming, so you can add streaming to Iliad by studying Aida. Specially its FileProxy class. Some more interesting methods to look at:

FileProxy
 printWebPageFor:aRequest on:aSession
 printHTMLPageTo:aStream for:aRequest on:aSession
 streamFileToResponse: aHTTPStreamedResponse
 isRespondingStreamed

and:

AIDASite answer:aFileProxy toGetOrPost:aRequest on:aSession
 ...
 page := aFileProxy printWebPageFor:aRequest on:aSession
 ...
 page isRespondingStreamed ifTrue:
   [page printHTMLPageOn:nil "not needed" for:aRequest on:aSession
  ^aRequest streamedResponse]
 ...


Hope this helps
Janko



S, Göran Krampe piše:
> Hi!
>
> On 02/06/2012 11:36 AM, Jon Hancock wrote:
>> I've done something like this with nginx and ruby framework, Merb. Merb
>> has a tiny piece of code that (I think) sets a http header for nginx to
>> see, and then nginx handles the download.
>> I think you can also handle uploads with an nginx upload module.
>> The directory(s) where nginx reads/writes these files is not accessible
>> through a public url.
>>
>> Bottom line is, without regard to the language of your app server,
>> handling large files should not be its job.
>
> Of course a fair way to deal with it but:
>
>> On 02/06/2012 06:22 PM, Bernat Romagosa wrote:
>>> that the image doesn't grow huge. It seemed to work well enough for a
>>> while, but of course it is not an elegant or very well performing
>>> solution, files over 150Mb can't be uploaded and, sometimes, Swazoo
>>> freezes.
>
> I find this odd - me and Janko competed a while back on how to improve
> file upload speed (I implemented SocketStream and added support for
> "chunkwise reading" + KomHttpServer, and Janko using Swazoo IIRC) and we
> both ended up writing properly "writing on disk as it streams"
> implementations that easily handled 1Gb files without growing the image
> and without going slower.
>
> So you should definitely ask Janko. :)
>
> regards, Göran
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
Reply | Threaded
Open this post in threaded view
|

Re: Swazoo streaming (was Serving (big) files securely)

Bernat Romagosa
Hi Janko and all,

Great, I'm gonna try to implement this tomorrow!

Thanks a lot!

p.s. we've got to buy you guys some drinks at next ESUG, you're our salvation! ;)

2012/2/7 Janko Mivšek <[hidden email]>
Hi guys,

You need to implement output streaming in Iliad to serve big files with Swazoo. Here is a general description:


AFAIK only Aida currently implements both input and output streaming, so you can add streaming to Iliad by studying Aida. Specially its FileProxy class. Some more interesting methods to look at:

FileProxy
 printWebPageFor:aRequest on:aSession
 printHTMLPageTo:aStream for:aRequest on:aSession
 streamFileToResponse: aHTTPStreamedResponse
 isRespondingStreamed

and:

AIDASite answer:aFileProxy toGetOrPost:aRequest on:aSession
 ...
 page := aFileProxy printWebPageFor:aRequest on:aSession
 ...
 page isRespondingStreamed ifTrue:
   [page printHTMLPageOn:nil "not needed" for:aRequest on:aSession
  ^aRequest streamedResponse]
 ...


Hope this helps
Janko



S, Göran Krampe piše:
> Hi!
>
> On 02/06/2012 11:36 AM, Jon Hancock wrote:
>> I've done something like this with nginx and ruby framework, Merb. Merb
>> has a tiny piece of code that (I think) sets a http header for nginx to
>> see, and then nginx handles the download.
>> I think you can also handle uploads with an nginx upload module.
>> The directory(s) where nginx reads/writes these files is not accessible
>> through a public url.
>>
>> Bottom line is, without regard to the language of your app server,
>> handling large files should not be its job.
>
> Of course a fair way to deal with it but:
>
>> On 02/06/2012 06:22 PM, Bernat Romagosa wrote:
>>> that the image doesn't grow huge. It seemed to work well enough for a
>>> while, but of course it is not an elegant or very well performing
>>> solution, files over 150Mb can't be uploaded and, sometimes, Swazoo
>>> freezes.
>
> I find this odd - me and Janko competed a while back on how to improve
> file upload speed (I implemented SocketStream and added support for
> "chunkwise reading" + KomHttpServer, and Janko using Swazoo IIRC) and we
> both ended up writing properly "writing on disk as it streams"
> implementations that easily handled 1Gb files without growing the image
> and without going slower.
>
> So you should definitely ask Janko. :)
>
> regards, Göran
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565



--
Bernat Romagosa.