Thursday, October 29, 2009

Thank you for Ubuntu 9.10

Just upgraded to Ubuntu 9.10 and everything works. I mean everything that bothered me, just works now. Among huge amount of improvements there is one that I am really happy about. I have two 24" monitors and one on the right I like to keep vertical, so I can read the page w/o scrolling. I accomplished it in Ubuntu 9.04 but had to do all kind of hacks in my xorg.conf, etc. The result was also not perfect, since there were all kind of flickering on the screen, which drove me up the walls. I am happy to say that with Ubuntu 9.10, it just works using standard display configuration panel. Also I was able to align the displays so when half of the window is on the left monitor and half is on the right, the window does not look crooked. Thank you Ubuntu Team!

Saturday, October 3, 2009

I/O write speed benchmark

At work we had some performance issues with one of our production boxes. I thought it was related to the I/O on the veritas file system which we have to use for high availability. In order to prove it I needed a tool to write 1K block and flush it, fast. I've searched around on the web and could not find anything that measures only writes, so I wrote one in Clojure. I had to make sure that it is fast and does not generate to much garbage in the main tight loop. New transient was a perfect choice for it. Transients only available in Clojure 1.1.0, so you will need to get the latest alpha.

The main loop is pretty straight forward.
(defn write-to-file [#^String file]
  (with-open [s (FileOutputStream. file)]
    (loop [i 0 r (transient [])]
      (if (< i 1e3)
        (recur (inc i) (conj! r (with-time
                                    (doto s
                                      (.write test-row)
                                      (.flush)))))
        (persistent! r)))))

Here is the gist of the rest.



I've used incanter to plot the data.
And this is one of the plots that I've got, when I ran it on my MacBook Pro.
As you can see there is quite a bit of jitter and that will affect latency. On our production Linux servers after tuning the file system, those jitters almost disappeared. The next step is to use Real-Time OS and RTSJ.

Sunday, September 13, 2009

What animal letters add up to 100

My friend's daughter had an assignment to find three animals which letters will add up to a hundred, "A" being one, "B" two, etc. After hours of adding they found two of the names, that is when I've heard of this problem. Well, I've cheated and used Clojure and fifteen minutes later I've got this


It was fun to write. Maybe I'll use it as an interview question :)
By the way the answer is:
([Chimpanzee 100] [Starfish 100] [Turkey 100])

[Update: The new assignment was to find as many words in the dictionary as possible with the same requirement. I hacked the code to find all the 2296 words in the words file on my machine. The gist is in the same place.]

Sunday, April 19, 2009

International Lisp Conference 2009


ILC2009-46
Originally uploaded by rpgpoet
Looks like Lispers like Macs. I can see at least 10 of them on this picture.

P.S. Can you find me?