On 15/08/07, pete@mu.org <pete@mu.org> wrote:
The docs are pretty specific that you can either have a global
io_service and then have each thread call run from within each on,
or you can have a an io_service for each thread.
IIUC, you can mix and match too (see the HTTP3 example, which uses an io_service pool). In your case, having a pool of io_services, each being run in a pool of threads might help you.
I have tried both. Both have the same issue. If I use standard low level sockets, my
app runs very fast and concurrency pays off, but with asio it's a
dog that runs our of resources.
Are you using Linux 2.4? According to the docs, you are limited to FD_SETSIZE number of sockets. Can you check what that is defined as on your system? You shouldn't run into this problem a newer Linux kernel, as that uses epoll, which apparently doesn't have the same limitations.
<snip>
All I want to do is launch hundreds of threads to make these connections
and asio doesn't seem to permit that sort of abuse.
Asio should allow that sort of abuse. Can you provide more details about your system?
As an aside, if you fork() before running your 'main loop', you can get around the FD_SETSIZE limit (which is a per-process one).
Regards,
Darren