On Sat, 18 Jul 2015 00:45:56 GMT, Taylor Gronka wrote:

I'm not experienced enough to give great advice, but here are my thoughts. I think you're mistaken in assuming that sqlite can handle anything related to vibes async functions internally. (I feel as thought I might have misunderstood you here.)

No I know that sqlite will not work with vibes async as is. That is the reason for my questioning.

Here are links I have come across that might help you:
sqlite in dlang (not for vibe.d, it seems)
https://github.com/anton-dutov/db

Currently I'm using this: https://github.com/biozic/d2sqlite3 which I like better.
Also not for vibe.d of course.

This article and example seems like it might answer many of your questions:
http://vibed.org/blog/posts/writing-native-db-drivers

Yeah, I already read that. But I don't think that can be applied to sqlite.
Or can it? How? I can't imagine other way than to modify somehow sqlite C code itself, which seems wrong to me.

So if sqlite has to stay as it is, is there some preffered pattern to use it effectively?

I thought of something like this:

FIBER THREAD                                  SQLITE WORKING THREAD

received request          ------>             load
                                              some
do other things                               data

write response            <------             send loaded data

There can even be a pool of workers to handle requests.

But I'm pretty new to D and vibe (mainly C#) so I'm not sure if this is possible to make this more effective than just use sqlite directly to handle requests even with its blocking.

What I'm after is just simple self hosted RESTful service with sqlite backend (required).
Currently I'm using it in a blocking manner with HTTPServerOption.distribute and when simply benchmarked, it is even then faster than node.js or C# implementation.

But I would like some advice if it can be done in a better way.

Thx,
Tom