<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Performance on traviscj/blog</title>
    <link>https://traviscj.com/blog/tags/performance/</link>
    <description>Recent content in Performance on traviscj/blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 29 Oct 2018 18:30:00 +0000</lastBuildDate>
    <atom:link href="https://traviscj.com/blog/tags/performance/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>sharded feeds</title>
      <link>https://traviscj.com/blog/post/2018-10-29-sharded_feeds/</link>
      <pubDate>Mon, 29 Oct 2018 18:30:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-10-29-sharded_feeds/</guid>
      <description>&lt;p&gt;Suppose that:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;our humble &lt;a href=&#34;https://traviscj.com/blog/post/2018-06-29-mysql_feeds/&#34;&gt;KV feed&lt;/a&gt; sees &lt;em&gt;a lot&lt;/em&gt; of traffic.&lt;/li&gt;&#xA;&lt;li&gt;someone needs to consume our &lt;a href=&#34;https://traviscj.com/blog/post/2018-06-29-mysql_feeds/&#34;&gt;KV feed&lt;/a&gt; with multiple threads.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;data&#34;&gt;data&lt;/h3&gt;&#xA;&lt;p&gt;The first step is to introduce a notion of &amp;ldquo;shards&amp;rdquo; into our data model:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;ALTER&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;TABLE&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;kv&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;ADD&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;COLUMN&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;shard&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt; INT(&lt;span style=&#34;color:#ae81ff&#34;&gt;11&lt;/span&gt;) &lt;span style=&#34;color:#66d9ef&#34;&gt;DEFAULT&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;0&amp;#39;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;ADD&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;INDEX&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;k_fsi_s&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;feed_sync_id&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;shard&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;publishing&#34;&gt;publishing&lt;/h3&gt;&#xA;&lt;p&gt;We don&amp;rsquo;t need to alter the publishing until the publishing &lt;em&gt;itself&lt;/em&gt; is too slow to work with a single thread, but this introduces a &lt;em&gt;lot&lt;/em&gt; of complications, so let&amp;rsquo;s just hold off for now.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Feeds as cache invalidation mechanism</title>
      <link>https://traviscj.com/blog/post/2018-10-03-feeds_as_cache_invalidation_mechanism/</link>
      <pubDate>Wed, 03 Oct 2018 02:31:43 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-10-03-feeds_as_cache_invalidation_mechanism/</guid>
      <description>&lt;p&gt;One really cool use of &lt;a href=&#34;https://traviscj.com/blog/post/2018-06-29-mysql_feeds/&#34;&gt;feeds&lt;/a&gt; we&amp;rsquo;ve realized is that it gives a very efficient mechanism for application code to load the most recent versions of a table into memory.&#xA;The basic idea is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Set it up as a usual feed published table with an appropriate index on &lt;code&gt;feed_sync_id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Either alongside or within the cache, represent the latest loaded &lt;code&gt;feed_sync_id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Set up a cronjob/etc that reads the latest &lt;code&gt;feed_sync_id&lt;/code&gt; and compares it to the cache&amp;rsquo;s &lt;code&gt;feed_sync_id&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If they differ, reload the cache.&lt;/li&gt;&#xA;&lt;li&gt;Ensure that all changes set &lt;code&gt;feed_sync_id&lt;/code&gt; to null!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This works really well because the &lt;code&gt;feed_sync_id&lt;/code&gt; in the database only gets updated on changes, so the reload cronjob mostly is a no-op.&#xA;This means we can reload very frequently!&lt;/p&gt;</description>
    </item>
    <item>
      <title>piping for fun and profit</title>
      <link>https://traviscj.com/blog/post/2014-05-29-piping_for_fun_and_profit/</link>
      <pubDate>Thu, 29 May 2014 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2014-05-29-piping_for_fun_and_profit/</guid>
      <description>&lt;p&gt;I recently discovered something pretty cool: groovy, and in particular groovysh. It lets you do cool stuff like run&#xA;JVM functions:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;➜  ~  groovysh&#xA;Groovy Shell (2.3.3, JVM: 1.8.0)&#xA;Type &#39;:help&#39; or &#39;:h&#39; for help.&#xA;-------------------------------------------------------------------------------&#xA;groovy:000&amp;gt; new Random().nextInt()&#xA;===&amp;gt; 909782845&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But the sad part is that it seems pretty slow on my machine:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;➜  ~  time (echo :q | groovysh)&#xA;Groovy Shell (2.3.3, JVM: 1.8.0)&#xA;Type &#39;:help&#39; or &#39;:h&#39; for help.&#xA;-------------------------------------------------------------------------------&#xA;groovy:000&amp;gt; :q&#xA;( echo :q | groovysh; )  16.56s user 0.31s system 201% cpu 8.384 total&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That&amp;rsquo;s more than 8 seconds just to start up and shut down a prompt that I might just run one command in!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Numerical Development on OSX (in the Command Line)</title>
      <link>https://traviscj.com/blog/post/2013-08-19-numerical_development_on_osx_in_the_command_line/</link>
      <pubDate>Mon, 19 Aug 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-08-19-numerical_development_on_osx_in_the_command_line/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been working on C implementations of my research projects, which can of course be a perilous project. I&amp;rsquo;ve found some tools that make it hugely, hugely better.&lt;/p&gt;&#xA;&lt;h2 id=&#34;homebrew&#34;&gt;Homebrew&lt;/h2&gt;&#xA;&lt;p&gt;You can&amp;rsquo;t do a list like this without mentioning homebrew. You want homebrew instead of MacPorts or Fink or bailing twine and chewing gum or whatever else you were thinking about using. Just do it: You can find the homepage at brew.sh or just install with:&lt;/p&gt;</description>
    </item>
    <item>
      <title>implementation of set operations</title>
      <link>https://traviscj.com/blog/post/2013-03-13-implementation_of_set_operations/</link>
      <pubDate>Wed, 13 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-03-13-implementation_of_set_operations/</guid>
      <description>&lt;p&gt;We got in a bit of a debate yesterday in the office over the implementation of associative containers, which I thought was pretty fun.&#xA;We made up the big chart of complexity results you see below.&lt;/p&gt;&#xA;&lt;h2 id=&#34;nomenclature&#34;&gt;nomenclature:&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$S$, $S_1$, and $S_2$ are subsets of $\Omega$.&lt;/li&gt;&#xA;&lt;li&gt;Denote an element by $e\in\Omega$.&lt;/li&gt;&#xA;&lt;li&gt;$n$,$n_1$,$n_2$,$N$ are the sizes of the set $S$, $S_1$, $S_2$, and $\Omega$, respectively, and $n_1 \geq n_2$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;complexity&#34;&gt;Complexity&lt;/h2&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Operation\Approach&lt;/th&gt;&#xA;          &lt;th&gt;Hash Table&lt;/th&gt;&#xA;          &lt;th&gt;Hash Tree&lt;/th&gt;&#xA;          &lt;th&gt;Binary List&lt;/th&gt;&#xA;          &lt;th&gt;Entry List (sorted)&lt;/th&gt;&#xA;          &lt;th&gt;Entry List (unsorted)&lt;/th&gt;&#xA;          &lt;th&gt;&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;$e \in S&#x9;&#x9;  $&lt;/td&gt;&#xA;          &lt;td&gt;$O(1)   &#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(log(n))&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(1)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(log(n))&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;$S_1 \cup S_2    $&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1+n_2)&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1+n_2)&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(N)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1+n_2)&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1n_2)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;$S_1 \cap S_2    $&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(log(n_1)n_2)$&lt;/td&gt;&#xA;          &lt;td&gt;$O(N)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_2)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n_1n_2)&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;space complexity&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)&#x9;&#x9;&#x9;$&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)          $&lt;/td&gt;&#xA;          &lt;td&gt;$O(N)$ bits.&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)          $&lt;/td&gt;&#xA;          &lt;td&gt;$O(n)          $&lt;/td&gt;&#xA;          &lt;td&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;As I said&amp;ndash;this was just what came out of my memory of an informal discussion, so I make no guarantees that any of it is correct.&#xA;Let me know if you spot something wrong!&#xA;We used the examples  $S_1 = {1,2,3,4,5}$ and $S_2 = {500000}$ to think through some things.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Computer Ressurection and Elastic Cloud Experimentation</title>
      <link>https://traviscj.com/blog/post/2008-11-29-computer_ressurection_and_elastic_cloud_experimentation/</link>
      <pubDate>Sat, 29 Nov 2008 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-11-29-computer_ressurection_and_elastic_cloud_experimentation/</guid>
      <description>&lt;p&gt;I was home on Thanksgiving Break with Sharvil, and we decided to revive some old computers. Partly I&amp;rsquo;d like to experiment with some clustering stuff without incurring CPU time at the AMATH department or Teragrid stuff I&amp;rsquo;m likely gonna be working on soon with Shea-Brown&amp;rsquo;s neuroscience research. So, it turns out I resurrected about 5-6 old computers(final tally is still waiting on the number of successful Xubuntu installs on them, among other practical issues(where the hell am I going to put six computers&amp;hellip;?): The very first computer I built(a P3 450), P3 700, Dual P2 266, a couple of AMD64 3200&amp;rsquo;s, and a Sony Vaio P3 733. The cool thing is that the neuron spiking models are basically embarassingly parallel(well, each run isn&amp;rsquo;t necesarily, but from what I&amp;rsquo;ve gathered so far, we&amp;rsquo;re looking for averages over a bunch of them. So, sweet! Again, this would be terrible for actual research, especially against something like TG or even Amazon&amp;rsquo;s EC2&amp;ndash;which is another thing I really need to check out.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Fame and FORTRAN</title>
      <link>https://traviscj.com/blog/post/2008-11-08-fame_and_fortran/</link>
      <pubDate>Sat, 08 Nov 2008 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-11-08-fame_and_fortran/</guid>
      <description>&lt;p&gt;I must be getting more popular on some search engines somewhere. I just got six random comment-spam messages. Awesome. I guess that&amp;rsquo;s why the more important bloggers have come to rely on Bayesian filters and soforth for taming the wild flow of spam. Hopefully that trend doesn&amp;rsquo;t continue.&lt;/p&gt;&#xA;&lt;p&gt;Also, it seems as though I am now learning FORTRAN. I&amp;rsquo;m sortof starting working with Eric Shea-Brown on some Neuroscience research, working with HPC on NSF&amp;rsquo;s Teragrid. It&amp;rsquo;s pretty exciting stuff, and I&amp;rsquo;m really excited about getting moving on it. Anyways, back to FORTRANizing, I suppose.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Cython</title>
      <link>https://traviscj.com/blog/post/2008-05-09-cython/</link>
      <pubDate>Fri, 09 May 2008 12:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-05-09-cython/</guid>
      <description>&lt;p&gt;After I had finally convinced myself to get out of bed this morning to go to my ACMS seminar, I quickly checked my email and my heart sank a little. Today’s talk was on SAGE. Don’t have anything against SAGE, but I thought it was just a big pile of open source packages in a big, heavy install. Sorta cool, but worthless, in other words.&lt;/p&gt;&#xA;&lt;p&gt;Turns out, I was pretty wrong about that. It is that, but it’s also  70k new lines of code that does a whole bunch of exciting stuff. Near the end of his talk, William Stein mentioned that they had created a new tool called Cython. (Well, extended Pyrex, but… whatever.)&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
