Tips on TCP socket to postgresql middleware

Chris Piker chris at hoopjump.com
Sat Feb 19 20:13:01 UTC 2022


Hi D

I'm about to start a small program to whose job is:

1. Connect to a server over a TCP socket
2. Read a packetized real-time data stream
3. Update/insert to a postgresql database as data arrive.

In general it should buffer data in RAM to avoid exerting back 
pressure on the input socket and to allow for dropped connections 
to the PG database.  Since the data stream is at most 1.5 
megabits/sec (not bytes) I can buffer for quite some time before 
running out of space.

So far, I've never written a multi-threaded D program where one 
thread writes a FIFO and the other reads it so I'm reading the 
last few chapters of Ali Cehreli's book as background.  On top of 
that preparation, I'm looking for:
   * general tips on which libraries to examine
   * gotchas you've run into in your multi-threaded (or just 
concurrent) programs,
   * other resources to consult
etc.

Thanks for any advice you want to share.

Best,



More information about the Digitalmars-d-learn mailing list