<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: PHP Libraries Hate Ram</title> <atom:link href="http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/feed/" rel="self" type="application/rss+xml" /><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/</link> <description>Living in a state of accord.</description> <lastBuildDate>Tue, 07 Feb 2012 01:07:58 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174074</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Tue, 26 May 2009 08:38:39 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174074</guid> <description>Yeah, I&#039;ve read the docs on the stream support, it&#039;s pretty good, but as you mentioned a lot of stuff doesn&#039;t use it which makes it far less useful. The Java stream stuff is long winded (moreso than the php stuff) but because it&#039;s been there from day one and most of the Java libraries were developed purely in Java rather than using existing C libraries, it&#039;s very comprehensively used.
Such is life.</description> <content:encoded><![CDATA[<p>Yeah, I&#8217;ve read the docs on the stream support, it&#8217;s pretty good, but as you mentioned a lot of stuff doesn&#8217;t use it which makes it far less useful. The Java stream stuff is long winded (moreso than the php stuff) but because it&#8217;s been there from day one and most of the Java libraries were developed purely in Java rather than using existing C libraries, it&#8217;s very comprehensively used.</p><p>Such is life.</p> ]]></content:encoded> </item> <item><title>By: Pierre</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174073</link> <dc:creator>Pierre</dc:creator> <pubDate>Tue, 26 May 2009 08:26:40 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174073</guid> <description>Right Jon, that was my thoughts too.
About php having no clue about stream, I think you should really consider to actually read the docs about the stream API in PHP (userland or internals). It is one of the most powerful out there. The problem is that some extensions do not rely on it (due to the underlying libraries for example), but the stream API itself in PHP is great, try it.</description> <content:encoded><![CDATA[<p>Right Jon, that was my thoughts too.</p><p>About php having no clue about stream, I think you should really consider to actually read the docs about the stream API in PHP (userland or internals). It is one of the most powerful out there. The problem is that some extensions do not rely on it (due to the underlying libraries for example), but the stream API itself in PHP is great, try it.</p> ]]></content:encoded> </item> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174072</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Mon, 25 May 2009 20:40:39 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174072</guid> <description>Ah good point Jon.  I hadn&#039;t thought about the lack of a known content length for the browser&#039;s progress bar.  That makes me feel better about having to use temporary files. The zip files that are created are just thrown out once the download finishes in this case, since they&#039;re fairly highly customised.  Depending on traffic/load we can always investigate a caching layer to keep them around for longer.</description> <content:encoded><![CDATA[<p>Ah good point Jon.  I hadn&#8217;t thought about the lack of a known content length for the browser&#8217;s progress bar.  That makes me feel better about having to use temporary files. The zip files that are created are just thrown out once the download finishes in this case, since they&#8217;re fairly highly customised.  Depending on traffic/load we can always investigate a caching layer to keep them around for longer.</p> ]]></content:encoded> </item> <item><title>By: Jon</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174071</link> <dc:creator>Jon</dc:creator> <pubDate>Mon, 25 May 2009 20:11:17 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174071</guid> <description>I have a lot of experience with this problem because the company I work for (Kink.com) offers .zip file downloads of all of our content. The issue is that it nearly impossible (ie: not reliable) to create a reliable streaming option for zip files because it is nearly impossible to know the final length of the file before the entire file has been created. The zip specification is crappy in this regard. The reason you need this information is that you need to be able to set the Content-Length: header so that downloads don&#039;t look like they are unlimited in the browser download window. People like to have an idea of when a download will complete.
I tried implementing a dynamic streaming solution in PHP, Python and Java. PHP and Python have no clue about streaming (which you figured out already). They love to hold data in memory which is terrible for trying to create a large scale concurrent streaming system. Java does streaming really well, but it is impossible to know the total length of the resulting file until after it is created. On top of it, each file tends to get created with random sizes (even without compression), so you can&#039;t cache this data anywhere.
We ended up punting on all of this and just create and cache the entire zip files. They get copied out to our CDN with the rest of our video/picture data. It doubled our storage requirements, but what&#039;s a few extra TB these days. =)</description> <content:encoded><![CDATA[<p>I have a lot of experience with this problem because the company I work for (Kink.com) offers .zip file downloads of all of our content. The issue is that it nearly impossible (ie: not reliable) to create a reliable streaming option for zip files because it is nearly impossible to know the final length of the file before the entire file has been created. The zip specification is crappy in this regard. The reason you need this information is that you need to be able to set the Content-Length: header so that downloads don&#8217;t look like they are unlimited in the browser download window. People like to have an idea of when a download will complete.</p><p>I tried implementing a dynamic streaming solution in PHP, Python and Java. PHP and Python have no clue about streaming (which you figured out already). They love to hold data in memory which is terrible for trying to create a large scale concurrent streaming system. Java does streaming really well, but it is impossible to know the total length of the resulting file until after it is created. On top of it, each file tends to get created with random sizes (even without compression), so you can&#8217;t cache this data anywhere.</p><p>We ended up punting on all of this and just create and cache the entire zip files. They get copied out to our CDN with the rest of our video/picture data. It doubled our storage requirements, but what&#8217;s a few extra TB these days. =)</p> ]]></content:encoded> </item> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174068</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Mon, 25 May 2009 12:32:15 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174068</guid> <description>True, I don&#039;t know why I was thinking PHP was GPL....</description> <content:encoded><![CDATA[<p>True, I don&#8217;t know why I was thinking PHP was GPL&#8230;.</p> ]]></content:encoded> </item> <item><title>By: Pierre</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174067</link> <dc:creator>Pierre</dc:creator> <pubDate>Mon, 25 May 2009 12:21:34 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174067</guid> <description>oh, I won&#039;t read the sources but see how it works from a runtime pov. PHP license is not GPL compatible so I won&#039;t taint my code with some possible GPL code (lawers--) :)</description> <content:encoded><![CDATA[<p>oh, I won&#8217;t read the sources but see how it works from a runtime pov. PHP license is not GPL compatible so I won&#8217;t taint my code with some possible GPL code (lawers&#8211;) :)</p> ]]></content:encoded> </item> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174066</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Mon, 25 May 2009 12:19:48 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174066</guid> <description>Cool.  The OpenJDK project provides the Java source code under GPL license so that&#039;s probably your best bet.  It&#039;s also included with the JDK download, but under a proprietary license which at least in the past had some pretty overbearing clauses about tainting etc.  Not sure if that got cleaned up at some point, but OpenJDK is a safe bet anyway.</description> <content:encoded><![CDATA[<p>Cool.  The OpenJDK project provides the Java source code under GPL license so that&#8217;s probably your best bet.  It&#8217;s also included with the JDK download, but under a proprietary license which at least in the past had some pretty overbearing clauses about tainting etc.  Not sure if that got cleaned up at some point, but OpenJDK is a safe bet anyway.</p> ]]></content:encoded> </item> <item><title>By: Pierre</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174065</link> <dc:creator>Pierre</dc:creator> <pubDate>Mon, 25 May 2009 12:05:13 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174065</guid> <description>Interesting, I&#039;d to take a look and see if I can add this kind of features to ext/zip (I maintain it). Thanks for the discussions&amp;suggestions!</description> <content:encoded><![CDATA[<p>Interesting, I&#8217;d to take a look and see if I can add this kind of features to ext/zip (I maintain it). Thanks for the discussions&amp;suggestions!</p> ]]></content:encoded> </item> <item><title>By: Adrian Sutton</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174064</link> <dc:creator>Adrian Sutton</dc:creator> <pubDate>Mon, 25 May 2009 11:12:13 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174064</guid> <description>I&#039;m sure it doesn&#039;t create a temporary file.  When closing off the zip index you don&#039;t need the file content - just some of the meta data (name, size, date etc).  It&#039;s pretty simple to store just that meta data in memory instead of the entire file so you can write the index at the end.</description> <content:encoded><![CDATA[<p>I&#8217;m sure it doesn&#8217;t create a temporary file.  When closing off the zip index you don&#8217;t need the file content &#8211; just some of the meta data (name, size, date etc).  It&#8217;s pretty simple to store just that meta data in memory instead of the entire file so you can write the index at the end.</p> ]]></content:encoded> </item> <item><title>By: Pierre</title><link>http://www.symphonious.net/2009/05/25/php-libraries-hate-ram/comment-page-1/#comment-174063</link> <dc:creator>Pierre</dc:creator> <pubDate>Mon, 25 May 2009 09:52:15 +0000</pubDate> <guid
isPermaLink="false">http://www.symphonious.net/?p=1179#comment-174063</guid> <description>Yes, but are you sure that it does not create a temporary file?
It sounds very hard (impossible) to finalize an archive index when the archive content is not even known.</description> <content:encoded><![CDATA[<p>Yes, but are you sure that it does not create a temporary file?</p><p>It sounds very hard (impossible) to finalize an archive index when the archive content is not even known.</p> ]]></content:encoded> </item> </channel> </rss>
