<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alexey Zakhlestins blog &#187; scgi</title>
	<atom:link href="http://blog.milkfarmsoft.com/category/computers/web/scgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.milkfarmsoft.com</link>
	<description>Programming for Mac and Web</description>
	<lastBuildDate>Sun, 13 Jun 2010 15:42:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
	<atom:link rel="hub" href="http://superfeedr.com/hubbub" />
			<item>
		<title>lighttpd 1.4.15</title>
		<link>http://blog.milkfarmsoft.com/2007/07/lighttpd-1415/</link>
		<comments>http://blog.milkfarmsoft.com/2007/07/lighttpd-1415/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 08:40:01 +0000</pubDate>
		<dc:creator>indeyets</dc:creator>
				<category><![CDATA[fink]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scgi]]></category>

		<guid isPermaLink="false">http://blog.milkfarmsoft.com/?p=56</guid>
		<description><![CDATA[<p>Better late than never. I&#8217;ve released updated lighttpd packages for MacOS-X&#8217;s Fink. It is Lighttpd 1.4.15 this time. Also, I added memcached support to mod_cml and mod_trigger_b4_dl.</p>
<p>As usual, if you have any good or bad feedback â€” let me know <span style="color:#777"> . . . &#8594; Read More: <a href="http://blog.milkfarmsoft.com/2007/07/lighttpd-1415/">lighttpd 1.4.15</a></span>]]></description>
			<content:encoded><![CDATA[<p>Better late than never. I&#8217;ve released updated <a href="http://pdb.finkproject.org/pdb/search.php?summary=lighttpd">lighttpd packages</a> for MacOS-X&#8217;s <a href="http://www.finkproject.org/index.php">Fink</a>. It is <a href="http://www.lighttpd.net/2007/4/13/lighttpd-1-4-15-the-following-traditions-release">Lighttpd 1.4.15</a> this time. Also, I added memcached support to <a href="http://pdb.finkproject.org/pdb/package.php/lighttpd-cml">mod_cml</a> and <a href="http://pdb.finkproject.org/pdb/package.php/lighttpd-trigger-b4dl">mod_trigger_b4_dl</a>.</p>
<p>As usual, if you have any good or bad feedback â€” let me know <img src='http://blog.milkfarmsoft.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.milkfarmsoft.com/2007/07/lighttpd-1415/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php as appserver vs memory-leaks</title>
		<link>http://blog.milkfarmsoft.com/2007/06/php-as-appserver-vs-memory-leaks/</link>
		<comments>http://blog.milkfarmsoft.com/2007/06/php-as-appserver-vs-memory-leaks/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 18:28:32 +0000</pubDate>
		<dc:creator>indeyets</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[scgi]]></category>

		<guid isPermaLink="false">http://blog.milkfarmsoft.com/?p=53</guid>
		<description><![CDATA[<p>There was a comment by Olivier to one of my previous posts mentioning, that php was still leaking memory even on the simpliest example. That&#8217;s not exactly true. I added some more memory-information output to that example and made &#8220;hard&#8221; testing by ab. Here are some results:</p>

Hello world! #22960
Memory usage: 232312
Peak Memory usage: 275352
Memory usage last <span style="color:#777"> . . . &#8594; Read More: <a href="http://blog.milkfarmsoft.com/2007/06/php-as-appserver-vs-memory-leaks/">php as appserver vs memory-leaks</a></span>]]></description>
			<content:encoded><![CDATA[<p>There was a <a href="http://blog.milkfarmsoft.com/?p=51#comment-6071">comment by Olivier</a> to one of my previous posts mentioning, that php was still leaking memory even on the simpliest example. That&#8217;s not exactly true. I added some more memory-information output to <a href="http://appserver-in-php.googlecode.com/svn/trunk/examples/scgi/">that example</a> and made &#8220;hard&#8221; testing by ab. Here are some results:</p>
<pre>
Hello world! #22960
Memory usage: 232312
Peak Memory usage: 275352
Memory usage last growed at request#71
</pre>
<p>Looks good enogh for me <img src='http://blog.milkfarmsoft.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>p.s. weekend is coming â€” I will be posting some more-interesting stuff</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.milkfarmsoft.com/2007/06/php-as-appserver-vs-memory-leaks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP+SCGI part 2: problem with eZComponents</title>
		<link>http://blog.milkfarmsoft.com/2007/06/phpscgi-part-2-problem-with-ezcomponents/</link>
		<comments>http://blog.milkfarmsoft.com/2007/06/phpscgi-part-2-problem-with-ezcomponents/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 09:58:39 +0000</pubDate>
		<dc:creator>indeyets</dc:creator>
				<category><![CDATA[eZComponents]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[scgi]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.milkfarmsoft.com/?p=52</guid>
		<description><![CDATA[<p>Thanks for all the comments to my &#8220;Application Server in PHP? wellâ€¦ Yes!&#8221; posting. I was really amazed to see that many interested people. Your support gives me a great motivation. Thanks, guys!  </p>
<p>I am currently thinking about proper object hierarchy and, actually, I changed it completely 3 times already in my thoughts. I finally <span style="color:#777"> . . . &#8594; Read More: <a href="http://blog.milkfarmsoft.com/2007/06/phpscgi-part-2-problem-with-ezcomponents/">PHP+SCGI part 2: problem with eZComponents</a></span>]]></description>
			<content:encoded><![CDATA[<p>Thanks for all the comments to my <a href="http://blog.milkfarmsoft.com/?p=51">&#8220;Application Server in PHP? wellâ€¦ Yes!&#8221; posting</a>. I was really amazed to see that many interested people. Your support gives me a great motivation. Thanks, guys! <img src='http://blog.milkfarmsoft.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I am currently thinking about proper object hierarchy and, actually, I changed it completely 3 times already in my thoughts. I finally &#8220;see the light&#8221;â„¢ and will implement it on a weekend. I think about converting SCGI-part to a simple &#8220;driver&#8221; and move all http-related stuff to a separate driver-agnostic set of classes (Probably, that would be a class per kind of http-request and a class per kind of http-response). This way, I would be able to implement FastCGI as anther driver without altering applications. If you have any better ideas â€” let me know.</p>
<p>For now, I made another example application. This time, with some benchmarking in thoughts. <a href="http://appserver-in-php.googlecode.com/svn/trunk/examples/scgi-ezc/">Here it is</a>.</p>
<p>This example supposes, that you have <a href="http://ez.no/ezcomponents">ezcomponents</a> folder on the one level with the svn-checked-out <a href="http://appserver-in-php.googlecode.com/svn/trunk/">&#8220;trunk&#8221; of my googlecode-project</a>. And, you can start &#8220;runner.php&#8221; both as SCGI-server (using CLI) or as usual mod_php/(fast)cgi application. The idea was to see if there will be any noticeable speed difference between approaches. Butâ€¦ it showed the other thing <img src='http://blog.milkfarmsoft.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I used <a href="http://ez.no/doc/components/view/latest/(file)/classtrees_Graph.html">ezcGraph</a> in my application and noticed a serious memory-leaking. Obviously, ezcGraph has the <a href="http://blog.milkfarmsoft.com/?p=51#comment-5979">forementioned in comments</a> problem with cycled references. The solution is, to add some kind of &#8220;<strong>public function clean()</strong>&#8221; method, which would remove references in the object, and objects which were auto-generated by it, so it would later be cleaned-up by a garbage-collector. I implemented a quick-fix locally and it did help to some degreee, but I definitely missed some references, so it still leaked. I think that someone who knows internals of eZComponents better should do it.</p>
<p><a href="http://www.derickrethans.nl/">Derick</a>? Anyone? Can this be done?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.milkfarmsoft.com/2007/06/phpscgi-part-2-problem-with-ezcomponents/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Application Server in PHP? well… Yes!</title>
		<link>http://blog.milkfarmsoft.com/2007/06/application-server-in-php-well%e2%80%a6-yes/</link>
		<comments>http://blog.milkfarmsoft.com/2007/06/application-server-in-php-well%e2%80%a6-yes/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 13:05:58 +0000</pubDate>
		<dc:creator>indeyets</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[scgi]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.milkfarmsoft.com/?p=51</guid>
		<description><![CDATA[<p>Short story: I made the initial implementation of SCGI protocol in PHP. Check it out!  </p>
<p>Long story:
Some time ago I was ranting about PHP and it&#8217;s &#8220;way&#8221; of handling FastCGI. The idea is to have persistent PHP-application which would handle requests from inside. This would allow us have &#8220;real&#8221; persistent cache in application (persistent connection <span style="color:#777"> . . . &#8594; Read More: <a href="http://blog.milkfarmsoft.com/2007/06/application-server-in-php-well%e2%80%a6-yes/">Application Server in PHP? well… Yes!</a></span>]]></description>
			<content:encoded><![CDATA[<p><em>Short story</em>: I made the initial implementation of <a href="http://python.ca/scgi/">SCGI</a> protocol in PHP. <a href="http://code.google.com/p/appserver-in-php/">Check it out!</a> <img src='http://blog.milkfarmsoft.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><em>Long story</em>:<br />
Some time ago I was <a href="http://blog.milkfarmsoft.com/?p=4">ranting</a> about PHP and it&#8217;s &#8220;way&#8221; of handling FastCGI. The idea is to have persistent PHP-application which would handle requests from inside. This would allow us have &#8220;real&#8221; persistent cache in application (persistent connection to arbitary resources, preparsed XSLT&#8217;s in memory) and reply to queries really fast as we wouldn&#8217;t need to load all the classes on each request (classes would be loaded only once, during app initialization). And no, APC and similiar technologies do not completely solve this problem.</p>
<p>I finally found some time (and inspiration) to do something in direction of implementing FastCGI the way I see it. Initially, I was going to implement FastCGI-functions in php-extension, but that would require more time than I currently have, so I started with a simplier task: I implemented SCGI protocol (which is <a href="http://utcc.utoronto.ca/~cks/space/blog/programming/SCGIvsFastCGI">way simplier</a> than FastCGI) in pure php-code (which is easier, again, and let&#8217;s me change API faster, during development).</p>
<p>This thing already works and you can test it if you have SCGI-enabled server (apache and lighttpd will do) and PHP 5.2.1+ (cli). At first, you need to get latest sources from <a href="http://code.google.com/p/appserver-in-php/">my google-code project</a>. Sources come with <a href="http://appserver-in-php.googlecode.com/svn/trunk/examples/scgi/">an example</a>.</p>
<p>Some comments to ease understanding:</p>
<ul>
<li>Start by including <strong>SCGI/autoload.php</strong> file — it will take care of including all SCGI-classes</li>
<li>Create your class by extending <strong>SCGI_Application</strong>. It needs to have two methods: <strong>public function __construct</strong> and <strong>protected function requestHandler</strong>. Constructor should call <strong>parent::__construct</strong> optionally with the stream-url. By default, application will listen on <strong>tcp://127.0.0.1:9999</strong>.</li>
<li>requestHandler is the function which is called by application on every request. This is the point where most of the things should happen. Request-data is available from <strong>$this->request()</strong> and Response-data should be given to <strong>$this->response()</strong>. See example for details</li>
<li>To see some result you need to tell your web-server, where your application&#8217;s socket is. <a href="http://appserver-in-php.googlecode.com/svn/trunk/examples/scgi/lighttpd.example.conf">Example for Lighttpd</a> is available in repository</li>
</ul>
<p><strong>Warning</strong>: This is the pre-pre-release. API will be changing.</p>
<p><strong>UPDATE</strong>: Code of this project was moved to github: <a href="http://github.com/indeyets/appserver-in-php">http://github.com/indeyets/appserver-in-php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.milkfarmsoft.com/2007/06/application-server-in-php-well%e2%80%a6-yes/feed/</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
	</channel>
</rss>
