<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Esoteric Curio - PostgreSQL</title>
    <link>http://lethargy.org/~jesus/</link>
    <description>Theo's Contributions to Technological Surreality</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <pubDate>Wed, 13 Jan 2010 00:54:08 GMT</pubDate>

    <image>
        <url>http://lethargy.org/~jesus/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Esoteric Curio - PostgreSQL - Theo's Contributions to Technological Surreality</title>
        <link>http://lethargy.org/~jesus/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Sexified fonts for the web.</title>
    <link>http://lethargy.org/~jesus/writes/sexified-fonts-for-the-web</link>
            <category>Damaged Bits</category>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
            <category>Rambling</category>
            <category>Writing</category>
    
    <comments>http://lethargy.org/~jesus/writes/sexified-fonts-for-the-web#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=171</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=171</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;&lt;a href=&quot;http://omniti.com/&quot;&gt;OmniTI&lt;/a&gt; has been working with &lt;a href=&quot;http://clearleft.com/&quot;&gt;Clearleft&lt;/a&gt; for a while now on &lt;a href=&quot;http://fontdeck.com/&quot;&gt;Fontdeck&lt;/a&gt;.  The super &lt;a href=&quot;http://omniti.com/is/greg-chiasson&quot;&gt;Greg Chiasson&lt;/a&gt; has been pushing our beta live and I&#039;ve been provisioning machines and setting up infrastructure just so you can read this web page in a nice sexy font... Nice... Sexy.&lt;/p&gt;

&lt;p&gt;And yes, of course, fontdeck is powered by our friends: Apache, PostgreSQL, OpenSolaris, a bit of Linux here and there, a sprinkling of both asymmetric and symmetric cryptography and an ancient dialect of computer-speak called Perl.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 11 Jan 2010 15:08:05 -0500</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/171</guid>
    
</item>
<item>
    <title>Asynchronous PostgreSQL Candy</title>
    <link>http://lethargy.org/~jesus/writes/asynchronous-postgresql-candy</link>
            <category>BWPUG</category>
            <category>Damaged Bits</category>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/asynchronous-postgresql-candy#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=170</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=170</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;I&#039;ve put the first (intended) use of the &lt;a href=&quot;http://labs.omniti.com/trac/pgsoltools/browser/trunk/contrib/pg_amqp&quot;&gt;pg_amqp&lt;/a&gt; setup to the test.  So far I&#039;m very pleased.  While none of the code for the usage is open source the real &quot;magic sauce&quot; is open and has had a few bug fixes and bits of robustness added since I last posted. I can, however, describe the use and let your imagination run while.&lt;/p&gt;

&lt;p&gt;The parts: &lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt;, &lt;a href=&quot;http://www.rabbitmq.com/&quot;&gt;RabbitMQ&lt;/a&gt;, and a bit of Java around &lt;a href=&quot;http://lucene.apache.org&quot;&gt;Lucene&lt;/a&gt;.  Our java program actually uses &lt;a href=&quot;http://www.mortbay.org/jetty/&quot;&gt;jetty&lt;/a&gt; to expose a tiny servlet that accepts search queries and returns json results making AJAX-style searches easy and fast.&lt;/p&gt;

&lt;p&gt;The obvious question we all face in these sort of configurations is &quot;how do keep our search indexes up-to-date?&quot;  Usually, we relax constraints (wisely so) and determine exactly &quot;how up-to-date does out index needs to be.&quot;  If you can answer this question with a number sufficiently far from zero, you&#039;ve won.  In our situation, the user experience must be able to search and find the updated items in database via search immediately after insert or update (within a 100ms or so).&lt;/p&gt;

&lt;p&gt;Enter message queueing.  The first thing we do is make our Java process connect to RabbitMQ, bind a queue and consume.  The messages it consumes from the queue have instructions on the precise element that has changed which then causes an query against the database retrieving all the new data to be reindexed (in our case, it is much more than can be easily witnessed from a trigger on update) and updates the Lucene indexes.&lt;/p&gt;

