MochiWeb vs. Cowboy, HTTP vs. WebSocket benchmark

Lately I’ve been banging around a lot in order to get up to speed with Erlang/OTP and its various web-server libraries, and I figured I could share some of my findings here for future reference and in general for The Greater Good.

Test server

As you might have already noticed, this benchmark concerns two of the most well knows Erlang web-server libraries, MochiWeb and Cowboy, and it aims to explore their behaviour under some considerable load.

The server in question uses two communication protocols, HTTP and WebSocket, so as an added benefit we’ll see how these two compare. Unfortunately, MochiWeb doesn’t have a built-in support for WebSocket, so an external library was needed. The rather simple client API is defined as:

  • ht​tp://host/poll/N – an HTTP chunked reply with one chunk of data sent every N seconds,
  • ws://host/wspoll/N – a WebSocket connection with one chunk sent every N seconds.

Continue reading

Google Reader alternative for Emacs Ninjas

With Google Reader being discontinued and everyone looking for alternatives I’ve decided to look for a little less “standard” solution, and hey, it turns out Emacs can be a pretty powerful RSS reader.

Newsticker.el

News Ticker is a built-in Emacs feed reader that doesn’t get much attention for some reason. It is feature-rich, handles both RSS 2.0 and Atom feeds and has quite a bunch of tweakable options.
Here’s a simple setup to start with:

(require 'newsticker)

; W3M HTML renderer isn't essential, but it's pretty useful.
(require 'w3m)
(setq newsticker-html-renderer 'w3m-region)

; We want our feeds pulled every 10 minutes.
(setq newsticker-retrieval-interval 600)

; Setup the feeds. We'll have a look at these in just a second.
(setq newsticker-url-list-defaults nil)
(setq newsticker-url-list '("..."))

; Optionally bind a shortcut for your new RSS reader.
(global-set-key (kbd "C-c r") 'newsticker-treeview)

; Don't forget to start it!
(newsticker-start)

Continue reading

MMO Life

This is a follow-up post to Gamification showing how I use it and what purpose does it serve me.

In summary, I’m a kind of control freak who likes all sorts of stats (such as my systems stats or a projects repo stats) displayed neatly all over the place, and it was only a matter of time before I started monitoring myself, and so I wrote a tiny tool, Gamify, that integrates with Emacs’ Org-Mode and tracks my skills, their dependencies and their development.

http://idorobots.files.wordpress.com/2013/02/wpid-programming.png?w=549

Continue reading

ASM development log 4: Tiny MOP

Finals are comming, so I might as well hack around a bit with ASM

It’s been a while since the last status update and I hate to admit it, but not much has changed in ASM repo. I was messing around with combinators in an attempt to simplify ASM’ environments, and I was experimenting with new immutability semantics, since at the moment it’s pretty much a one big copy-vs-alias mess. There are still a bunch of unresolved issues here and there concerning efficiency mainly, but if ASM is to be relevant in 100 years of time I’d much rather sacrifice efficiency for simpler semantics and expressive power.
Lastly, I was thinking about a way of exposing as much of ASM’ semantics as possible and allowing their run-time overriding, using a Metaobject protocol:

(import 'samples.tinyclos)

(defmethod apply ((v Vector) n)
  (write "Applying a vector to something? Are you " n "?"))

(apply '[1 2 3 4] '(nuts))

Continue reading

You earned 15 XP in Getting Things Done!

Gamification

According to the Oxford Dictionary

Gamification (ˌɡeɪmɪfɪˈkeɪʃ(ə)n) is the application of typical elements of game playing (e.g. point scoring, competition with others, rules of play) to other areas of activity, typically as an online marketing technique to encourage engagement with a product or service:
gamification is exciting because it promises to make the hard stuff in life fun.

Let’s see how to apply it to optimize performing daily activities and get some useful statistics out of it…

http://idorobots.files.wordpress.com/2012/12/wpid-foo41.png?w=549

Continue reading

System monitor in Emacs mode-line

Resistance is futile…

As we all know Emacs is a great operating system and a decent editor, and as such it has been serving me really well – I find myself assimilating more and more of my tools and daily activities into the Emacs collective. Recently I realised that Conky just wouldn’t cut it anymore…

First of all, I barely look at my desktop. There’s just no reason to do that other than checking some of the system stats such as memory usage or CPU load when I’m hacking arround and testing stuff.

For this particular use-case I figured the Emacs mode-line would be perfect to display all the relevant statistics directly in Emacs in such a way that I could glance through them without interrupting my workflow – giving me real-time feedback with minimal distraction.
Continue reading

ASM development log 3: DSLs

Kajtek, you incredibly handsome stallion, what have you been doing these past few months?” – you might ask, concerned about the lack of ASM dev logs recently…

Well, I’ve mostly been studying various PL design quirks and prototyping neat features such as vau calculus flavoured fexprs or the following piece of what I consider art.

As mentioned before, I was working on an extensible reader that would support user-defined reader macros for easy DSL programming. It took me quite some time, effort and researching but eventually I came up with an awesome solution.
It’s worthy to mention here, that it’s in no way a new solution. I prefer to figure stuff out myself and often times it turns out that similar concept already existed a few years before mine. Bummer u_u.
Continue reading