Skip Menu |
 

This queue is for tickets about the HTTP-Body CPAN distribution.

Report information
The Basics
Id: 109584
Status: open
Priority: 0/
Queue: HTTP-Body

People
Owner: Nobody in particular
Requestors: zhurs [...] yandex.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments


Subject: new feature for HTTP::Body::OctetStream - use memory buffer instead temp file for small bodies
Date: Tue, 24 Nov 2015 19:11:46 +0300
To: bug-http-body [...] rt.cpan.org
From: Сергей Журавлёв <zhurs [...] yandex.ru>
Download (untitled) / with headers
text/plain 489b
Hello, We have json API, built using Plack, so every request have Content-Type: application/json. Plack uses HTTP::Body, that choose HTTP::Body::OctetStream for this type of requests, and create new temporary file for each request. It hurts performance of our service. So, I make patch, which uses PerlIO if body is small and File::Temp for big queries. Also it is possible to tune behaviour through shared variable MAX_BUFFER_SIZE. Please, consider to include patch into distribution.

Message body is not shown because sender requested not to inline it.

Download (untitled) / with headers
text/plain 1015b
On 2015-11-24 16:12:07, zhurs@yandex.ru wrote: [...] Show quoted text
> and create new temporary file for each request. > It hurts performance of our service. > > So, I make patch, which uses PerlIO if body is small and File::Temp > for big queries.
Hmm - I can see the appeal, but I'm not sure I really like the idea of the behaviour of what you get back differing depending on the size of the request - it sounds like a way to get weird, hard to debug problems. On the other hand, if we use IO::Handle::Utils::io_from_any() as I'm doing in the UrlEncoded handler, and we document that the body() method will return an IO::Handle-like object which can be read from to get the body content, but makes no promises on the specific type of handle, then calling code should be OK with it. I'll give this a little more thought and run it by others, but I certainly approve of being able to stop it writing temp files - both for performance, and to avoid potentially-sensitive request contents being (even temporarily) stored on disk.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.