&lt;p&gt;The second updated we made is to PostgreSQL by installing pg_amqp.  On the tables whose changes should induce reindexing, we add a (or augment the existing) trigger to call: amqp.publish(&#039;amq.direct&#039;, &#039;searchstuff&#039;, E&#039;reindex\t&#039; || NEW.rowid).  Assuming we have a column called rowid, this will queue a message that looks like &quot;reindex&amp;lt;tab&amp;gt;328432&quot;&lt;/p&gt;

&lt;p&gt;The neat part is that if the update is rolled back in the database, the message is never sent.  Otherwise, we see the message from the our indexing and search app and viola.&lt;/p&gt;

&lt;p&gt;I think this technique is really useful for people that are currently leveraging Lucene-based systems to provide powerful search functionality yet keep their data safe and secure in PostgreSQL.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 27 Dec 2009 13:49:32 -0500</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/170</guid>
    
</item>
<item>
    <title>AMQP for PostgreSQL</title>
    <link>http://lethargy.org/~jesus/writes/amqp-for-postgresql</link>
            <category>Damaged Bits</category>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/amqp-for-postgresql#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=169</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=169</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;So, it turns out that being stranded in an airport can lead to some productive output after all.&lt;/p&gt;

&lt;p&gt;I&#039;ve hacked together an AMQP extension for PostgreSQL.  If you don&#039;t know what AMQP or PostgreSQL are, stop reading.&lt;/p&gt;

&lt;p&gt;One thing I&#039;ve needed to do for a while is be able to submit a message to a message queue from within a PostgreSQL transaction.  However, obviously (because we run a real database here), if the transaction aborts I&#039;d rather not have those messages sent.  Enter pg_amqp.&lt;/p&gt;

&lt;p&gt;pg_amqp allows:&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;Multiple connections to different AMQP brokers (configured in the amqp.broker table).&lt;/li&gt;
 &lt;li&gt;Allows for the declaration of an exchange.&lt;/li&gt;
 &lt;li&gt;Tries to be smart about bring up a connection to a broker on demand and leaving it connected to accelerate the next publication request.&lt;/li&gt;
 &lt;li&gt;Allows AMQP publishing from within SQL that is transactionally aware (only publishes on commit).&lt;/li&gt;
 &lt;li&gt;Allows AMQP publishing from within SQL that is autonomous (happens outside the current transaction).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is completely alpha.  I&#039;ve tested it quite a bit by hand, but put no load on it whatsoever.  Monday of next week, I&#039;m going to beat the ever-living @#$% out of it on one of our systems that desperately needs on-commit AMQP notifications.&lt;/p&gt;

&lt;p&gt;I&#039;d love some more eyes on this.  It has some flaws, specifically related to processing asynch events from within a PosgreSQL backend (which has no concept of asynchronous even notification).  As such, if you do stupid stuff, stupid things happen.  The easiest solution is to add a thread to each postgres backend to process the backqueue of events from AMQP; however that so blatantly violates postgres&#039; process model and design that I&#039;ve no intention to do that.  With all the issues aside &amp;#8212; it works pretty well for me.&lt;/p&gt;

&lt;p&gt;I didn&#039;t add queue declaration or the ability to consume from queues.  That was intentional because PostgreSQL can&#039;t run SQL outside of a transaction block making a while(1) { consume, do, commit } impossible from within SQL itself.  Without the ability to do that it seems really useless (and pretty dangerous) to allow someone to do a blocking AMQP frame receive from within SQL.  If you think it would be useful for you, let me know &amp;#8212; it would be a trivial addition.&lt;/p&gt;

&lt;p&gt;Oh yeah: &lt;a href=&quot;https://labs.omniti.com/pgsoltools/trunk/contrib/pg_amqp&quot;&gt;pg_amqp&lt;/a&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sat, 19 Dec 2009 18:00:27 -0500</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/169</guid>
    
</item>
<item>
    <title>OmniTI seeks data management experts; a new type of DBA.</title>
    <link>http://lethargy.org/~jesus/writes/omniti-seeks-data-management-experts;-a-new-type-of-dba</link>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/omniti-seeks-data-management-experts;-a-new-type-of-dba#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=168</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=168</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;What&#039;s a DBA?  Database administrator? Database architect?  Whatever it is, we need one (or two or three) at &lt;a href=&quot;http://omniti.com/&quot;&gt;OmniTI&lt;/a&gt;.  The problem is that the Jurassic variant of the DBA simply can&#039;t cut it in today&#039;s world of the web giants (OmniTI services the web giants).  What is it about the modern use of database in the web world that make traditionals DBAs so inadequate?  It&#039;s actually a variety of things. If you think tackling them is a challenge you&#039;re cut out for, send me your resume!&lt;/p&gt;

&lt;h3&gt;Scale&lt;/h3&gt;

&lt;p&gt;One might say &quot;Scale? Scale? Are you kidding me? Traditional database problems come in various flavors of gigantic.&quot;  This is true, but the unique dynamics of the web mean that not only is the data flowing in at uncontrollable rates, but tomorrow there is always a new data source with a new representation.  Due to the scale of external systems and your own it makes for an interesting sandbox in which we play.  A multi-terabyte database is quite common just about anywhere these days; however, ten of them running four different data management platforms is rather common place within large web infrastructures.&lt;/p&gt;

&lt;h3&gt;Continuity&lt;/h3&gt;

&lt;p&gt;This is the real game changer. This is the mental paradigm shift that classical DBAs struggle with most.  Try this on for size: &quot;no maintenance windows.&quot;  Okay, admittedly that is a stretch, but only a small stretch.  How about 5 minutes of database downtime allowed every 4 weeks or, worse, every 52 weeks.&lt;/p&gt;

&lt;p&gt;Coupled with this is daily (or more frequent) code rollout often times requiring database schema change, new triggers, and different replication dynamics.&lt;/p&gt;

&lt;p&gt;The amount of seemingly ass-backwards engineering required to accomplish this feat is usually described as either: &quot;excruciating pit of hell&quot; or &quot;fascinating enigma.&quot; (I think of it as both)  What I do know is that I have seen some of the most profound data engineering creativity emerge from this insipid constraint.&lt;/p&gt;

&lt;h3&gt;Innovation&lt;/h3&gt;

&lt;p&gt;While noSQL is a fanatical movement that needs to be kept in check, the problems it addresses are real and [some of] the solutions promoted are good.  Understanding when data better fits in a key-value store is something that the classically trained DBA struggles with.  It&#039;s all about data management: Dynomite, CouchDB, Cassandra, Oracle, &lt;a href=&quot;http://omniti.com/does/postgresql&quot;&gt;PostgreSQL&lt;/a&gt;, MySQL… they all have a sweet spot &amp;emdash; know it.&lt;/p&gt;

&lt;h3&gt;Scope&lt;/h3&gt;

&lt;p&gt;The other interesting dynamic has less to do with data management and has more to due with the pace and culture of web companies.  In traditional companies, roles are more disjointed; DBAs have a set of responsibilities that software engineers and system administrators do not have and those two groups have a set of responsibilities with which DBAs need not concern themselves. This &quot;silo effect&quot; spells absolute disaster for web companies.&lt;/p&gt;

&lt;p&gt;The pace on the web is simply too fast (I often think it is a bit reckless, but that&#039;s another rant) to keep all the parts separate.  An insufficient amount of time exists to define how one layer of an architecture will communicate with another layer.  And while the layers meet at reasonable places most of the time, there are other places where the lines are blurred.  These are the points in the architecture that stand to have the highest efficiency, but also are the hardest to troubleshoot; they require an organization of engineers that have no boundaries.  In the case of a DBA… one that wants to look at the ORM code that builds the insanely awful SQL queries that beat the stuffing out of their database every second; one that is actually aware of the storage configuration and layer-2 fabric that sits behind the magical &quot;remembering device&quot; that the database commits things to all day long.&lt;/p&gt;

&lt;h2&gt;Beat you with a stick?&lt;/h2&gt;

&lt;p&gt;Around here, &lt;a href=&quot;http://omniti.com/is/robert-treat&quot;&gt;Robert Treat&lt;/a&gt; runs the show.  The stick wielding and beatings are left to him (he a father of three, so I&#039;m sure he&#039;s more than capable).&lt;/p&gt;

&lt;p&gt;I guess the question is… are you up for the challenge?  Are you a DBA who thinks their job is about more than just ACID?  Are you a developer or an SA that has decided to make a shift and tackle the data management layer with a unique perspective?  Are you interested in mind bending problems that arrive on your plate a bit too quick for anyone&#039;s comfort level?  I hope so, because &lt;a href=&quot;http://omniti.com/is/hiring/database-administrator&quot;&gt;we need people like that&lt;/a&gt;!&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 17 Dec 2009 11:49:25 -0500</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/168</guid>
    
</item>
<item>
    <title>Itch scratched - right between the rabbit's ears.</title>
    <link>http://lethargy.org/~jesus/writes/itch-scratched-right-between-the-rabbits-ears</link>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/itch-scratched-right-between-the-rabbits-ears#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=166</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=166</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;&lt;a href=&quot;http://search.cpan.org/~jesus/Net-RabbitMQ-0.0.1/RabbitMQ.pm&quot;&gt;Net::RabbitMQ&lt;/a&gt;, get it while it&#039;s hot.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 13 Nov 2009 17:18:32 -0500</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/166</guid>
    
</item>
<item>
    <title>Extending and Embedding</title>
    <link>http://lethargy.org/~jesus/writes/extending-and-embedding</link>
            <category>Damaged Bits</category>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/extending-and-embedding#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=165</wfw:comment>

    <slash:comments>10</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=165</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;If you&amp;#8217;re like me, you&amp;#8217;ve read a handful of really useful articles about extending and embedding things like perl, Python, Java, lisp, scheme or lua.  The slant there is a technical one: &amp;#8220;So you need Java, here&amp;#8217;s how to embed it.&amp;#8221;  I&amp;#8217;ve embedded Python once, perl and Java countless times and, most recently, lua.  Throughout this I realized that I don&amp;#8217;t need the languages as much as I need a convenient extension out of C.  In other words, if your foundation app is feature-rich, embedding isn&#039;t as much about adding the features of a specific language as it is about exposing the features of your system.&lt;/p&gt;

&lt;p&gt;Given this context, there is a lack of articles about how to choose the appropriate embedding technology for a given project.  Each language has its own advantages and people religiously argue about them seemingly to no end.  Things get interesting when you look to embedding languages, as their internal implementation decisions start to influence what is and isn&#039;t possible.  I&amp;#8217;ll take you on a brief whirlwind tour of my personal experience embedding.&lt;/p&gt;

&lt;h3&gt;Perl&lt;/h3&gt;

&lt;p&gt;Many of you know I program in Perl quite often.  Many people hate Perl and believe it to be an abomination.  I love Perl for its flexibility, expressiveness and its terseness &amp;#8212; aligning it with myself.  However, the perl (5.10 and earlier) interpreter is a horrid, catastrophic example of how not to write a virtual machine for an interpreted language; spaghetti does not begin to describe that mess that is perl internals.  The API is insufficiently documented, the internal data representations are indecently exposed and the the way thread support was backed into the code (like a garbage truck through a toy shop) make it more than a challenge to embed.  Now, I&amp;#8217;ve been writing XS code for years (the C-like language for extending perl itself) and I know and love the language itself, but I&amp;#8217;d argue that it is rarely a good idea to embed perl in any application.&lt;/p&gt;

&lt;p&gt;You may have noted that I claimed to have embedded perl several times in applications.  Some of those turned out to be a good idea.  Both (yes only two) of those times, the reason it ended up being a good idea was that to make my application more useful I needed the wealth of CPAN (the comprehensive Perl archive network that contains a wealth of easy-to-use Perl wrappers around common needs).  While in the end I won, embedding perl was an awful experience and I wouldn&#039;t recommend it to anyone.  My specific problems came down to debugging memory usage as it transcends from C into Perl heap and the painful problem that is threading within perl.  Each time, integrating into perl&amp;#8217;s threading system proved a waste of time and I ended up starting an interpreter for each thread (or had a resource pool of interpreters from which each thread would reserve).  So many useful CPAN modules aren&amp;#8217;t thread-safe and were never developed with a mindset that they would be loaded into a perl that might be embedded in another system.&lt;/p&gt;

&lt;p&gt;While I love the language, I hate the implementation.&lt;/p&gt;

&lt;h3&gt;Python&lt;/h3&gt;

&lt;p&gt;While I like Python as a language, I personally find that if my job doesn&amp;#8217;t fit in perl and that Python would be a better choice, I usually think a bit harder and realize that C would be even better.  I realize this isn&amp;#8217;t the same mental leap made by most people, but I love C.  C is my favorite language.  In fact, I wouldn&amp;#8217;t be writing this article if I didn&amp;#8217;t write so many applications in C that can benefit from an embedded interpreter to ease configuration and processing tasks.&lt;/p&gt;

&lt;p&gt;In fact, I would argue that Python is a great language to embed because the of the interpreter.  It&#039;s implementation is cleaner than perl&amp;#8217;s &amp;#8212; as I&amp;#8217;ve mentioned the bar could not be set much lower.  The fact is that embedding Python in a complicated multi-threaded and/or even driven application really shows the inadequacies of its embedding design.  That combined with the fact that I&amp;#8217;d rather be coding directly in C means: &quot;I wouldn&amp;#8217;t embed that again.&quot;&lt;/p&gt;

&lt;p&gt;Now, all the applications in which I typically embed interpreters or virtual machines are complicated.  If your application is single-threaded and doesn&amp;#8217;t do extensive co-routines (e.g. closure-oriented programming or event driven systems) then Python could really be an ideal embedding language.&lt;/p&gt;

&lt;h3&gt;Java&lt;/h3&gt;

&lt;p&gt;Java is a complicated discussion.  I have a lot of mixed feelings about Java.  No language should have functions in its core distribution deprecated at the rate that Java boasts &amp;#8212; it&amp;#8217;s dysfunctional.  Java as a language itself is quite nice.  It is powerful, fast, and expressive.  It has some annoyances like its verboseness and sprawling code bases.  It has one true, deep negative: Java programmers.  Now, not all Java programmers are bad, but I&#039;ve seen far too much Java code produced by programmers far and wide that is of a quality that is flat-out unacceptably low.&lt;/p&gt;

&lt;p&gt;When you&amp;#8217;re embedding a language, some of those negatives don&amp;#8217;t matter so much.  We can instead concentrate on ease of embedding.  Java has to be, hands-down, the easiest system to embed.  The API is crystal clear and absolutely complete.  It is all held in a single, small header file called jni.h.  Every time I&amp;#8217;ve embedded Java is has been simple and painless.  JNI team, pat yourself on the back &amp;#8212; I&amp;#8217;ll happily buy a round of beers if we ever run into each other.&lt;/p&gt;

&lt;p&gt;On top of the ease of embedding, the native support for mapping application (C) threads into JVM threads is concise and demonstrates pre-meditated good engineering.&lt;/p&gt;

&lt;p&gt;One reason I don&amp;#8217;t like Java for this is that it isn&amp;#8217;t really &amp;#8220;interpreted.&amp;#8221;  I have to compile (or auto-compile) my code to get it to run in my app.  Now, perhaps I could use Java to pull in something like Jython or JRuby to make a rather obtuse, but convenient, system.  Success via indirection has never been high on my list &amp;#8212; if I ever try it, I&amp;#8217;ll be sure to let you know how it went.&lt;/p&gt;

&lt;h3&gt;Tcl, lisp, ruby, PHP&lt;/h3&gt;

&lt;p&gt;Too old, too arcane, AYFKM, leave it on the web guys, respectively.&lt;/p&gt;

&lt;p&gt;Okay, in all fairness, I didn&amp;#8217;t give Tcl its due.  It&amp;#8217;s likely the most widely embedded language.  I just don&amp;#8217;t like Tcl and it shows.&lt;/p&gt;

&lt;h3&gt;Javascript&lt;/h3&gt;

&lt;p&gt;Javascript deserves its own section for arguments against embedding a language.  If you have a single-threaded program that is not event driven, Javascript is a brilliant choice.  I don&amp;#8217;t remember the last time I wrote an application that was both that simple and was in need of an embedded language.  So, the fact that Javascript has no support for threading makes it utterly painful and obtuse to embed in most systems.  This saddens me.  Of all the languages I program in, Javascript is likely my favorite.  I know this must be on the merits of the syntax and expressiveness of the language because I loathe DOM and anything that touches it.  Oh! how I wish Javascript embraced threading.  Oh! how I wish Javascript had the embeddability of Lua.&lt;/p&gt;

&lt;h3&gt;Lua&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.lua.org/&quot;&gt;Lua&lt;/a&gt; is my new love.  It is the reason I decided to write this article.  I actually don&amp;#8217;t like the lua language.  I don&amp;#8217;t particularly like the internal implementation (garbage collected instead of ref counted).  It doesn&amp;#8217;t have particularly useful extensions to add feature value to your system.  So, what is it about lua?&lt;/p&gt;

&lt;p&gt;I&amp;#8127;ve been working a lot on a system called &lt;a href=&quot;https://labs.omniti.com/trac/reconnoiter&quot;&gt;Reconnoiter&lt;/a&gt;.  noitd, the agent responsible for performing active checks against other systems, has a high-performance hybrid thread/event core.  Writing code for a hybrid thread/event system can be quite mind bending to write and challenging to debug.  Reconnoiter allows writing checks as modules that are dynamically loaded into the system at run-time.  The hybrid thread/event core means that the core itself is capable of handing hundreds of thousands of open sockets (think network connections).  Writing complex event-driven C code severely limits the audience that can contribute check code to this open source project.  This frames the need.&lt;/p&gt;

&lt;p&gt;Managing hundreds of thousands of concurrent threads in the system is a recipe for suboptimal performance.  In order to remove the complexity of event-driven programming, I need to extend Reconnoiter&amp;#8217;s core to a language that could provide the feel of a procedural (or OO) programming atmosphere while maintaining a non-blocking, continuation based implementation for high single-system concurrency.&lt;/p&gt;

&lt;p&gt;Now, this is possible (sort of) with many of the embedding choices. When I get to a point in the interpreted code where I need to suspend what I&amp;#8217;m doing and complete it later when actionable data is available (say date from a network read)  to take some action.  The issue is that in order to resume all these languages where they left off, I need to maintain their C stacks.  This can be accomplished with a user-space threading implementation strategy using setjmp, longjmp and a healthy sprinkling of black magic.  In a lot of ways, this approach doesn&amp;#8217;t solve the problem if requiring a interpreter or VM thread for each concurrent operation which would voraciously consume resources.&lt;/p&gt;

&lt;p&gt;Enter lua, champion of concurrency.  lua is a stack based virtual machine specifically designed for integration with larger C systems.  Within lua, assuming you don&amp;#8217;t use any third-party extensions (of which there are few), I can leverage the &lt;a href=&quot;http://www.lua.org/manual/5.1/manual.html#lua_yield&quot;&gt;lua_yield&lt;/a&gt; and &lt;a href=&quot;http://www.lua.org/manual/5.1/manual.html#lua_resume&quot;&gt;lua_resume&lt;/a&gt; API calls to suspend the execution of a lua co-routine (lua-space thread) without the need of capturing a C stack.  The state of lua&amp;#8217;s execution is represented in the lua stack and simply pick up later right were I left off.  This is a technical nuance, but one that provides a considerable amount of freedom.  In a single thread, I can open 100k network sockets and have them all independently driven by lua programs without maintaining 100k C stacks.  Furthermore, the lua programs give the feel of blocking reads and writes making network programming once again bearable.&lt;/p&gt;

&lt;p&gt;After wrapping Reconnoiter&amp;#8217;s &lt;a href=&quot;https://labs.omniti.com/trac/reconnoiter/browser/trunk/src/eventer&quot;&gt;libeventer&lt;/a&gt; and check systems with lua, I was able to replace the previous incarnations of our HTTP checker (based on libserf, then on libcurl) with a 170 line lua &lt;a href=&quot;https://labs.omniti.com/trac/reconnoiter/browser/trunk/src/modules-lua/noit/HttpClient.lua&quot;&gt;HttpClient&lt;/a&gt; that consumes less memory and less CPU!   If you&amp;#8217;re wondering, yes, the client supports chunked transfer encoding, gzip/deflate content encoding, arbitrary headers, client payloads and methods.&lt;/p&gt;

&lt;p&gt;So, despite not really liking lua as a language (I find its syntax a bit painful), the simplicity of embedding it my application was on par with Java, the fact that it is truly interpreted (no compiling lua before it will run) and the absolutely brilliant exposure of its continuations as first-class embedding APIs puts me in bed with lua.&lt;/p&gt;

&lt;h3&gt;Summation&lt;/h3&gt;

&lt;p&gt;Never embed a language just to embed a language; always have a purpose in mind.  Understand the host architecture in which you need to embed and attempt to match the strong points of a particular interpreter or VM to your needs.  For example, if you have a heavily threaded host architecture, don&amp;#8217;t embed something that doesn&amp;#8217;t support threading well (or claims to but takes global locks).&lt;/p&gt;

&lt;p&gt;Next time I embed, I will start with three preferences: Java, Javascript and Lua.  Sadly, I predict Javascript will be disqualified quickly due to its deficiencies.  Java and Lua both have that pros and cons.  I just hope the next project finds Lua the best bedmate, I&amp;#8217;m already looking forward to working with it again.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 06 Oct 2009 22:21:48 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/165</guid>
    
</item>
<item>
    <title>A look at rubyrep</title>
    <link>http://lethargy.org/~jesus/writes/a-look-at-rubyrep</link>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/a-look-at-rubyrep#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=163</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=163</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;&lt;a href=&quot;http://denishjpatel.blogspot.com/2009/08/yet-another-postgresql-replication-tool.html&quot;&gt;rubyrep looks neat&lt;/a&gt;.  I suppose &lt;a href=&quot;http://omniti.com&quot;&gt;our&lt;/a&gt; next round of tests will have to use it on some billion row tables and see how it fairs.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 20 Aug 2009 15:27:12 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/163</guid>
    
</item>
<item>
    <title>highscalability.com talks about OmniTI's Reconnoiter</title>
    <link>http://lethargy.org/~jesus/writes/highscalabilitycom-talks-about-omnitis-reconnoiter</link>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/highscalabilitycom-talks-about-omnitis-reconnoiter#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=162</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=162</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;It&amp;#8217;s exciting to see things starting to take off.  The momentum and excitement around &lt;a href=&quot;http://labs.omniti.com/trac/reconnoiter/&quot;&gt;Reconnoiter&lt;/a&gt; are at an all time high here at &lt;a href=&quot;http://omniti.com/&quot;&gt;OmniTI&lt;/a&gt;.  I really appreciate Todd Herr&amp;#8217;s &lt;a href=&quot;http://highscalability.com/reconnoiter-large-scale-trending-and-fault-detection&quot;&gt;extensive write up about Reconnoiter&lt;/a&gt; over at &lt;a href=&quot;http://highscalability.com/&quot;&gt;highscalability.com&lt;/a&gt; &amp;#8212; the review was spot on.&lt;/p&gt;

&lt;p&gt;It has ample criticism (all deserved) and we&amp;#8217;re continuing to work on the &amp;#8220;consumability&amp;#8221; aspects of the product.  One of the comments he made was the interesting choice of &lt;a href=&quot;http://lua.org/&quot;&gt;Lua&lt;/a&gt; as a language to extend the product.  I really wanted to use Perl or Python to extend Reconnoiter, but Lua has some pretty magical properties that made it meld well with the noit internals.  In my opinion it is perhaps one of the more technically interesting parts of the product as the search was long and the choice reluctant.  When I have more time, I&amp;#8217;ll write an article about embedding lua in noit and the deeper reasoning behind it.&lt;/p&gt;

&lt;p&gt;Also, don&amp;#8217;t be scared by Lua, you can always write extensions in C!  Although it doesn&amp;#8217;t meld well with its high performance design, there is an &lt;code&gt;extproc&lt;/code&gt; module that allows writing checks as standalone scripts and operates fine with existing &lt;a href=&quot;http://nagios.org/&quot;&gt;Nagios&lt;/a&gt; checks &amp;#8212; I say I wrote it to make adoption a bit easier, but in truth &lt;a href=&quot;http://omniti.com/is/eric-sproul&quot;&gt;Eric&lt;/a&gt; and &lt;a href=&quot;http://omniti.com/is/mark-harrison&quot;&gt;Mark&lt;/a&gt; made me do it.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 16 Aug 2009 15:13:07 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/162</guid>
    
</item>
<item>
    <title>Big Bad Postgres Indeed</title>
    <link>http://lethargy.org/~jesus/writes/big-bad-postgres-indeed</link>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/big-bad-postgres-indeed#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=161</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=161</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;I gave a talk at the Percona Performance conference (same time as MySQL, in the same facility... can we say awkward?) about running large PostgreSQL installs.  I referred to a few instances in the presentation that are a handful of terabytes in size.  In today&#039;s world, these aren&#039;t that large, however we do pretty deep analytics on these installs.  It is most definitely not a case of store and forget.&lt;/p&gt;

&lt;p&gt;A few people came up and said: &quot;I thought you were going to talk about big... a terabyte is not big.&quot;  I would rebut that with it&#039;s not how big it is, it is what you do with it, but then I would be on the defensive.  The truth of the matter is that it is a combination of things.  Size matters: below a certain threshold, you simple can&#039;t call it large.  Usage matters: if you don&#039;t do something interesting with the data, you might as well be throwing it away.  While most of the PostgreSQL instances we deal with were considered larger by 2005 standards, a terabyte simply no longer meets the bare minimum for &quot;large.&quot;&lt;/p&gt;

&lt;p&gt;I&#039;m excited that we&#039;re looking to launch a new service that will turn the tables on large for PostgreSQL.  We very well could have 10 petabytes in postgres in no time if things go as planned.  Not only will we meet the size requirements, we&#039;ll also be doing lots of interesting things with the data.  Big Bad PostgreSQL indeed.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 10 Aug 2009 21:45:39 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/161</guid>
    
</item>
<item>
    <title>Make the web a faster place.  Pretty please.</title>
    <link>http://lethargy.org/~jesus/writes/make-the-web-a-faster-place-pretty-please</link>
            <category>BWPUG</category>
            <category>Damaged Bits</category>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/make-the-web-a-faster-place-pretty-please#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=157</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=157</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;Call to action!  Make the web a faster place!  Here&#039;s a short &lt;a href=&quot;http://omniti.com/seeds/yslow-to-yfast-in-45-minutes&quot;&gt;article on how I spent 45 minutes to improve user-perceived performance&lt;/a&gt; on &lt;a href=&quot;http://omniti.com/&quot;&gt;our website&lt;/a&gt;.  This is the low-hanging fruit of front-end web performance optimizations.&lt;/p&gt;

&lt;p&gt;Most of you who read my blog are scalability or performance nuts.  Most of you also cast the majority of your focus (like me) on the back-end infrastructure problems.  Don&#039;t ignore the front-end when just a tiny bit of work can remove a huge amount of suck.&lt;/p&gt;

&lt;p&gt;If everyone takes these steps, the web will be a more enjoyable place to visit.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 07 Jul 2009 10:36:59 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/157</guid>
    
</item>
<item>
    <title>Web: you can now not suck.</title>
    <link>http://lethargy.org/~jesus/writes/web-you-can-now-not-suck</link>
            <category>Damaged Bits</category>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/web-you-can-now-not-suck#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=156</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=156</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;img src=&quot;http://images.omniti.net/lethargy.org/~jesus/uploads/velocity2009_160x600.gif&quot; alt=&quot;&quot; style=&quot;margin-left: 2em; margin-bottom:1em; float:right;&quot;/&gt;
&lt;p&gt;In perhaps a new trend, I&amp;#8217;m blogging from 39011 feet (or so says the seatback in front of me).  I&amp;#8217;m traveling back home to the east coast from San Jose, CA where I attended (and spoke) at this year&amp;#8217;s &lt;a href=&quot;http://en.oreilly.com/velocity2009/&quot;&gt;O&amp;#8217;Reilly Velocity Conference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I participated (and blogged) about the Velocity Summit in which I&amp;#8217;ve participated for the past two years.  The summit is the unconference preceding the real conference that help the organizers digest current hot topics and better define the conference track for the actual conference.  The summit itself is filled with enough brain power to warp space-time, so I drop everything to go to that.&lt;/p&gt;

&lt;p&gt;Ironically, despite being a well respected authority in web site (and general internet) scalability and performance, my talk proposals for Velocity 2008 were not accepted &amp;#8212; I clearly need to write better proposals.  This year, I managed to work my way into the workshop track on Monday.  Despite having a bad headache and feeling &quot;off&quot; the day before, I managed to get my act together and put on an A-game for my workshop.  For those of you interested, here is &lt;a href=&quot;http://www.slideshare.net/postwait/scalable-internet-architecture&quot;&gt;my scalable09 slide stack&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I thought I&amp;#8217;d take a moment to talk about what I liked about the conference and what I think could use some improvement.  I realize this is a down economy and that might be a legitimate justification for some the actions that resulted in some of my disappointment.&lt;/p&gt;

&lt;p&gt;First, the negative.  I usually start with positive and end with negative because I&amp;#8217;m a pessimist.  However, all in all the conference was awesome, so I thought I&amp;#8217;d get my short list of gripes out of the way early.&lt;/p&gt;

&lt;p&gt;O&amp;#8217;Reilly is infamous for throwing good conferences for geeks.  In my opinion, the field of web operations has been so severely neglected and applies so broadly to the world today that this conference needs to be for everyone.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the next conference, I&amp;#8217;d love to see a technical business track.  Several of the talks I went to spoke to the dollars and cents lost or earned by paying the right amount of attention to web site performance and better operational paradigms.  I thought a lot of the topics would be very useful to business managers.&lt;/li&gt;
&lt;li&gt;The first day was not video taped and the second and third day were only half video taped.  Come on guys, ante up.  The attendance fee was substantial, you can afford to give your attendees the value of watching what they had to choose not to attend.  I like the option when I go to a conference to choose a session that seems interesting so that I have the opportunity to participate, but often times I find that another session was top notch and I &lt;em&gt;expect&lt;/em&gt; to be able to later review a recording of that.&lt;/li&gt;
&lt;li&gt;Lastly, and this is the most significant.  While I thought the conference was extremely well executed (excellent job Jesse, Steve, all your support, and most definitely O&amp;#8217;Reilly), it lacked sufficient PR and marketing outreach.  I talked with several journalists (as a part of my normal day job) while I was at that conference and &lt;em&gt;not one&lt;/em&gt; of them was aware of Velocity &amp;#8212; simply embarrassing.  Given that the Structure conference was in town that same week, O&amp;#8217;Reilly should have invested more in their PR and marketing outreach.  It would have resulted in a substantially increased audience and a better venue for teaching the world to run a faster web.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now that I&amp;#8217;ve griped and aired my disappointment.  I can focus on the gobs of awesomeness that was Velocity.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The conference was put on quite well from an operational perspective.  Things started on time, A/V problems were non-existent.  Like an idiot, I managed to lose my MacBook Air power adapter and the A/V crew managed to recover it for me.  Conferences just plain suck when they have technical difficulties; this one had none.&lt;/li&gt;
&lt;li&gt;The two tracks at the conference were extremely well articulated and while I wanted to be in both all the time (as OmniTI is a full-stack company, we care about both equally) it was an excellent split.&lt;/li&gt;
&lt;li&gt;One track was performance which focused intently on user-perceived performance.  This was largely front-end (HTML,CSS,JS,etc.) but also had a healthy amount of deep stack performance discussion as well including the often ignored, but much deserving networking aspect of delivering the web to users.&lt;/li&gt;
&lt;li&gt;The second track was operations and I feared it would be bunch of blind &amp;#8220;The Cloud Solves All Our Problems&amp;#8221; sessions.  Much to the contrary, it focused heavily on operational strategy and and what it takes to execute tactically.  There was a bit of cloud here and there (okay everywhere), but there was very little blind and ignorant mentality that launching in the cloud was a solution to a hard scaling problem.&lt;/li&gt;
&lt;li&gt;I had the opportunity to see a lot of old faces, but spent most of my time meeting new ones.  The opportunity to learn more about other people&amp;#8217;s problems is what completes me as an engineer.  The people I met at this conference were both honest and open and provided a fabulous and refreshing perspective on what today&amp;#8217;s performance and scalability problems really are.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
In my workshop, I spent about 20% of the time discussing the philosophy of being a good engineer and 80% discussing practice (non-cookbook) with examples and advice.  The basic message is that systems are complex and you must think of all the parts holistically or its a recipe for disaster &amp;#8212; or failure.
&lt;/p&gt;

&lt;p&gt;
Two of my favorite talks were Nicole Sullivan&#039;s &amp;#8220;The Fast and the Fabulous: 9 ways engineering and design come together to make your site slow&amp;#8221; and &amp;#8220; 10+ Deploys Per Day: Dev and Ops Cooperation at Flickr&amp;#8221; by John Allspaw and Paul Hammond.  While Nicole&#039;s presentation, like mine, was not recorded, the other was and if you want to break down the divide between operations and development, it is a &lt;a href=&quot;http://velocityconference.blip.tv/file/2284377/&quot;&gt;must see.&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;All in all, I would encourage everyone reading this to attend next year&#039;s Velocity conference.  I am certain you will walk away with knowledge that is both valuable and applicable.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 25 Jun 2009 23:33:33 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/156</guid>
    
</item>
<item>
    <title>What time is it?</title>
    <link>http://lethargy.org/~jesus/writes/what-time-is-it</link>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/what-time-is-it#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=155</wfw:comment>

    <slash:comments>5</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=155</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;&lt;a href=&quot;http://postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt; has pretty &lt;a href=&quot;http://www.postgresql.org/docs/8.3/static/functions-datetime.html&quot;&gt;awesome date/time functionality&lt;/a&gt;.  I&#039;ve used a lot of database and the functionality and thoroughness of the treatment of dates and times (and particularly timezones) is unparalleled.  As much as I&#039;m impressed with it, I knew there would come a time where the outcome of all that cleverness would backfire.&lt;/p&gt;

&lt;p&gt;Recently, I was &lt;a href=&quot;http://labs.omniti.com/trac/reconnoiter/ticket/140&quot;&gt;doing some data partitioning&lt;/a&gt;.  I split a couple of largish (approximately billion row) tables up into month segments.  I wrote a tiny little pl/pgsql function that takes a parent table, and creates an inherited child with the right indexes, triggers, check constraints (for constraint exclusion) and permissions.  I renamed the big table something transient, created a new parent table with the old table&#039;s name, made the old unwieldy table a child of that table and then created a whole bunch of new partitions.  This allowed me to pretty much ignore my shenanigans from the application side. Once I created the partitions, I need to back populate them.  To do this, I did the following:&lt;/p&gt;

&lt;pre&gt;
ALTER TABLE newchildtable_200903 DISABLE TRIGGER ALL;
INSERT INTO newchildtable_200903
  SELECT * FROM oldcrappytable
  WHERE whence &gt;= &#039;2009-03-01 00:00:00-00&#039;::timestamptz
      AND whence &lt; &#039;2009-03-01 00:00:00-00&#039;::timstamptz + &#039;1 month&#039;::interval;
DELETE FROM oldcrappytable
  WHERE whence &gt;= &#039;2009-03-01 00:00:00-00&#039;::timestamptz
      AND whence &lt; &#039;2009-03-01 00:00:00-00&#039;::timstamptz + &#039;1 month&#039;::interval;
ALTER TABLE newchildtable_200903 ENABLE TRIGGER ALL;
&lt;/pre&gt;

&lt;p&gt;Suffice it to say, this did not do what I wanted &lt;em&gt;at all&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;PostgreSQL&#039;s interval type is one of its more clever features.  The idea that a month isn&#039;t always equal to a month is a Gregorian truism.  So, PostgreSQL is design to &quot;do the right thing&quot; and consider a month in the context of another argument.  A month in the above example is a month with respect to March.  Right?  No.&lt;/p&gt;

&lt;p&gt;The lacking part here is the timezone.  I do the partitioning in UTC (because I&#039;m not insane).  So, I need the month of March in UTC.  Although I explicitly stated &#039;2009-03-01 00:00:00-00&#039; in UTC, PostgreSQL interprets that in the client&#039;s timezone... and &lt;em&gt;then&lt;/em&gt; adds a month.  I&#039;m in US/Eastern which is &lt;em&gt;trailing&lt;/em&gt; UTC by four or five hours and thus the reference starting point is actually in February of 2009, which only had 28 days.  So, the latter inequality up there does not do through the end of March!&lt;/p&gt;

&lt;p&gt;I would argue that this behavior is invalid, because of the extremely unexpected results of the following simple test case:&lt;/p&gt;

&lt;pre&gt;
postgres=# select (&#039;2009-03-01 00:00:00-00&#039;::timestamptz + &#039;1 month&#039;::interval);
2009-03-28 19:00:00-04

postgres=# set timezone = &#039;utc&#039;;
SET

postgres=# select (&#039;2009-03-01 00:00:00-00&#039;::timestamptz + &#039;1 month&#039;::interval);
2009-04-01 00:00:00+00
&lt;/pre&gt;

&lt;p&gt;Here I get a &lt;em&gt;completely&lt;/em&gt; different date/time if I ask what appears to be a very unambiguous question depending on whether I&#039;m left or right of the &lt;a href=&quot;http://en.wikipedia.org/wiki/Prime_meridian&quot;&gt;Prime Meridian&lt;/a&gt;. 
    </content:encoded>

    <pubDate>Tue, 16 Jun 2009 15:28:40 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/155</guid>
    
</item>
<item>
    <title>Cloud storage primer</title>
    <link>http://lethargy.org/~jesus/writes/cloud-storage-primer</link>
            <category>Damaged Bits</category>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/cloud-storage-primer#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=154</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=154</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;I post here, I post there... I certainly don&#039;t post everywhere.  Anyway, I wrote an article that &lt;a href=&quot;http://omniti.com/seeds/concepts-of-cloudish-storage&quot;&gt;discusses the basic technologies that power large cloud-like storage systems&lt;/a&gt;.  Thought you might be interested.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 11 Jun 2009 16:41:27 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/154</guid>
    
</item>
<item>
    <title>Reconnoiter Update</title>
    <link>http://lethargy.org/~jesus/writes/reconnoiter-update</link>
            <category>OpenSolaris</category>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/reconnoiter-update#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=153</wfw:comment>

    <slash:comments>5</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=153</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;&lt;img src=&quot;http://labs.omniti.com/reconnoiter/docs/assets/Noit_72dpi_noBkgrnd.png&quot; style=&quot;float:right;&quot;/&gt;
A little over a year ago, I started in on a project that was of significant scope.  Not a few scripts hacked together, nor a conglomeration of pre-existing tools, but rather a carefully engineered product.  What product is this?  &lt;a href=&quot;https://labs.omniti.com/trac/reconnoiter&quot;&gt;Reconnoiter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;About 10 years ago, &lt;a href=&quot;http://omniti.com/&quot;&gt;we&lt;/a&gt; were neck deep in large scale e-mail architecture.  We felt pain, we were up at 3am &lt;em&gt;every&lt;/em&gt; night attempting to make systems work.  Finally, we decided enough was enough and started a skunkworks project to build a better e-mail server.  Well, that turned out pretty well.  It&#039;s got considerable momentum at this stage and is &lt;a href=&quot;http://messagesystems.com/&quot;&gt;leading the industry as the most advanced digital messaging platform on the planet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Over the past several (12) years, we have run operations for small and large sites alike.  We&#039;re responsible for waking up and fixing things at 3am when they are not working.  We&#039;re responsible for not only designing highly scalable architectures, we&#039;re responsible sticking around and seeing them through to the finish.  Many people are writing tools for management; two in the recent spotlight are &lt;a href=&quot;http://reductivelabs.com/products/puppet/&quot;&gt;Puppet&lt;/a&gt; and &lt;a href=&quot;http://wiki.opscode.com/display/chef/Home&quot;&gt;Chef&lt;/a&gt;.  We had very little pain in the arena of provisioning and maintaining systems.  I have a theory as to why that is, but that is a topic for another monologue.  One of the distinct pains we have suffered since we began revolves around monitoring.&lt;/p&gt;

&lt;p&gt;The first issue is that monitoring is two things:&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;trend analysis for long-term capacity planning and postmortem analysis,&lt;/il&gt;
&lt;li&gt;fault detection.&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;There are many tools today that are hard to use and fail to address our needs for managing thousands of very different machines.  Worse, the tools do only one or the other.  This means that we must invest time checking disk space in the fault detection tool to alert us when it is &quot;too full&quot; and configure a similar check in a trending tool to show us historical information.  Some patchwork was introduced into fault detection tools like Nagios to add trending features... and when I use it, it is clear it was not central to the design.&lt;/p&gt;

&lt;p&gt;I have a lot of gripes, but I won&#039;t go into all of them.  Suffice to say I have them and I think they are the true fuel for developing a next-gen tool to make operations folk suffer less.  Combine that with the combustive talent of the engineering group at OmniTI (and now a few outside it) and the oxygen that the open source community provides, and we&#039;ll be having a barbecue in no time.&lt;/p&gt;

&lt;h3&gt;So what&#039;s new?&lt;/h3&gt;

&lt;p&gt;A lot has happened in recent months on the Reconnoiter front. Here&#039;s a set of highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OmniTI labs got its IANA enterprise number.  On that we build SNMP trap support into noitd.&lt;/li&gt;
&lt;li&gt;Reconnoiter got its &lt;a href=&quot;http://www.google.com/search?q=reconnoiter+IANA+well+known+tcp&quot;&gt;IANA assigned port number&lt;/a&gt;, no more picking random ports. 43919 or bust!&lt;/li&gt;
&lt;li&gt;We support durable streaming (for collection and storage of metrics)&lt;/li&gt;
&lt;li&gt;We support temporal streaming and check cloning for real-time, high-granularity metric collection.  This means cross-check (even cross-datacenter) real-time graphs for pretty awesome event correlation.&lt;/li&gt;
&lt;li&gt;We integrated &lt;a href=&quot;http://esper.codehaus.org/&quot;&gt;Esper&lt;/a&gt; as a streaming database (complex event processor) as the foundation on which to build fault detection.  There&#039;s a long way to go here, but the plumbing is in place.&lt;/li&gt;
&lt;li&gt;We build a custodial daemon capable of running nagios-type checks to ease adoption -- even though it made me cry.&lt;/li&gt;
&lt;li&gt;We started sitting on #noit on freenode, though it is still eerily quiet in there.&lt;/li&gt;
&lt;li&gt;We got some new users with the brilliant patience for alpha software and excellent feedback!&lt;/li&gt;
&lt;li&gt;I&#039;ll be talking about &lt;a href=&quot;http://en.oreilly.com/oscon2009/public/schedule/detail/7931&quot;&gt;Reconnoiter at the 2009 O&#039;Reilly Open Source Convention&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;It&#039;s starting to get some &lt;a href=&quot;http://itknowledgeexchange.techtarget.com/server-farm/new-open-source-it-management-tool-lighter-weight-than-nagios-more-granular-than-cacti/&quot;&gt;serious attention&lt;/a&gt;, so it&#039;s time we add some polish!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We&#039;ve been slowly introducing our managed clients to Reconnoiter and we have, at this point, about a terabyte of metric data.  In Reconnoiter, there is no default action to discard data.  Yes, that&#039;s right.  Go buy more disk.  It&#039;s cheap.  You&#039;ll thank me next time you have an anomaly today that you &lt;em&gt;think&lt;/em&gt; reminds you of one seven months ago... and when you go look at the graph you actually find all the data at its original granularity.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 04 Jun 2009 08:04:34 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/153</guid>
    
</item>
<item>
    <title>Robert, spreading the wealth as usual.</title>
    <link>http://lethargy.org/~jesus/writes/robert-spreading-the-wealth-as-usual</link>
            <category>PostgreSQL</category>
    
    <comments>http://lethargy.org/~jesus/writes/robert-spreading-the-wealth-as-usual#comments</comments>
    <wfw:comment>http://lethargy.org/~jesus/wfwcomment.php?cid=148</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://lethargy.org/~jesus/rss.php?version=2.0&amp;type=comments&amp;cid=148</wfw:commentRss>
    

    <author>nospam@example.com (Theo Schlossnagle)</author>
    <content:encoded>
    &lt;p&gt;I&#039;m pretty excited that &lt;a href=&quot;http://omniti.com/is/robert-treat&quot;&gt;Robert Treat&lt;/a&gt; is talking at &lt;a href=&quot;http://postgresqlconference.org/&quot;&gt;PostgreSQL Conference East 2009&lt;/a&gt;.  He&#039;ll be talking about the upcoming release of PostgreSQL 8.4.  The postgres product is pretty complete and has been pretty complete for quite some time.  I&#039;ve been noted for saying I wouldn&#039;t use a database feature in production that hasn&#039;t been available (and tested) for several years.  As such, it is a bit ironic for me to say I&#039;m excited for a new release of a database product.  Let me explain myself.&lt;/p&gt;

&lt;p&gt;I&#039;m excited by several of the new features coming in PostgreSQL 8.4 because the sooner they are released, the sooner I can start my count down to when I&#039;d trust them in production.  Okay, that&#039;s not entirely fair.  When you &lt;a href=&quot;http://omniti.com/seeds/embracing-failure-to-rise-above-enterprise-class-thinking&quot;&gt;engineer things to embrace failure&lt;/a&gt; it is easy to launch newly released features with less risk.  However, &lt;a href=&quot;http://omniti.com/&quot;&gt;we run people&#039;s online businesses&lt;/a&gt;.  Some things (e.g. those that must comply with &lt;a href=&quot;https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml&quot;&gt;these specifications&lt;/a&gt;), even if engineered to allow for failures, you simply don&#039;t take the chance.  For other things, you can embrace failure and improve the product through feedback by running them in a globally trafficked, high impact environment.&lt;/p&gt;

&lt;p&gt;Whatever the circumstances, I&#039;m excited by the pending PostgreSQL 8.4 release.  Perhaps Robert will give the same presentation to OmniTI at one of our weekly development sessions so that we know what the hell is going on.&lt;/p&gt;

&lt;p&gt;Make sure you check out &lt;a href=&quot;http://postgresqlconference.org/2009/east/talks&quot;&gt;Robert&#039;s talk&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
Another year, another PostgreSQL release, and once again this release packed full of new features that will help you whether you develop apps inside or outside the database, or you just need to keep them running. This talk will give an overview of the new features available in 8.4, and give you pointers to talks during the rest of the conference you&#039;ll want to focus on to get the most out of 8.4.
&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Thu, 02 Apr 2009 22:36:55 -0400</pubDate>
    <guid isPermaLink="false">http://lethargy.org/~jesus/writes/148</guid>
    
</item>

</channel>
</rss>