<?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>Randomness from RES</title>
	<atom:link href="http://www.robertswarthout.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robertswarthout.com</link>
	<description>Things that I run across that might be useful to others...</description>
	<lastBuildDate>Thu, 07 Jul 2011 02:48:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Tracking EC2 instance internal IPs in a central location &#8230; SimpleDB</title>
		<link>http://www.robertswarthout.com/2011/07/tracking-ec2-instance-internal-ips-in-a-central-location-simpledb/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tracking-ec2-instance-internal-ips-in-a-central-location-simpledb</link>
		<comments>http://www.robertswarthout.com/2011/07/tracking-ec2-instance-internal-ips-in-a-central-location-simpledb/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 02:46:50 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ShootProof]]></category>
		<category><![CDATA[SimpleDB]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=139</guid>
		<description><![CDATA[So us code poets over at ShootProof have been hard at work on doing an upgrade to our server architecture and one of the issues that we ran across was how to always know about which app servers are active and should be considered as part of the memcached pool. The goal was to have [...]]]></description>
				<content:encoded><![CDATA[<p>So us code poets over at <a href="http://www.shootproof.com">ShootProof</a> have been hard at work on doing an upgrade to our server architecture and one of the issues that we ran across was how to always know about which app servers are active and should be considered as part of the memcached pool. The goal was to have it totally automated such that we can bring machines up and down and never have to think about updating a list of IPs. The solution we came up with is to have a cron running on all of the app servers that updates a record in SimpleDB. This record cron runs each minute and gathers some information. Mainly it is just updating a timestamp in its SimpleDB record saying that it is alive. Near the end of the script it runs a query against SimpleDB to get a list of all of the active servers. It takes that list, builds an array of IP addresses and puts that in the local memcache instance. The website application then will be able to do a lookup to get the list of IPs to build the cluster at run time. Below is a copy of the script, feel free to pick it apart in the comments.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lib/sdb.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AWS_ACCESS_KEY_ID'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'XXXXXXXXXXXXXXX'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AWS_SECRET_ACCESS_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YYYYYYYYYYYYYYY'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// machine specific information</span>
<span style="color: #000088;">$amiId</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://169.254.169.254/latest/meta-data/ami-id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$machineData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'ami_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$amiId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'ip'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://169.254.169.254/latest/meta-data/local-ipv4'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'hostname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://169.254.169.254/latest/meta-data/local-hostname'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'availability_zone'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://169.254.169.254/latest/meta-data/placement/availability-zone'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'last_updated'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$sdb</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleDB<span style="color: #009900;">&#40;</span>AWS_ACCESS_KEY_ID<span style="color: #339933;">,</span> AWS_SECRET_ACCESS_KEY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$domain</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'simple_db_domain_name'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$expectedMachineData</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$objectInfo</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;select * from `&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$domain</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;` where `ami_id` = '&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$amiId</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objectInfo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$attributes</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$objectInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Attributes'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$tmpMachineData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$machineData</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'replace'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'true'</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$tmpMachineData</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
&nbsp;
    <span style="color: #000088;">$machineData</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmpMachineData</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$expectedMachineData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'last_updated'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attributes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'last_updated'</span><span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#41;</span>   
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// put the object into simple db</span>
<span style="color: #000088;">$sdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">putAttributes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$amiId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$machineData</span><span style="color: #339933;">,</span> <span style="color: #000088;">$expectedMachineData</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// find any old records to clean up</span>
<span style="color: #000088;">$recordsToDelete</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;select * from `&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$domain</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;` where `last_updated` &lt;= '&quot;</span> <span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">300</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$recordsToDelete</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$toDelete</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// if this is the same machine as the one this script is running on let's skip the</span>
    <span style="color: #666666; font-style: italic;">// delete and just run the proceeding update</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$toDelete</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$amiId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
&nbsp;
    <span style="color: #666666; font-style: italic;">// let's delete the object</span>
    <span style="color: #000088;">$sdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">deleteAttributes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$toDelete</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// find any active servers</span>
<span style="color: #000088;">$activeMachines</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;select * from `&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$domain</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;` where `last_updated` &gt; '&quot;</span> <span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">300</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ips</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// make the list of all ips</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$activeMachines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$activeMachine</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$activeMachine</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Attributes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ip'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
&nbsp;
    <span style="color: #000088;">$ips</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$activeMachine</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Attributes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ip'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$memcache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Memcache<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$memcache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addServer</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'127.0.0.1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'11212'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$memcache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cluster-ip-list'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ips</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It is also a good idea to make a separate user in AWS for these scripts so that you can get a new access key and secret that can be locked down to just that domain in SimpleDB with only the needed permissions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2011/07/tracking-ec2-instance-internal-ips-in-a-central-location-simpledb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wildcard SSL &#8211; One IP &#8211; Multiple Vhosts</title>
		<link>http://www.robertswarthout.com/2010/10/wildcard-ssl-one-ip-multiple-vhosts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wildcard-ssl-one-ip-multiple-vhosts</link>
		<comments>http://www.robertswarthout.com/2010/10/wildcard-ssl-one-ip-multiple-vhosts/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 18:25:55 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=125</guid>
		<description><![CDATA[Currently the general rule when using SSL is that you will need one IP for each hostname you want to secure. This will all change once TLS2.0 is widely adopted. For the time being, if you are lucky enough to only want to be securing multiple subdomains off of the same domain with a wildcard SSL [...]]]></description>
				<content:encoded><![CDATA[<p>Currently the general rule when using SSL is that you will need one IP for each hostname you want to secure. This will all change once TLS2.0 is widely adopted. For the time being, if you are lucky enough to only want to be securing multiple subdomains off of the same domain with a wildcard SSL cert the keep reading below.</p>
<p>1. Ensure that your apache config includes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">NameVirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">443</span></pre></div></div>

<p>2. Your vhosts:</p>
<div id="_mcePaste" style="padding-left: 30px;">&lt;VirtualHost *:443&gt;</div>
<div id="_mcePaste" style="padding-left: 30px;">ServerName <strong>subdomain1</strong>.example.com</div>
<div style="padding-left: 30px;">&#8230;&#8230;</div>
<div id="_mcePaste" style="padding-left: 30px;">SSLEngine on</div>
<div id="_mcePaste" style="padding-left: 30px;">SSLProtocol all -SSLv2</div>
<div id="_mcePaste" style="padding-left: 30px;">SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW</div>
<div id="_mcePaste" style="padding-left: 30px;">SSLCertificateFile /path/to/your/ssl.crt</div>
<div id="_mcePaste" style="padding-left: 30px;">SSLCertificateKeyFile /path/to/your/ssl.key</div>
<div style="padding-left: 30px;">&#8230;&#8230;</div>
<div style="padding-left: 30px;">&lt;/VirtualHost&gt;</div>
<div style="padding-left: 30px;">
<div id="_mcePaste">&lt;VirtualHost *:443&gt;</div>
<div id="_mcePaste">ServerName <strong>subdomain2</strong>.example.com</div>
<div>&#8230;&#8230;</div>
<div id="_mcePaste">SSLEngine on</div>
<div id="_mcePaste">SSLProtocol all -SSLv2</div>
<div id="_mcePaste">SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW</div>
<div id="_mcePaste">SSLCertificateFile /path/to/your/ssl.crt</div>
<div id="_mcePaste">SSLCertificateKeyFile /path/to/your/ssl.key</div>
<div>&#8230;&#8230;</div>
<div>&lt;/VirtualHost&gt;</div>
</div>
<div>If my understanding is correct of apache, it will enter the first virtualhost it finds that is SSL in this case and use the certificate details in there to decrypt the request. If the hostname does not match at that point it will move along to the next virtualhost that it can match and try there.</div>
<p style="padding-left: 30px;">
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2010/10/wildcard-ssl-one-ip-multiple-vhosts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon S3 Upload Speeds</title>
		<link>http://www.robertswarthout.com/2010/10/amazon-s3-upload-speeds/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=amazon-s3-upload-speeds</link>
		<comments>http://www.robertswarthout.com/2010/10/amazon-s3-upload-speeds/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:42:33 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[ShootProof]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=120</guid>
		<description><![CDATA[I am currently working on a new startup called ShootProof. ShootProof utilizes many of Amazon web services. We recently have been hearing sporadic feedback from our beta testers that sometimes their uploads are slower than they think they should be. Currently the way we are accepting uploads is that we send each file up via XMLHttpRequest to [...]]]></description>
				<content:encoded><![CDATA[<p>I am currently working on a new startup called <a href="http://www.shootproof.com">ShootProof</a>. ShootProof utilizes many of Amazon web services. We recently have been hearing sporadic feedback from our beta testers that sometimes their uploads are slower than they think they should be. Currently the way we are accepting uploads is that we send each file up via XMLHttpRequest to our EC2 instances, doing some quick inspection of the file and then store it in an upload bucket. A few moments later a re-sizer batch job comes along and does resizing/watermarking/other stuff to the photo and moves it into place.</p>
<p>After we started to investigate why some beta testers were sometimes getting slower than ideal upload speed we decided to test out the ability to do out uploads directly to S3. Amazon S3 support <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?UsingHTTPPOST.html">HTTP POST uploads</a> which is great as it takes us out of the middle of all of that traffic. Essentially what this means is that users of ShootProof should never be limited upload-wise by our EC2 instance. Also we will not need to constantly spool up and down EC2 instances to handle load spikes. After each upload is completely sent to S3 we will fire off a small notification call that will let us know we have a new photo we need to take care of. Upload traffic to our EC2 instances will drop by at least 99%. Also to be sure that we never miss a new photo that is placed into our S3 upload bucket we will monitor the contents up the upload bucket to ensure that they match what we are expecting. All photos that are uploaded into S3 by the user are marked to have an ACL of private so that they are essentially being put into a dropbox.</p>
<p>Below is a table that shows the tests that we did to come to our conclusion to post directly to S3. The file that was used for this test is a 13.1MB JPEG. All uploads were done using a internet connection that is a full 10Mbit up.</p>
<table>
<tbody>
<tr>
<td><strong>XMLHttpRequest Post (EC2 -&gt; S3)</strong></td>
<td><strong>HTTPS S3 Post</strong></td>
<td><strong>HTTP S3 Post</strong></td>
<td></td>
</tr>
<tr>
<td>13.2</td>
<td>20.6</td>
<td>9.5</td>
<td></td>
</tr>
<tr>
<td>14</td>
<td>19.1</td>
<td>9.6</td>
<td></td>
</tr>
<tr>
<td>13.7</td>
<td>22.7</td>
<td>10.3</td>
<td></td>
</tr>
<tr>
<td>14.3</td>
<td>24.9</td>
<td>9.3</td>
<td></td>
</tr>
<tr>
<td>13.7</td>
<td>15.3</td>
<td>9.4</td>
<td></td>
</tr>
<tr>
<td>13.9</td>
<td>18.4</td>
<td>9.2</td>
<td></td>
</tr>
<tr>
<td>24.1</td>
<td>24.2</td>
<td>9.7</td>
<td></td>
</tr>
<tr>
<td>13.7</td>
<td>17.5</td>
<td>9.4</td>
<td></td>
</tr>
<tr>
<td>13.8</td>
<td>17.3</td>
<td>9.9</td>
<td></td>
</tr>
<tr>
<td>15.2</td>
<td>17.4</td>
<td>9.4</td>
<td></td>
</tr>
<tr>
<td><strong>14.96 sec</strong></td>
<td><strong>20.04 sec</strong></td>
<td><strong>9.57 sec</strong></td>
<td><strong>Average</strong></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2010/10/amazon-s3-upload-speeds/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Optimizing your AT&amp;T A-List entries&#8230;</title>
		<link>http://www.robertswarthout.com/2009/11/optimizing-your-att-a-list-entries/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=optimizing-your-att-a-list-entries</link>
		<comments>http://www.robertswarthout.com/2009/11/optimizing-your-att-a-list-entries/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 03:25:51 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=114</guid>
		<description><![CDATA[With AT&#38;T&#8217;s new A-List feature for accounts of at least a certain threshold comes a new problem, which numbers to include in the list. While this might be easy for some, it wasn&#8217;t that simple for me so I wrote a little script to compute what my optimal A-List would be. If you are an [...]]]></description>
				<content:encoded><![CDATA[<p>With AT&amp;T&#8217;s new <a href="http://www.wireless.att.com/cell-phone-service/cell-phone-sales/promotion/a-list.jsp">A-List feature</a> for accounts of at least a certain threshold comes a new problem, which numbers to include in the list. While this might be easy for some, it wasn&#8217;t that simple for me so I wrote a <a href="http://www.robertswarthout.com/optimize_a-list">little script to compute what my optimal A-List</a> would be. If you are an AT&amp;T wireless customer, give this a shot, it might save you some more or add to your rollover balance! If you have any questions about this script or find a bug you can find my contact information on the <a href="http://www.robertswarthout.com/about-me">about page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2009/11/optimizing-your-att-a-list-entries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apple iPhone Developer Program Support?!?!</title>
		<link>http://www.robertswarthout.com/2008/09/apple-iphone-developer-program-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apple-iphone-developer-program-support</link>
		<comments>http://www.robertswarthout.com/2008/09/apple-iphone-developer-program-support/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 18:20:53 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=104</guid>
		<description><![CDATA[Update: I just received an email from support, the reports will show up in my account tomorrow at 6:00 AM. [9/23/2008 3:21 PM ET] I typically will not write about anything non-technical but I will make an exception this time. Why-oh-why is it like pulling teeth when dealing with the iPhone App Developer Program support. [...]]]></description>
				<content:encoded><![CDATA[<p><strong>Update:</strong> I just received an email from support, the reports will show up in my account tomorrow at 6:00 AM. [9/23/2008 3:21 PM ET]</p>
<p>I typically will not write about anything non-technical but I will make an exception this time. Why-oh-why is it like pulling teeth when dealing with the iPhone App Developer Program support. I get the feeling that when I call and wait my turn in the phone queue, all I am getting to talk to is a receptionist who is going to &#8220;escalate the matter&#8221;. When asked how long it will take to get a response back, I am told that it will take a week to a week and a half. This is a VERY simple matter. All I want to know is how many downloads <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=290493281&amp;mt=8">my app</a> has had. Shouldn&#8217;t this automatically, programmatically for that matter, be turned on in the iTunesConnect portal by default when an app goes live? If that was the case, I could be writing a blog post about how awesome the developer program is, but no, I am stuck here writing in frustration.</p>
<p>Having dealt with Apple support for a Macbook Pro a couple of times, the iPhone Developer support seems like a bunch of amateurs who have no idea what&#8217;s going on. As an <a href="http://finance.google.com/finance?q=NASDAQ:AAPL">AAPL</a> share holder, I am glad that the general public does not have to deal with the iPhone Developer support, as it would turn people away in droves.</p>
<p>If anyone with power to help in this situation is reading this post please feel free to contact me at rswarthout [at] gmail [dot] com.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2008/09/apple-iphone-developer-program-support/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monkey Slap is now available in the App Store</title>
		<link>http://www.robertswarthout.com/2008/09/monkey-slap-is-now-available-in-the-app-store/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=monkey-slap-is-now-available-in-the-app-store</link>
		<comments>http://www.robertswarthout.com/2008/09/monkey-slap-is-now-available-in-the-app-store/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 13:01:09 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Monkey Slap]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=88</guid>
		<description><![CDATA[For those of you with an iPhone and looking for a new game to play you might consider checking out Monkey Slap. This is my first stab at making an iPhone application. It has been a very fun and interesting process. You will have to let me know what you think.]]></description>
				<content:encoded><![CDATA[<p><a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=290493281&amp;mt=8"><img class="alignright size-full wp-image-87" title="avail_on_app_store" src="http://www.robertswarthout.com/wp-content/uploads/2008/09/avail_on_app_store.png" align="right" alt="" width="166" height="74" /></a>For those of you with an iPhone and looking for a new game to play you might consider checking out <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=290493281&amp;mt=8">Monkey Slap</a>. This is my first stab at making an iPhone application. It has been a very fun and interesting process. You will have to let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2008/09/monkey-slap-is-now-available-in-the-app-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Submitted my first application to Apple</title>
		<link>http://www.robertswarthout.com/2008/09/submitted-my-first-application-to-apple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=submitted-my-first-application-to-apple</link>
		<comments>http://www.robertswarthout.com/2008/09/submitted-my-first-application-to-apple/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 13:27:41 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=81</guid>
		<description><![CDATA[After more than a month of development and learning how to code in Objective-C and Cocoa I finished up my first app. My first app is titled &#8220;Monkey Slap&#8221; and I hope it will be available very soon in the App Store. Below I have copied in the description of the game. This application will [...]]]></description>
				<content:encoded><![CDATA[<p>After more than a month of development and learning how to code in Objective-C and Cocoa I finished up my first app. My first app is titled &#8220;Monkey Slap&#8221; and I hope it will be available very soon in the App Store. Below I have copied in the description of the game. This application will be sold for $1.99.</p>
<blockquote>
<div class="entrytext">
<p>You’re deep in the jungle when suddenly a silly little monkey starts laughing at you. Better show him who’s boss and slap that monkey! Similar to the classic arcade game “Whack A Mole” this game is both funny and easy to play. Exciting features test your speed and coordination and you try to slap every monkey you see. Extra points if you catch him while he is stealing bananas. Guaranteed to be more fun than a… barrel full of monkeys.</p>
<p>Features:</p>
<ul>
<li>Multi-touch game play</li>
<li>Endless Levels</li>
<li>3 independent difficulty settings</li>
<li>Sound Control</li>
<li>Top Score Board</li>
</ul>
</div>
</blockquote>
<p>Here are a few screen shots of what this will look like:</p>
<p><a href="http://www.robertswarthout.com/wp-content/uploads/2008/09/intro_view_10.jpg"><img class="alignnone size-medium wp-image-78" title="intro_view_10" src="http://www.robertswarthout.com/wp-content/uploads/2008/09/intro_view_10-200x300.jpg" alt="" width="98" height="147" /></a> <a href="http://www.robertswarthout.com/wp-content/uploads/2008/09/game_view_10.jpg"><img class="alignnone size-medium wp-image-77" title="game_view_10" src="http://www.robertswarthout.com/wp-content/uploads/2008/09/game_view_10-200x300.jpg" alt="" width="98" height="147" /></a> <a href="http://www.robertswarthout.com/wp-content/uploads/2008/09/settings_view_10.jpg"><img class="alignnone size-medium wp-image-79" title="settings_view_10" src="http://www.robertswarthout.com/wp-content/uploads/2008/09/settings_view_10-200x300.jpg" alt="" width="98" height="147" /></a></p>
<p>Be sure to let me know what you think about this game.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2008/09/submitted-my-first-application-to-apple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My php&#124;works talk got accepted</title>
		<link>http://www.robertswarthout.com/2008/08/my-phpworks-talk-got-accepted/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-phpworks-talk-got-accepted</link>
		<comments>http://www.robertswarthout.com/2008/08/my-phpworks-talk-got-accepted/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 12:55:13 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php|works]]></category>
		<category><![CDATA[Sphinx Search]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=73</guid>
		<description><![CDATA[I got the email this morning, my php&#124;works talk got accepted! My talk will take place on day #2, 11/14/2008 at 1:45 PM and is titled &#8220;Sphinx: Search for Everyone Else&#8221;. Hope to see you there.]]></description>
				<content:encoded><![CDATA[<p>I got the email this morning, my <a href="http://phpworks.mtacon.com/">php|works</a> talk got accepted! My talk will take place on day #2, 11/14/2008 at 1:45 PM and is titled <a class="talk" href="http://phpworks.mtacon.com/c/schedule/talk/d2s5/2">&#8220;Sphinx: Search for Everyone Else&#8221;</a>. Hope to see you there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2008/08/my-phpworks-talk-got-accepted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continued: MySQL connection benchmarking</title>
		<link>http://www.robertswarthout.com/2008/08/continued-mysql-connection-benchmarking/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=continued-mysql-connection-benchmarking</link>
		<comments>http://www.robertswarthout.com/2008/08/continued-mysql-connection-benchmarking/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 19:08:58 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Benchmarking]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=62</guid>
		<description><![CDATA[I was asked by a fellow Schematicer to see if there was a performance difference if the fourth parameter of mysql_connect was set to true if it would make any difference. I would assume that it would not make any difference but I went ahead and ran the variation to be sure, the results are [...]]]></description>
				<content:encoded><![CDATA[<p>I was asked by a fellow <a href="http://www.schematic.com">Schematic</a>er to see if there was a performance difference if the fourth parameter of <a href="http://www.php.net/mysql_connect">mysql_connect</a> was set to true if it would make any difference. I would assume that it would not make any difference but I went ahead and ran the variation to be sure, the results are below.</p>
<p>Run #1:</p>
<blockquote><p>11409 fetches, 20 max parallel, 45636 bytes, in 600.011 seconds<br />
4 mean bytes/connection<br />
19.0146 fetches/sec, 76.0586 bytes/sec<br />
msecs/connect: 0.211857 mean, 39.668 max, 0.029 min<br />
msecs/first-response: 1050.65 mean, 2662.53 max, 323.514 min<br />
HTTP response codes: code 200 &#8212; 11409</p></blockquote>
<p>Run #2:</p>
<blockquote><p>11141 fetches, 20 max parallel, 44564 bytes, in 600.005 seconds<br />
4 mean bytes/connection<br />
18.5682 fetches/sec, 74.2727 bytes/sec<br />
msecs/connect: 0.206869 mean, 30.293 max, 0 min<br />
msecs/first-response: 1076.17 mean, 2317.13 max, 350.16 min<br />
HTTP response codes: code 200 &#8212; 11141</p></blockquote>
<p>Run #3:</p>
<blockquote><p>11183 fetches, 20 max parallel, 44732 bytes, in 600 seconds<br />
4 mean bytes/connection<br />
18.6383 fetches/sec, 74.5533 bytes/sec<br />
msecs/connect: 0.201182 mean, 24.691 max, 0.03 min<br />
msecs/first-response: 1071.81 mean, 2448.18 max, 366.686 min<br />
HTTP response codes: code 200 &#8212; 11183</p></blockquote>
<p><strong>Results Analysis</strong></p>
<ul>
<li>Average requests per second: 18.7043</li>
<li>Average requests completed: 11,244</li>
</ul>
<p>These results can be compared to the <a href="http://www.robertswarthout.com/2008/08/benchmarking-of-mysql-persistent-connections-vs-non-persistent-connections/">previous post on this topic</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2008/08/continued-mysql-connection-benchmarking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Benchmarking of MySQL Persistent Connections vs Non-Persistent Connections</title>
		<link>http://www.robertswarthout.com/2008/08/benchmarking-of-mysql-persistent-connections-vs-non-persistent-connections/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=benchmarking-of-mysql-persistent-connections-vs-non-persistent-connections</link>
		<comments>http://www.robertswarthout.com/2008/08/benchmarking-of-mysql-persistent-connections-vs-non-persistent-connections/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 14:37:37 +0000</pubDate>
		<dc:creator>Robert Swarthout</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Benchmarking]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.robertswarthout.com/?p=28</guid>
		<description><![CDATA[This post will be about the what always seems to be a hot topic among PHPers about what connection type to use when connection to a MySQL database. I used MySQL 5.0.45, PHP 5.2.4 for this benchmarking. You can download the same sample MySQL database that is used for this set of benchmarking by visiting [...]]]></description>
				<content:encoded><![CDATA[<p>This post will be about the what always seems to be a hot topic among PHPers about what connection type to use when connection to a MySQL database.</p>
<p>I used MySQL 5.0.45, PHP 5.2.4 for this benchmarking. You can download the same sample MySQL database that is used for this set of benchmarking by visiting <a href="http://dev.mysql.com/doc/#sampledb">http://dev.mysql.com/doc/#sampledb</a>. In the list of example databases, choose the one named &#8216;sakila&#8217;.</p>
<p>For each connection type I will run three tests to see compensate for variations in tests. I will be using <a href="http://www.acme.com/software/http_load/">http_load</a> to do the benchmarking of the connection file. To view each of the connection files, download the file bundle at the end of this post.</p>
<p>Below is the benchmark command with the options used for each run.</p>
<blockquote><p>./http_load -verbose -parallel 20 -seconds 600 urls.txt</p></blockquote>
<p>The urls.txt file contains the following:</p>
<blockquote><p>http://127.0.0.1/mysql_connection_bench_{CONNECT_TYPE}.php</p></blockquote>
<p>Between each benchmark run I will restart both Apache and MySQL.</p>
<p><strong>Results for the standard MySQL functions in PHP using mysql_connect.</strong></p>
<p>Run #1:</p>
<blockquote><p>11024 fetches, 20 max parallel, 44096 bytes, in 600.007 seconds<br />
4 mean bytes/connection<br />
18.3731 fetches/sec, 73.4925 bytes/sec<br />
msecs/connect: 0.22087 mean, 48.992 max, 0.03 min<br />
msecs/first-response: 1087.74 mean, 2880.95 max, 355.012 min<br />
HTTP response codes: code 200 &#8212; 11024</p></blockquote>
<p>Run #2:</p>
<blockquote><p>10895 fetches, 20 max parallel, 43580 bytes, in 600.004 seconds<br />
4 mean bytes/connection<br />
18.1582 fetches/sec, 72.6328 bytes/sec<br />
msecs/connect: 0.219867 mean, 48.58 max, 0.031 min<br />
msecs/first-response: 1100.1 mean, 2623.47 max, 369.341 min<br />
HTTP response codes: code 200 &#8212; 10895</p></blockquote>
<p>Run #3:</p>
<blockquote><p>11134 fetches, 20 max parallel, 44536 bytes, in 600.003 seconds<br />
4 mean bytes/connection<br />
18.5566 fetches/sec, 74.2264 bytes/sec<br />
msecs/connect: 0.217796 mean, 42.036 max, 0.03 min<br />
msecs/first-response: 1076.59 mean, 3079.73 max, 270.734 min<br />
HTTP response codes: code 200 &#8212; 11134</p></blockquote>
<p><strong>Results for the standard MySQL functions in PHP using mysql_pconnect.</strong></p>
<p>Run #1:</p>
<blockquote><p>10982 fetches, 20 max parallel, 43928 bytes, in 600.025 seconds<br />
4 mean bytes/connection<br />
18.3026 fetches/sec, 73.2103 bytes/sec<br />
msecs/connect: 0.216663 mean, 69.795 max, 0 min<br />
msecs/first-response: 1091.52 mean, 3166.82 max, 254.36 min<br />
HTTP response codes: code 200 &#8212; 10982</p></blockquote>
<p>Run #2:</p>
<blockquote><p>11002 fetches, 20 max parallel, 44008 bytes, in 600.001 seconds<br />
4 mean bytes/connection<br />
18.3366 fetches/sec, 73.3465 bytes/sec<br />
msecs/connect: 0.20555 mean, 47.176 max, 0.031 min<br />
msecs/first-response: 1089.51 mean, 2953.82 max, 414.826 min<br />
HTTP response codes: code 200 &#8212; 11002</p></blockquote>
<p>Run #3:</p>
<blockquote><p>11196 fetches, 20 max parallel, 44784 bytes, in 600 seconds<br />
4 mean bytes/connection<br />
18.66 fetches/sec, 74.6399 bytes/sec<br />
msecs/connect: 0.2013 mean, 22.478 max, 0.03 min<br />
msecs/first-response: 1070.5 mean, 2506.02 max, 448.161 min<br />
HTTP response codes: code 200 &#8212; 11196</p></blockquote>
<p><strong>Results for non-persistent connections with PDO_MYSQL.</strong></p>
<p>Run #1:</p>
<blockquote><p>10995 fetches, 20 max parallel, 43980 bytes, in 600.008 seconds<br />
4 mean bytes/connection<br />
18.3248 fetches/sec, 73.299 bytes/sec<br />
msecs/connect: 0.203731 mean, 17.309 max, 0.029 min<br />
msecs/first-response: 1090.44 mean, 2852.34 max, 358.45 min<br />
HTTP response codes: code 200 &#8212; 10995</p></blockquote>
<p>Run #2:</p>
<blockquote><p>10971 fetches, 20 max parallel, 43884 bytes, in 600.002 seconds<br />
4 mean bytes/connection<br />
18.285 fetches/sec, 73.1398 bytes/sec<br />
msecs/connect: 0.21357 mean, 32.036 max, 0 min<br />
msecs/first-response: 1092.36 mean, 3515.71 max, 456.688 min<br />
HTTP response codes: code 200 &#8212; 10971</p></blockquote>
<p>Run #3:</p>
<blockquote><p>11161 fetches, 20 max parallel, 44644 bytes, in 600.001 seconds<br />
4 mean bytes/connection<br />
18.6016 fetches/sec, 74.4065 bytes/sec<br />
msecs/connect: 0.20571 mean, 31.679 max, 0.031 min<br />
msecs/first-response: 1073.96 mean, 2539.06 max, 351.236 min<br />
HTTP response codes: code 200 &#8212; 11161</p></blockquote>
<p><strong>Results for persistent connections with PDO_MYSQL.</strong></p>
<p>Run #1:</p>
<blockquote><p>10347 fetches, 20 max parallel, 41388 bytes, in 600.006 seconds<br />
4 mean bytes/connection<br />
17.2448 fetches/sec, 68.9793 bytes/sec<br />
msecs/connect: 0.253049 mean, 96.354 max, 0 min<br />
msecs/first-response: 1158.52 mean, 2596.78 max, 282.647 min<br />
HTTP response codes: code 200 &#8212; 10347</p></blockquote>
<p>Run #2:</p>
<blockquote><p>11106 fetches, 20 max parallel, 44424 bytes, in 600.008 seconds<br />
4 mean bytes/connection<br />
18.5098 fetches/sec, 74.0391 bytes/sec<br />
msecs/connect: 0.226898 mean, 51.29 max, 0.03 min<br />
msecs/first-response: 1079.29 mean, 2393.4 max, 311.85 min<br />
HTTP response codes: code 200 &#8212; 11106</p></blockquote>
<p>Run #3:</p>
<blockquote><p>10978 fetches, 20 max parallel, 43912 bytes, in 600.029 seconds<br />
4 mean bytes/connection<br />
18.2958 fetches/sec, 73.1831 bytes/sec<br />
msecs/connect: 0.210895 mean, 30.339 max, 0 min<br />
msecs/first-response: 1091.98 mean, 3455.6 max, 373.751 min<br />
HTTP response codes: code 200 &#8212; 10978</p></blockquote>
<p><strong>Results Analysis</strong></p>
<ul>
<li>mysql_connect
<ul>
<li>Average requests per second: 18.3626</li>
<li>Average requests completed: 11,017</li>
</ul>
</li>
<li>mysql_pconnect
<ul>
<li>Average requests per second: 18.4330</li>
<li>Average requests completed: 11,060</li>
</ul>
</li>
<li>PDO_MySQL non-persistent
<ul>
<li>Average requests per second: 18.4038</li>
<li>Average requests completed: 11,042</li>
</ul>
</li>
<li>PDO_MySQL persistent
<ul>
<li>Average requests per second: 18.0168</li>
<li>Average requests completed: 10,810</li>
</ul>
</li>
</ul>
<p>Basically what the numbers above shows us is that in an isolated environment it makes no difference which connection type you are going to use. My past experience in live heavily trafficked environment says that using non-persistent connections is better than using persistent connections. Where this difference comes shows itself the most is when an apache thread will hang and still hold the persistent connection to mysql preventing other apache processes from connecting. By tweaking your apache and mysql settings you can achieve very good performance with non-persistent connections.</p>
<p><a href="http://www.robertswarthout.com/wp-content/uploads/benchmarking_source.tar.gz">Source files</a> for this benchmarking test.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robertswarthout.com/2008/08/benchmarking-of-mysql-persistent-connections-vs-non-persistent-connections/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
