Boost logo

Boost Users :

Subject: Re: [Boost-users] (no subject)
From: Jens Weller (JensWeller_at_[hidden])
Date: 2014-11-01 18:58:36



 
 

Gesendet: Freitag, 31. Oktober 2014 um 00:50 Uhr
Von: "Johnny McCullough" <johnny.mccullough@gmail.com>
An: boost-users@lists.boost.org
Betreff: [Boost-users] (no subject)

I'm new to boost, and I'm wondering about the best / most efficient way to transfer a large dataset via boost::asio.

I've retrieved a datasetfrom a database (Cassandra) and I'm using boost asio to provide a network service that responds to queries.

So I have a client socket and a dataset.  I have to iterate the dataset, perform some simple formatting (e.g. csv, json, xml), then write it out to the client socket.  But there's a lot of data.  Perhaps gigabytes.

So my initial thoughts were the producer / consumer pattern - the producer writing to a streambuf and the consumer async_write-ing it out to the client's socket.

But I'm not sure this is a good approach - I know that streambuf isn't threadsafe and so managing the streambuf with locks may well become a performance bottleneck.

Obviously, I don't want to replicate what may be gigabyte(s) of data from a resultset into a buffer just so it can be written out to a socket, So should I write this data synchronously straight to the socket instead?  What's the best approach to solving this kind of problem? 

thanks for your consideration
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
 
Hi Johnny,
 
I think this talk from CppCon is interesting for you:
https://www.youtube.com/watch?v=wbZdZKpUVeg
 
thanks,

Jens

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net