[dev] WebDAV/CalDAV integration - first questions

Evert Pot evertpot at gmail.com
Sat Sep 26 00:10:00 UTC 2009


On 2009-09-25, at 5:41 PM, Chuck Hagenbuch wrote:

> Quoting Evert Pot <evertpot at gmail.com>:
>
>> Lastly, the entire response appears to be buffered and sent as a  
>> string from the default rpc.php. I'd like to avoid this and use php  
>> streams instead. This can be a big memory saver. I've been able to  
>> up/download up to 2GB files without triggering a memory_limit  
>> setting of 64MB.
>
> This would be fantastic. You might even look into using  
> Horde_Controller and putting stream support into the response  
> objects if we're rewriting things. Like Jan said probably not a  
> requirement though.
>

The biggest benefit for using streams, is that it's possible to reduce  
memory consumption. This helps in 2 areas:
   * files coming from the filesystem won't have to stay in memory
   * it's very easy to copy strings, which leads to a lot of duplicate  
strings in memory

I was very surprised how well PHP is suited for it though.. php://temp  
is great, it will keep a stream in memory if it's under 2 megs, and  
will switch to using temporary files if it exceeds that. I pretty much  
only use it in SabreDAV for GET and PUT requests, just to deal with  
large files.

If Horde_Controller only really deals with HTML, you probably trade in  
the minimal memory savings for I/O and CPU. I think the benefit of  
streams only starts at more than a few megs.

Evert


More information about the dev mailing list