I use flexi-streams-0.15.3.
I didn't measure the response time using any tools (like httperf), I was just visually evaluating response time. It was much longer for handle-static-file. No, I didn't try the development version yet, I'll try it.


On Fri, Jun 20, 2008 at 2:20 PM, Edi Weitz <edi@agharta.de> wrote:
On Fri, 20 Jun 2008 12:56:33 -0400, "Andrei Stebakov" <lispercat@gmail.com> wrote:

> I had to come up with some way to cache dynamic files that I have to
> serve, so I ended up with a bunch of static files which I served by
> a simple function:
> (defun file-to-string (path)
>   "Reads a file into a string"
>   (if (probe-file path)
>       (with-open-file (in path)
>         (let ((str (make-string (file-length in))))
>           (read-sequence str in)
>           str))))
>
> The performance was very good, but then I thought that it's not the
> proper way to serve static files as there is a hunchentoot function
> handle-static-file.
> When I started using the hunchentoot's function the response time
> almost tripled and when I run "top" program to monitor CPU usage it
> jumps up to 60% (on my PIII 600 MHz) CPU, whereas using
> file-to-string CPU usage stays with 2% (maybe because the serving
> time is much shorter top doesn't catch that CPU peak).

How did you measure the response time?  Which version of FLEXI-STREAMS
are you using?  Did you try with the development version?

> My question is what could be the reason I see this behaviour? (I am
> using SBCL 1.0.15 with latest dependences of hunchentoot-0.15.7)

Look at the source code of handle-static-file.  It uses a fixed size
buffer which is likely smaller than your file.
_______________________________________________
tbnl-devel site list
tbnl-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/tbnl-devel