c-cube / tiny_httpd

Minimal HTTP server using good old threads + blocking IO, with a small request router.
https://c-cube.github.io/tiny_httpd
75 stars 11 forks source link

Use fd #49

Closed craff closed 1 year ago

craff commented 1 year ago

Before trying to use domains for real, I felt it is better to replace in channel by file descriptor to avoid stacking two buffers. It should be and seems like a few percent faster but would need real testing to check.

I kept of_chan, but it is not used anymore .... May be we should remove it?

c-cube commented 1 year ago

That makes sense, I guess. I have a branch where I tried that but I don't recall why I didn't push through.

craff commented 1 year ago

I forgot an exception catch. I probably know why you did not... This requires a lot of tests because this is catchy! I will write more stressfull test for Tiny_httpd_domains (I have a branch on my fork named domains2, that you can follow) and I will do a PR to add those test to normale Tiny_httpd too. I think you should only accept this PR after that.

craff commented 1 year ago

I will also read the code for input to handle Unix_error exception in the same way.

craff commented 1 year ago

Hello

Please have a look at the branch domains2 from https://github.com/craff/tiny_httpd

It already works with the current tests. Need improvement: to yield a bit less (now it yield at each read or write). And also better priority queues. I first will do more stressing tests.

May be this will convince you that we do not need Eio?

I would like to push a PR for this on your repository on a branch named domain (or whatever you like)

Do you think this is a good idea ?

May I have you email too (avoid discussing on places not relevant on github ?)

Cheers, Christophe

-- Christophe Raffalli tél: +689 87 23 11 48 web: http://raffalli.eu

c-cube commented 1 year ago

my email is in my github profile :)

I still don't think I like the idea of a custom scheduler for domains. It can't be in tiny_httpd anyway, because of compatibility with OCaml < 5 (we could keep both but it's tricky to have that kind of conditional compilation). At this point I see little upside in using domains without Eio: