March 27, 2009

Missing.

Haven’t had much time to post anything lately. I have been busy working on projects for work. While you’re here checkout some interesting reads from this week:

Also, photos from my wedding recently got posted to flickr if you are into that sorta thing.

March 11, 2009

Erlang Factory.

It’s official I will be giving a talk at the Erlang Factory conference next month. I will be speaking about web server performance with a final round of tests that should be much more complete than the last couple death-matches. Hope to see you there.

March 5, 2009

Erlang Queue and Merle.

Lately I have been playing around with the idea of adding a process pool to merle or at least a layer that allows you to use a process pool. I also happened across Erlang’s queue implementation. It has all the basic functions you expect from a queue and two API’s. So I created a branch of merle to play around with this idea. There are two main differences from the mainline merle, the first is the pid is always passed to the functions doing the work rather than using ?SERVER, for instance.

stats() ->
gen_server2:call(?SERVER, {stats}).

versus

stats(Pid) ->
gen_server2:call(Pid, {stats}).

This allows more than one gen_server process to be started, the down side being you have to pass this Pid variable around. The other change is a new module called queue_merle, this is a sort of the process pool later that interfaces with merle. Obviously this is a very rough cut but seems to do the trick. The start function starts five merle processes and adds them to the queue, rotate rotates the queue taking all the head of the queue and inserting it into the bottom. I have impletemeted getkey and set as well. They accept a queue, key and/or value. The downside to this implementation is similar to that of using merle without defining ?SERVER, you have to know what, in this case, queue you are using and you need to make sure it is the most current otherwise you will end up getting more calls to one process than another. Here is an example of usage.

1> Queue = queue_merle:start().
{[<0.39.0>,<0.38.0>,<0.37.0>,<0.36.0>],[<0.33.0>]}
2> {Queue1, Result1} = queue_merle:set(Queue, a, “asdf”).
{{[<0.33.0>,<0.39.0>,<0.38.0>],[<0.36.0>,<0.37.0>]},ok}
3> {Queue2, Result2} = queue_merle:set(Queue1, b, “1234″).
{{[<0.36.0>,<0.33.0>,<0.39.0>,<0.38.0>],[<0.37.0>]},ok}
4> {Queue3, Result3} = queue_merle:getkey(Queue2, a).
{{[<0.37.0>,<0.36.0>,<0.33.0>],[<0.38.0>,<0.39.0>]},”asdf”}
5> {Queue4, Result4} = queue_merle:getkey(Queue3, b).
{{[<0.38.0>,<0.37.0>,<0.36.0>,<0.33.0>],[<0.39.0>]},”1234″}

As you can see the queue is rotating each time the functions are run but due to not allowing for multiple assignment one has to grab the new version of the queue each time and use it for the next operation. I imagine there is probably a cleaner way to do this, if I come up with one I like it will probably get added to mainline merle. Fun stuff.

March 4, 2009

People Under the Stairs – The Whiz

YouTube Preview Image