Smisk 1.0

So, after two years, The Smisk web service framework has finally been released as a stable version.

Smisk is a small but powerful framework, or more like a base, for building and running high-performance web services, based on FastCGI. Before I get any further, here is the classic example:

from smisk import Application
class MyApp(Application):
  def service(self):
    self.response.write("Hello World!")


This example is obviously not much to hang up in the christmas tree, as we say in Sweden, but there’s definitely more. The major feature of Smisk is it’s speed and this because of the fact that it’s written in C. Yes, not Python. It’s a machine-native library that manifests itself as a Python extension thus control is done with Python.

Installing Smisk is very easy if you have setuptools:

sudo easy_install smisk

(There are other means of installation available…)

As I mentioned earlier, Smisk is a FastCGI based entity. As the name suggests, this is a fast interface, or a fast proxy interface, for HTTP services. FastCGI was built to do two things in particular: Be as fast as possible and scale as good as possible. Smisk retains both of those criteria.

Threaded vs Non-threaded

Rarely is CPU the critical point in a I/O-based application such as a common web service. Smisk has made the choice not to use threads (though most of the library is thread-safe) in favor for simpler interface and higher speed. In the rare case of CPU being the bottleneck, Smisk can simply run in several instances and being evenly loaded by a FastCGI server supporting load-balancing, like Lighttpd or Apache.


WSGI, Eric and what popped the plug

The WSGI interface was initially contributed by Eric Moritz – his site runs Django on Smisk – and is available as a Python implementation called smisk.wsgi. However, a few months ago, I totally b0rked Smisk thus made it segfault in the most inappropriate situations. I had little time to figure out the problem and gave up. (I know, I’m an asshole) Then, Eric Moritz send in his WSGI contribution and the flame was lit once again. Eric also managed to point out a simple, stupid but major miss from my side which kind of popped the plug and about 30 hours worth of time Smisk 1.0 was finally released, passing all regression-, leak- and memory-sanity(!)tests. Thank you Eric.

Now, here is a simple WSGI application:

from smisk.wsgi import Gateway
def hello_app(env, start_response):
  start_response("200 OK", [('Content-type', 'text/plain')])
  return ["Hello, World!"]


Try it out

Now, go try it out. I suggest installing Smisk by sudo easy_install smisk and also downloading the source package, which includes a bunch of example applications. The examples in this package assumes you have Lighttpd installed.

Please, let me know what you think!