Get It:
Download
Change Log
Learn It:
Install
Tutorial
API Doc
Discuss It:
Mailing List
Follow It:
Code

Tutorial Part 2. HTTP Server

The default HTTP server has been Hunchentoot since version 0.1.0.

Starting and Stopping your HTTP server

(eval-when (:compile-toplevel :load-toplevel :execute)
  (asdf:oos 'asdf:load-op :web4r))
(use-package :web4r)

(defparameter *srv* (start-server)) ; starts your server
(stop-server  *srv*) ; stops your server

web4r:start-server and web4r:stop-server are wrapper functions for hunchentoot:start and hunchentoot:stop. If you start your server by web4r:start-server, the default port is 8080. See web4r:start-server and hunchentoot:acceptor for detail.

Performance

( Apache + mod_proxy + Hunchentoot ) is as fast as ( Apache + mod_php + php ).

Dynamic content benchmark:

* Benchmark command:
- 'ab -c 10 -n 100 "url"'

* Hardware:
- CPU: 1.20GHz Intel Core 2 Duo
- Memory: 4GB
- Storage: 64GB SSD

* Software:
- OS: Ubuntu 9.04 32bit
- SBCL: 1.0.18
- Apache: 2.2.11
- hunchentoot 1.0.0
- PHP: 5.2.6

* Result:
+----------------------------------------------------------------------+
| HTTP Server                              |  small (2B) | big (477KB) |
+----------------------------------------------------------------------+
| Hunchentoot stand alone                  |      3.001  |      4.561  |
| Apache + mod_proxy + Hunchentoot         |      0.108  |      5.694  |
| Apache + mod_php + php                   |      0.099  |      5.102  |
| Hunchentoot + web4r                      |      3.000  |     12.376  |
| Apache + mod_proxy + Hunchentoot + web4r |      0.175  |     13.875  |
+----------------------------------------------------------------------+
Note: The big content is generated by 100000 times loop