On Thu, 6 Jun 2019 15:49:29 -0400
Andrew Piskorski <a...@piskorski.com> wrote:

> However, (particularly given my small writes to many files), clearly
> asynchronous file IO should be more efficient, and scale better, so
> I'd like to understand how to do that.  The ease of simply calling
> "fconfigure" on a file handle is attractive, but I don't yet
> understand what else I'd need to do to make that seemingly simple
> approach actually work in the NaviServer context.

OK. You need an extra thread that sits in event loop.
Unfortunately NS does not have this setup built-in.
But the Tcl threading extension does!

You could open the file in your main thread then pass
the channel to the special async thread that sits 
in the event loop (by design) and handle writing, 
completely asynchhronously, using fconfigure and
write-callbacks there. I however do not know if this would
save you something, since writing into files, especially
if you write small amounts, is heavily cached by the OS.
I guess you need to try it yourself.

You would need to use [ns_ictl trace create] to load 
the extension into each interp. 

This would work. Again, stock NS does not have this
kind of (threading) functionality. Over the course of
years I wanted to add this but never really got time...



_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to