|
Boost Users : |
Subject: [Boost-users] Not able to use multiple cores with boost::asio::ssl
From: Ramashish Baranwal (ramashish.lists_at_[hidden])
Date: 2009-10-09 01:49:14
Hi,
I have an application where I am planning to use boost::asio's ssl
streams. There are two parts of the app, the initial connection
establishment and ssl handshake is done by boost::asio::ssl and the
connection is then transferred to the core application which does the
the rest. I have written a prototype using multiple threads and
io_services similar to io_service_pool example.
I am using a dual quad core machine, however I am not able to get the
cpu usage beyond one core (i.e. it never exceeds 12-14% in the top) no
matter how much the load. On doing some profiling I found that the
time taken from socket accept to ssl handshake completion deteriorates
linearly with the number of connections without using the other cores.
I am not using any explicit locks so expected the application to scale
well with the number of cores available. Is is not possible to use
multiple cores with boost::asio::ssl libraries or am I not doing it
right?
A pseudo-code of the app-
start connection acceptors
handle_accept()
{
new_conn = new Connection(io_service_pool.get_io_service());
new_conn->start();
}
Connection::start()
{
ssl_socket_.async_handshake(handle_handshake);
}
Connection::handle_handshake(error)
{
if (!error)
// transfer connection to the application core
}
Thanks in advance,
Ramashish
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