public
Description: Fast webserver for dynamic pages
Homepage: http://cliki.net/teepeedee2
Clone URL: git://github.com/vii/teepeedee2.git
name age message
file .gitignore Wed Dec 05 12:01:25 -0800 2007 added .gitignore [John Fremlin]
file LICENCE Sun May 24 02:51:50 -0700 2009 release [vii]
file README.markdown Tue Oct 27 02:45:32 -0700 2009 new docs [vii]
directory addons/ Tue Oct 06 03:48:42 -0700 2009 removed parenscript from the addons/ dir as eve... [vii]
directory doc/ Tue Oct 27 02:45:32 -0700 2009 new docs [vii]
file quickstart.lisp Wed Oct 07 16:41:11 -0700 2009 note that parenscript is no longer supplied wit... [vii]
directory src/ Fri Nov 06 03:30:32 -0800 2009 a few minor optimisations [vii]
directory t/ Sun Oct 12 23:18:27 -0700 2008 working on sbcl again [vii]
file teepeedee2-test.asd Mon May 11 18:35:56 -0700 2009 added atom feeds (still rather weird) [vii]
file teepeedee2.asd Fri Nov 06 03:27:09 -0800 2009 do not turn on tpd2-debug by default [vii]
README.markdown

teepeedee2

Homepage

See http://common-lisp.net/projects/teepeedee2.

What's this?

teepeedee2 is a webapplication framework for dynamic webpages. It's goal is to be fast. It only works on Linux.

Quickstart

You need SBCL. On Ubuntu or Debian

$ sudo apt-get install sbcl

Untar or git clone

  $ git clone git://github.com/vii/teepeedee2.git

  $ cd teepeedee2

Start sbcl and run the quickstart.lisp

  $ sbcl --load quickstart.lisp

This will download the following packages with asdf-install, and their dependencies: iterate cffi cl-irregsexp trivial-backtrace

Note that it DISABLES the GPG signature checking! You will be running UNVERIFIED CODE.

      It will try to download the following packages with 
      Install where?
      1) System-wide install: 
         System in /usr/lib/sbcl/site-systems/
         Files in /usr/lib/sbcl/site/ 
      2) Personal installation: 
         System in /home/username/.sbcl/systems/
         Files in /home/username/.sbcl/site/ 
       --> 

Enter "2" and press enter.

Lots of downloading and compiling will occur.

Then visit http://localhost:8080/hello

You can now enter new pages at the SBCL REPL

* (in-package #:teepeedee2.quickstart)

* (defpage "/goodbye" ((name "Friend"))
        (<div (<h1 "Bye bye " name) (<p "The universal time is " (get-universal-time))))

Benchmarking

(in-package #:tpd2)
(defpage "/test" (name) :create-frame nil
    (tpd2.ml.html:<h1 "Hello " name))

(http-start-server 8080)

(event-loop)

Use apachebench

$ ab -n 100000 -c10 http://127.0.0.1:8080/test?name=John

More info

This webserver is not finished and I wrote it to learn and experiment with Common Lisp. There is a lot to be tidied up, now I know the language better. If you have any interest in using it, please get in touch with me, John Fremlin john@freml.in, or http://john.fremlin.org/contact.html

It is faster than all(?) other web application frameworks for serving small dynamic webpages. Please let me know if you have a case where another framework is faster!

You can see benchmarks comparing it to other web application platforms like PHP and Rails in this presentation http://tlug.jp/meetings/2008/11/serving-dynamic-webpages-in-less-then-a-millisecond_john-fremlin_handout.pdf

You can see an example of it running a blog on http://john.freml.in.

It is designed so that small fragments of JavaScript can be delivered at low overhead to many clients.

However, it also includes general support libraries for quickly generating XML/HTML (tpd2.ml2), for doing fast networking in a continuation passing style, i.e. fast event driven userspace threading (tpd2.io).

Note that it trusts the last value of X-Forwarded-For.

For an example application, loaded by default, see the src/game directory.

The addons/ directory contains a few of the other projects (but not all) that teepeedee2 depends on. They are released under their own licence.

The licence for most of tpd2 is the Lisp LGPL. However, I take no profit from making this, and request that if you make an application with it, please release the source so others can learn from it. Don't be selfish!

It runs on SBCL and ClozureCL. It shouldn't be hard to port to other modern Common Lisps.