Release: serverino - please destroy it.

Andrea Fontana nospam at example.com
Mon May 9 20:37:50 UTC 2022


On Monday, 9 May 2022 at 20:08:38 UTC, Sebastiaan Koppe wrote:
> On Sunday, 8 May 2022 at 21:32:42 UTC, Andrea Fontana wrote:
>> Every request is processed by a worker running in an isolated 
>> process, no fibers/threads, sorry (or thanks?)
>>
>> I did some tests and the performance sounds good: on a local 
>> machine it can handle more than 100_000 reqs/sec for a simple 
>> page containing just "hello world!".Of course that's not a 
>> good benchmark, if you can help me with other benchmarks it 
>> would be much appreciated (a big thanks to Tomáš Chaloupka who 
>> did some tests!)
>
> Typically server applications are IO heavy. I expect your 
> isolated-process approach to break down with that kind of work.

I know. We all know :) Benchmarks are just benchmarks. They are 
useful to understand how much overhead your server adds to the 
whole project. These benchmarks are made in the local machine, 
with almost no connection overhead.

Not every application is IO heavy, anyway.

> As an example, how many requests per second can you manage if 
> all requests have to wait 100 msecs?
>
> For non critical workload you will probably still hit good 
> enough performance though.

Firstly, it depends on how many workers you have.
Then you should consider that a lot of (most?) websites use 
php-fpm, that works using the same approach (but php is much 
slower than D). The same goes for cgi/fastcgi/scgi and so on.

Let's say you have just 20 workers. 100msecs for each request (a 
lot of time for my standards, I would say). That means 20*10 = 
200 webpages/s = 720k pages/h. I don't think your website has so 
much traffic...

And I hope not every request will take 100msecs!

>
>> Instead of using a lot of different UDAs to set routing rules, 
>> you can simply write them in your endpoint's body and exit 
>> from it to pass to the next endpoint.
>
> My experience is that exhaustive matching is easier to reason 
> about at larger scale.

Yes, but exactly the same thing can be done without uda.

```
     @endpoint void my_end(Request r, Output o)
     {
          if (r.uri == "/asd") // or whatever you want: regex, or 
checking another field
             return false; //
     }
```

This is just like:

```
@matchuda(uri, "/asd") void my_end(....) { ... }
```

What's the difference? The first one is much more flexible, IMHO.


>> Please help me testing it, I'm looking forward to receiving 
>> your shiny new issues on github.

> I noticed it has zero unittests, that is probably a good place 
> to start.

Of course! They will come for sure. :)

Andrea



More information about the Digitalmars-d-announce mailing list