Subject: Re: [boost] ASIO Query
Date: 2011-12-21 15:53:43
After a little reading of the ASIO documentation, it looks like I should be able
to run a seperate io_service on another thread, and post() database queries to
it. If I bind a callback with the query, the results/error can be passed back to
the initiator without too much trouble.
Seems like boost is the answer to everything.
Assuming I can keep the database queries asynchronous, would anyone recommend
HTTP example 2 or 3?
Appreciated, thanks again.
On 21 December 2011 at 20:21 "james_at_[hidden]" <james_at_[hidden]> wrote:
> Blocking - I've thought about this, but the MySQL C/C++ libraries
> don't provide asynchronous queries.
> I'm thinking of moving database reads into a seperate thread(s). It would be
> nice if I can integrate this with the io_service, but I'm unsure how to do so.
> Is it possible to pass arbitrary work items to an io_service, in the same
> as async_read/write?
> Many thanks.Â
> On 21 December 2011 at 16:07 Olaf van der Spek <ml_at_[hidden]> wrote:
> > On Wed, Dec 21, 2011 at 3:27 PM, james_at_[hidden]
> > <james_at_[hidden]> wrote:
> > > I'm hoping for opinions on using an io_service per core against a single
> > > io_service with multiple threads (similar to HTTP Server examples 2 & 3).
> > > The
> > > application is a TCP authentication / proxy server, intended to use all
> > > available cores.
> > >
> > > - The TCP streams consist of small messages (usually a few hundred bytes)
> > > which
> > > can individually be processed quickly.
> > > - Connections themselves are fairly long lasting - average around 4 hours,
> > > although occasionally up to 10-12 hours.
> > >
> > > We're looking for a 'shared nothing' design between threads - database
> > > queries
> > > can be made per-thread (using TLS), for example.
> > Are database queries blocking or non-blocking? If they're blocking,
> > won't this also block other connections handled by the same thread?
> > Olaf
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk