arsd 11 progress report - scheduled for release in May

Adam D Ruppe destructionator at gmail.com
Fri Apr 21 12:52:28 UTC 2023


On Friday, 21 April 2023 at 02:34:10 UTC, Chris Piker wrote:
> A cursory reading of the cgi module indicates that arsd provide 
> some of the same functionality of vibe.d, but uses 
> multi-processes or multi-threads instead of fibers.  Is that 
> true?

It actually does a lot more than that, including a fiber impl too 
(the -version=embedded_httpd_hybrid)

> Also, how do you keep DB requests from getting munged together 
> on the same DB connection socket when using arsd.cgi with 
> arsd.database?

You don't use the same db connection socket. You have a separate 
one per worker.

The way I usually do it is:

---
Database getDb() {
     static Database db;
     if(db is null)
        db = new WhicheverImpl(args);
     return db;
}
---

So you get a thread-local cache, recreated whenever needed. This 
works reliably in all current modes. (I might be adding a new 
mode in version 11 that works differently, but I'll add a new 
helper function for that if I do).

> In general what would you say are the advantages of using 
> arsd.cgi over vibe.d (other then simplicity of course).

Almost everything. It is much simpler to use, has more library 
compatibility, better performance (both compiles faster and 
serves faster), more stability (both fewer bugs and more long 
term api support), more features.... though there's a few places 
vibe might have something I don't (like there's a redis lib on 
their end, tho odds are you can use their lib in my system lol), 
I have most things they have and some things they don't (like my 
html form generators).



More information about the Digitalmars-d-announce mailing list