<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>Where am I?</title>
    <link>http://blakeley.com/blogofile</link>
    <description>Performance, scalability, databases, and whatever comes up.</description>
    <pubDate>Wed, 25 Jan 2012 21:30:52 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>MrCombo v1.1</title>
      <link>http://blakeley.com/blogofile/2012/01/07/mrcombo-v1.1</link>
      <pubDate>Sat, 07 Jan 2012 11:00:00 UTC</pubDate>
      <category><![CDATA[iOS/iPhone/iPad]]></category>
      <guid isPermaLink="true">http://blakeley.com/blogofile/2012/01/07/mrcombo-v1.1</guid>
      <description>MrCombo v1.1</description>
      <content:encoded><![CDATA[<p>MrCombo v1.1 is now available in the iOS App Store.
As with v1.0, this app lets you build lists in a two-level hierarchy:
<code>combo &gt; group &gt; item</code>. Then MrCombo can shuffle your items to create a mix.
Sample data includes ordering a pizza, picking an outfit,
and picking a traditional shave with a double-edge (DE) razor.
These are samples: edit them, or create your own combinations.</p>
<p>New features in v1.1 include:</p>
<ul>
<li>Lock items in a mix, so you can have partly-random mixes.</li>
<li>Save a mix to your local history.</li>
<li>Attach a photo to a saved mix.</li>
<li>Share saved mixes via clipboard, email, or WordPress.</li>
<li>Bulk add several items at once into a group.</li>
<li>Import and export combos to the clipboard.</li>
<li>Import and export combos to Dropbox.</li>
</ul>
<p>For now MrCombo is free, but if I keep adding more features that may change.</p>
<p>You can <a href="/ios/mrcombo">read more about MrCombo</a>
or <a href="http://itunes.apple.com/us/app/mrcombo/id489265191">get MrCombo on iTunes</a>.</p>
<p>If you run into problems with MrCombo, you can reach me through the App Store
or post a comment right here.</p>]]></content:encoded>
    </item>
    <item>
      <title>Conditional Profiling for MarkLogic</title>
      <link>http://blakeley.com/blogofile/2011/12/14/conditional-profiling-for-marklogic</link>
      <pubDate>Wed, 14 Dec 2011 15:16:17 UTC</pubDate>
      <category><![CDATA[XQuery]]></category>
      <category><![CDATA[MarkLogic]]></category>
      <guid isPermaLink="true">http://blakeley.com/blogofile/2011/12/14/conditional-profiling-for-marklogic</guid>
      <description>Conditional Profiling for MarkLogic</description>
      <content:encoded><![CDATA[<p>Today I pushed <a href="https://github.com/mblakele/cprof">cprof</a> to GitHub.
This XQuery library helps application developers
who need to retrofit existing applications with profiling capabilities.
Just replace all your existing calls to
<code>xdmp:eval</code>, <code>xdmp:invoke</code>, <code>xdmp:value</code>,
<code>xdmp:xslt-eval</code>, and <code>xdmp:xslt-eval</code> with corresponding <code>cprof:</code> calls.
Add a little logic around <code>cprof:enable</code> and <code>cprof:report</code>, and you are done.</p>]]></content:encoded>
    </item>
    <item>
      <title>MrCombo v1.0</title>
      <link>http://blakeley.com/blogofile/2011/12/13/mrcombo-v1.0</link>
      <pubDate>Tue, 13 Dec 2011 14:15:16 UTC</pubDate>
      <category><![CDATA[iOS/iPhone/iPad]]></category>
      <guid isPermaLink="true">http://blakeley.com/blogofile/2011/12/13/mrcombo-v1.0</guid>
      <description>MrCombo v1.0</description>
      <content:encoded><![CDATA[<p>I have submitted a new iOS application to Apple: MrCombo.
This app lets you build lists in a two-level hierarchy:
combo &gt; group &gt; item. Then you can shuffle the items to mix it up.
Sample data includes ordering a pizza and picking an outfit,
but you are meant to create your own combinations.</p>
<p>Yes, it's a bit silly. But I find it fun and useful
so I thought I would release it.
For now MrCombo is free, but if I keep adding more features that may change.</p>
<p>You can <a href="/ios/mrcombo">read more about MrCombo</a>
or <a href="http://itunes.apple.com/us/app/mrcombo/id489265191">get MrCombo on iTunes</a>.</p>
<p>If you run into problems with MrCombo, you can reach me through the App Store
or post a comment right here.</p>]]></content:encoded>
    </item>
    <item>
      <title>AlbumMixer v1.10 and iTunes Match</title>
      <link>http://blakeley.com/blogofile/2011/11/28/albummixer-v1.10-and-itunes-match</link>
      <pubDate>Mon, 28 Nov 2011 13:00:00 UTC</pubDate>
      <category><![CDATA[iOS/iPhone/iPad]]></category>
      <guid isPermaLink="true">http://blakeley.com/blogofile/2011/11/28/albummixer-v1.10-and-itunes-match</guid>
      <description>AlbumMixer v1.10 and iTunes Match</description>
      <content:encoded><![CDATA[<p>I am hearing early reports that AlbumMixer v1.10 has problems
with iTunes Match and playlists. So far I haven't been able to reproduce this,
but I am working on it. If you see any problems and can provide details,
please comment here.</p>
<p><strong>Update</strong>: Based on additional user reports,
plus a lack of crash reports from Apple, I think this is an iOS or iCloud issue.
Because of this and other current issues being discussed
on <a href="https://discussions.apple.com/community/itunes/itunes_match">Apple forums</a>
<strong>I cannot recommend signing up for iTunes Match at this time</strong>.
If you decide to risk it, start by backing up your entire iTunes library.
Apple seems to be refunding subscription fees to some users,
but that won't be much of a consolation if you lose a large media library.</p>]]></content:encoded>
    </item>
    <item>
      <title>Testing AWS EC2 Instances for Co-Residence</title>
      <link>http://blakeley.com/blogofile/2011/11/21/testing-aws-ec2-instances-for-co-residence</link>
      <pubDate>Mon, 21 Nov 2011 13:00:00 UTC</pubDate>
      <category><![CDATA[AWS]]></category>
      <guid isPermaLink="true">http://blakeley.com/blogofile/2011/11/21/testing-aws-ec2-instances-for-co-residence</guid>
      <description>Testing AWS EC2 Instances for Co-Residence</description>
      <content:encoded><![CDATA[<p>Have you ever thought about setting up a cluster of software nodes
using Amazon's EC2 infrastructure? You may have wondered what happens
if Amazon's underlying hardware should fail.
That hardware runs the hypervisor for your EC2 instance,
and if it fails so does your instance. If you have a cluster of N nodes,
what happens to the cluster?</p>
<p>Most cluster software includes some mechanism to handle host failures.
But the cluster was usually designed to run on real hosts, not virtual machines.
In most cases a hardware or software fault should take out exactly one host.
But in a virtualized environment the same fault might affect
more than one virtual machine. This is especially true in a cloud environment
like EC2, where you have no visibility into the hypervisor.</p>
<p>At first this may not seem to be a problem. If you create four EC2 instances
at the same time, they usually seem to start on different hypervisors.
So a hypervisor failure will only affect one instance,
and the cluster failover mechanisms will operate as usual.</p>
<p>But when an instance does fail, you will want to replace it. How can you ensure
that the replacement instance won't be co-resident
with any of your existing instances?
If the replacement instance is co-resident with an existing cluster instance,
and another hypervisor fault affects both instances, the cluster will go down.
Depending on the circumstances, you may lose data too.</p>
<p>So how can we prevent this? One idea is to include a pool of spare instances
when we create the cluster instances. But this makes the cluster more expensive.
We cannot stop the spare instances either, because when we start them again
they may end up co-resident with another instance. Over time we may also
exhaust this pool of spares, leaving us with the original problem again.
How can we avoid co-resident cluster instances?</p>
<p>If we could detect co-residence, we could simply create instances
until we get one that is not co-resident. This approach is crude,
but should be effective.</p>
<ol>
<li>Create instance (or start existing stopped instance).</li>
<li>Check co-residence for each existing instance.</li>
<li>If co-resident, stop the instance and return to step #1.</li>
</ol>
<p>Any instance that makes it past step #3 is not co-resident
with any existing member of the cluster instance, and can join the cluster.
This leads to a new problem: how can we test for co-residence?</p>
<p>AWS does not appear to provide an easy way to do this.
Allowing instances visibility into the hypervisor could lead to security holes.
This problem has been discussed by
<a href="http://www.cs.tau.ac.il/~tromer/papers/cloudsec.pdf">Ristenpart, Tromer, et al</a>.
My own experiments suggest that AWS has changed its network topology since 2009,
but I did find a technique that seems to work.</p>
<p>From what I can tell, each AWS hypervisor acts as a gateway
for its guest instances. Each guest instance runs on its own subnet.
So knowing the IP address alone tells us nothing,
but knowing the network hops from one instance to another could be revealing.</p>
<p>If each hypervisor acts as a gateway, then packets sent between
two co-resident instances will always need exactly two hops.
Packets sent between instances that are not co-resident will need more hops.</p>
<script src="https://gist.github.com/1383958.js"> </script>

<p>We can conclude that ip-10-87-117-148 and ip-10-87-69-9 are co-resident.</p>
<script src="https://gist.github.com/1383949.js"> </script>

<p>We can conclude that ip-10-91-9-230 and ip-10-87-117-148 are <em>not</em> co-resident.</p>
<p>Note that this technique may not be foolproof.
If Amazon believes that this information compromises security,
they could probably reconfigure their hypervisors so that new instances
would hop through a random number of extra gateways. This would add some latency
to the network, but more importantly would keep the guest instance
from using this technique to determine whether or not it is co-resident
with some other instance. That would be a shame for those of us
using AWS for highly-available cluster applications...
unless AWS also added a <em>supported technique</em> for avoiding co-residence.</p>]]></content:encoded>
    </item>
    <item>
      <title>Init blogofile</title>
      <link>http://blakeley.com/blogofile/2011/11/04/init-blogofile</link>
      <pubDate>Fri, 04 Nov 2011 16:00:00 UTC</pubDate>
      <category><![CDATA[housekeeping]]></category>
      <guid isPermaLink="true">http://blakeley.com/blogofile/2011/11/04/init-blogofile</guid>
      <description>Init blogofile</description>
      <content:encoded><![CDATA[<p>Yesterday I moved my WordPress comments to disqus,
and today blakeley.com moves to <a href="http://blogofile.com/">Blogofile</a>.
Please let me know if you run into any problems.</p>]]></content:encoded>
    </item>
    <item>
      <title>Before you upgrade to 5.0-1</title>
      <link>http://blakeley.com/blogofile/archives/599</link>
      <pubDate>Thu, 03 Nov 2011 08:47:15 UTC</pubDate>
      <category><![CDATA[Mark Logic]]></category>
      <guid>http://blakeley.com/blogofile/archives/599</guid>
      <description>Before you upgrade to 5.0-1</description>
      <content:encoded><![CDATA[
Thinking about upgrading to <a href="http://developer.marklogic.com/">MarkLogic Server 5.0-1</a>?
<br/><br/>
As usual, back up everything. I haven't seen any data loss myself, but it is your data so be careful.
<br/><br/>
If you have made any changes to Docs (port 8000) or App Services (8002), the app-services portion of the upgrade won't happen (but the rest of the server will be fine). If you want to use the new monitoring services, you want that part of the upgrade to happen.
<br/><br/>
The fix is to revert your changes to ports 8000 and 8002. If you have repurposed either port for <a href="http://github.com/marklogic/cq/">cq</a>, you may want to go into cq and export all any *local* sessions before changing anything. Local sessions in cq are tied to local browser storage, which is tied to host and port, so you will lose access to them if you change the cq port. Not many folks seem to use cq's local sessions, but I thought I'd mention it. Whether you use cq on those ports or not, make sure port 8000 has root <code>Docs/</code> and 8002 has root <code>Apps/</code> or <code>Apps/appbuilder/</code> - you can see these checks in <code>Admin/lib/upgrade.xqy</code>, function <code>check-prereqs-50</code>.
<br/><br/>
If <code>upgrade.xqy</code> decides not to upgrade your App Services configuration, it will log a message "Skipping appservices upgrades, prerequisites not met." at level "error". The rest of the server will function correctly, but you won't get the appservices part of 5.0.<br/><br/>
]]></content:encoded>
    </item>
    <item>
      <title>Rebalancing for CoRB</title>
      <link>http://blakeley.com/blogofile/archives/597</link>
      <pubDate>Tue, 01 Nov 2011 20:50:34 UTC</pubDate>
      <category><![CDATA[XQuery]]></category>
      <category><![CDATA[Mark Logic]]></category>
      <guid>http://blakeley.com/blogofile/archives/597</guid>
      <description>Rebalancing for CoRB</description>
      <content:encoded><![CDATA[
I've written some quick scripts for <a href="https://github.com/mblakele/corb-rebalancer">rebalancing forests in a MarkLogic Server database</a>. This leverages CoRB, and makes the job fairly simple. So if you add more forests to a database, and don't have the luxury of clearing and reloading, I hope this code will help.<br/><br/>
]]></content:encoded>
    </item>
    <item>
      <title>MarkLogic 5.0 - First Look</title>
      <link>http://blakeley.com/blogofile/archives/577</link>
      <pubDate>Tue, 01 Nov 2011 12:24:23 UTC</pubDate>
      <category><![CDATA[XQuery]]></category>
      <category><![CDATA[Mark Logic]]></category>
      <guid>http://blakeley.com/blogofile/archives/577</guid>
      <description>MarkLogic 5.0 - First Look</description>
      <content:encoded><![CDATA[
In case you have missed the news, <a href="http://developer.marklogic.com/download">MarkLogic Server 5.0-1</a> is now available. The upgrade went smoothly for me, but this is a major release so it is wise to back up your databases and configuration before upgrading. The on-disk forest version appears to have changed, which will trigger reindexing of all forests. You may want to manually disable reindexing before upgrading, so that you don't have to contend with multiple forests trying to reindex at the same time.
<br/><br/>
This is also a good time to double-check your free disk space, since reindexing uses extra disk space. Some of that space won't be released when reindexing finishes, either. For example, one of my forests looked like this:
<br/><br/>
<div>
<a href="/blogofile/images/wp-content/2011/11/Screen-shot-2011-11-01-at-10.15.11-.png"><img class="size-medium wp-image-580" title="Forest status after reindexing" src="/blogofile/images/wp-content/2011/11/Screen-shot-2011-11-01-at-10.15.11--300x47.png" alt="This forest is holding on to over 2-GiB of deleted fragments." width="300" height="47" /></a>
</div>
<br/><br/>
You can purge those deleted fragments by forcing a merge of the forest, or of the entire database. After doing this, my forest used less disk space.
<br/><br/>
<div>
<a href="/blogofile/images/wp-content/2011/11/Screen-shot-2011-11-01-at-10.24.34-.png"><img class="size-medium wp-image-580" title="Forest status after forced merge" src="/blogofile/images/wp-content/2011/11/Screen-shot-2011-11-01-at-10.24.34--300x32.png" alt="After the forced merge, the deleted fragments are gone and the forest is smaller." width="300" height="32" /></a>
</div>
<br/><br/>
This new release is stricter about unquoted attributes. With previous releases this would generally work, even though the <a href="http://www.w3.org/TR/xquery/#doc-xquery-DirectConstructor">XQuery 1.0 Recommendation</a> requires quoted attribute values:
<p style="padding-left: 30px;"><span style="font-family: monospace;">&lt;test a={xdmp:random()}/&gt;</span></p>
<br/><br/>
Now it throws an <code>XDMP-UNEXPECTED</code> error. Quote the attribute value correctly, and the problem is fixed.
<p style="padding-left: 30px;"><span style="font-family: monospace;">&lt;test a="{xdmp:random()}"/&gt;</span></p>
<br/><br/>
I'm looking forward to learning more about the 5.0 release, but so far it looks good.<br/><br/>
]]></content:encoded>
    </item>
    <item>
      <title>Yet another search parser - XQYSP</title>
      <link>http://blakeley.com/blogofile/archives/588</link>
      <pubDate>Mon, 24 Oct 2011 13:19:59 UTC</pubDate>
      <category><![CDATA[XQuery]]></category>
      <category><![CDATA[Mark Logic]]></category>
      <guid>http://blakeley.com/blogofile/archives/588</guid>
      <description>Yet another search parser - XQYSP</description>
      <content:encoded><![CDATA[
If you need something a little more sophisticated that the search parser built into the MarkLogic search API, give <a href="https://github.com/mblakele/xqysp">XQYSP</a> a try. It supports nested groups, range queries, near queries with distance and ordering, and should be fairly easy to extend.
<br/><br/>
XQYSP takes a slightly different approach than the Search API or the older lib-parser.xqy, both of which returned cts:query items. Instead, XQYSP returns an abstract syntax tree (AST) as XML. It is up to you, the caller, to transform that AST into a cts:query. That is a little more work for you, but adds a lot of flexibility at the same time. Most of the tasks that used to go into lib-parser-custom.xqy can now be implemented without changing the parser itself. To make it easier to get started, though, I have provided sample code to generate a query from an AST. I hope it is useful.<br/><br/>
]]></content:encoded>
    </item>
  </channel>
</rss>

