lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.94k stars 548 forks source link

Is there a LWAN design architecture doc ? #220

Open GuacheSuede opened 6 years ago

lpereira commented 6 years ago

There's no documentation with the exception of some blog posts. What do you want to know, specifically?

GuacheSuede commented 6 years ago

I would like to know about the concurrency design or how it handles multiple clients

GuacheSuede commented 6 years ago

Another question if you dont mind, does lwan url map allow such patterns ? /blog/post/{id}

lpereira commented 6 years ago

The concurrency design is explained here: https://tia.mat.br/posts/2014/10/06/life_of_a_http_request.html

As far as the URL map goes: it does not (it only matches prefixes), but you can use the rewrite module:

&blog_post /view_blog_post
rewrite /blog/ {
    pattern post/(%d+) {
         rewrite as /view_blog_post?id=%1
    }
}

This is considering that you have a handler named "blog_post" that gets a numeric ID via the query string.

GuacheSuede commented 6 years ago

Would one be able to lets say implement libr3 in the handlers and if so which code should I look at ?

lpereira commented 6 years ago

It's possible to create a module with r3 to match URLs, yes. You can start by looking at the rewrite module (src/lib/lwan-mod-rewrite.c).