[naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Andrew Piskorski
>From inside NaviServer, I'd like to repeatedly write data to some files in the background, while letting the thread that schedules the writes go on to do other work. The obvious way to do that might seem be simply calling Tcl's "open" on each file and then doing: fconfigure $fd -blocking 0 Ho

Re: [naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Zoran Vasiljevic
On Thu, 6 Jun 2019 10:41:02 -0400 Andrew Piskorski wrote: > From inside NaviServer, I'd like to repeatedly write data to some > files in the background, I assume you want to consume data from remote? In that case you may want to use spooler thread(s): #

Re: [naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Andrew Piskorski
On Thu, Jun 06, 2019 at 05:23:38PM +0200, Zoran Vasiljevic wrote: > > From inside NaviServer, I'd like to repeatedly write data to some > > files in the background, > I assume you want to consume data from remote? No, the data isn't being uploaded by clients, it's received or generated server-si

Re: [naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Zoran Vasiljevic
There are also writer threads that spool files in a dedicated thread thus offloading the connection threads. Am 6. Juni 2019 18:26:52 MESZ schrieb Andrew Piskorski : >On Thu, Jun 06, 2019 at 05:23:38PM +0200, Zoran Vasiljevic wrote: >> > From inside NaviServer, I'd like to repeatedly write data t

Re: [naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Andrew Piskorski
On Thu, Jun 06, 2019 at 07:22:08PM +0200, Zoran Vasiljevic wrote: > There are also writer threads that spool files in a dedicated thread thus > offloading the connection threads. I see AsyncWriterThread() in "naviserver/nsd/driver.c", but I don't really understand the code, nor how it could be us

Re: [naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Gustaf Neumann
On 06.06.19 18:26, Andrew Piskorski wrote: From inside NaviServer, I'd like to repeatedly write data to some files in the background, I assume you want to consume data from remote? No, the data isn't being uploaded by clients, it's received or generated server-side. Think a streaming data f

Re: [naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Andrew Piskorski
On Thu, Jun 06, 2019 at 09:23:12PM +0200, Gustaf Neumann wrote: > The main question is, why are you interested in async writes? My original use case wasn't clear? I have one thread busy processing data and sending it various places. I want to log some of that data to a bunch of files, probably

Re: [naviserver-devel] Tcl nonblocking file IO in NaviServer?

2019-06-06 Thread Gustaf Neumann
On 06.06.19 21:49, Andrew Piskorski wrote: The easiest thing to do is call Tcl's open, puts, close every single time I need to write data, but that's blocking, and I'm worried that it could easily degrade the latency of my main processing thread. by "main thread" you refer probably to the "curre