add performance warning when hitting the file descriptor limit. Log the total number of peers, including half-open TCP connections

This commit is contained in:
Arvid Norberg 2012-03-04 11:18:27 +00:00
parent 769c985e78
commit e2d46b5563
4 changed files with 49 additions and 32 deletions

View File

@ -226,6 +226,12 @@ namespace libtorrent
bittyrant_with_no_uplimit, bittyrant_with_no_uplimit,
too_high_disk_queue_limit, too_high_disk_queue_limit,
too_few_outgoing_ports, too_few_outgoing_ports,
too_few_file_descriptors,
num_warnings num_warnings

View File

@ -125,9 +125,9 @@ def gen_html(reports, generations):
reports = [ reports = [
('torrents', 'num', '', 'number of torrents in different torrent states', ['downloading torrents', 'seeding torrents', 'checking torrents', 'stopped torrents', 'upload-only torrents', 'error torrents']), ('torrents', 'num', '', 'number of torrents in different torrent states', ['downloading torrents', 'seeding torrents', 'checking torrents', 'stopped torrents', 'upload-only torrents', 'error torrents']),
('peers', 'num', '', 'num connected peers', ['peers', 'connecting peers', 'connection attempts', 'banned peers']), ('peers', 'num', '', 'num connected peers', ['peers', 'connecting peers', 'connection attempts', 'banned peers', 'total peers']),
('peers_max', 'num', '', 'num connected peers', ['peers', 'connecting peers', 'connection attempts', 'banned peers', 'max connections']), ('peers_max', 'num', '', 'num connected peers', ['peers', 'connecting peers', 'connection attempts', 'banned peers', 'max connections', 'total peers']),
('peer_churn', 'num', '', 'connecting and disconnecting peers', ['connecting peers', 'connection attempts', 'error peers']), ('peer_churn', 'num', '', 'connecting and disconnecting peers', ['connecting peers', 'connection attempts']),
('connect_candidates', 'num', '', 'number of peers we know of that we can connect to', ['connect candidates']), ('connect_candidates', 'num', '', 'number of peers we know of that we can connect to', ['connect candidates']),
('peers_list_size', 'num', '', 'number of known peers (not necessarily connected)', ['num list peers']), ('peers_list_size', 'num', '', 'number of known peers (not necessarily connected)', ['num list peers']),
('overall_rates', 'rate', 'B/s', 'download and upload rates', ['uploaded bytes', 'downloaded bytes', 'upload rate', 'download rate', 'smooth upload rate', 'smooth download rate']), ('overall_rates', 'rate', 'B/s', 'download and upload rates', ['uploaded bytes', 'downloaded bytes', 'upload rate', 'download rate', 'smooth upload rate', 'smooth download rate']),

View File

@ -120,7 +120,8 @@ namespace libtorrent {
"too many optimistic unchoke slots", "too many optimistic unchoke slots",
"using bittyrant unchoker with no upload rate limit set", "using bittyrant unchoker with no upload rate limit set",
"the disk queue limit is too high compared to the cache size. The disk queue eats into the cache size", "the disk queue limit is too high compared to the cache size. The disk queue eats into the cache size",
"too few ports allowed for outgoing connections" "too few ports allowed for outgoing connections",
"too few file descriptors are allowed for this process. connection limit lowered"
}; };
return torrent_alert::message() + ": performance warning: " return torrent_alert::message() + ": performance warning: "

View File

@ -1074,6 +1074,36 @@ namespace aux {
fclose(m_stats_logger); fclose(m_stats_logger);
} }
// make these cumulative for easier reading of graphs
// reset them every time the log is rotated though,
// to make them cumulative per one-hour graph
m_error_peers = 0;
m_disconnected_peers = 0;
m_eof_peers = 0;
m_connreset_peers = 0;
m_connrefused_peers = 0;
m_connaborted_peers = 0;
m_perm_peers = 0;
m_buffer_peers = 0;
m_unreachable_peers = 0;
m_broken_pipe_peers = 0;
m_addrinuse_peers = 0;
m_no_access_peers = 0;
m_invalid_arg_peers = 0;
m_aborted_peers = 0;
m_error_incoming_peers = 0;
m_error_outgoing_peers = 0;
m_error_rc4_peers = 0;
m_error_encrypted_peers = 0;
m_error_tcp_peers = 0;
m_error_utp_peers = 0;
m_connect_timeouts = 0;
m_uninteresting_peers = 0;
m_transport_timeout_peers = 0;
m_timeout_peers = 0;
m_no_memory_peers = 0;
m_too_many_peers = 0;
error_code ec; error_code ec;
char filename[100]; char filename[100];
create_directory("session_stats", ec); create_directory("session_stats", ec);
@ -1228,6 +1258,8 @@ namespace aux {
":error encrypted peers" ":error encrypted peers"
":error tcp peers" ":error tcp peers"
":error utp peers" ":error utp peers"
":total peers"
"\n\n", m_stats_logger); "\n\n", m_stats_logger);
} }
#endif #endif
@ -2530,6 +2562,10 @@ namespace aux {
, m_torrents.end(), boost::bind(&torrent::num_peers , m_torrents.end(), boost::bind(&torrent::num_peers
, boost::bind(&torrent_map::value_type::second, _1))); , boost::bind(&torrent_map::value_type::second, _1)));
if (m_alerts.should_post<performance_alert>())
m_alerts.post_alert(performance_alert(
torrent_handle(), performance_alert::too_few_file_descriptors));
if (i != m_torrents.end()) if (i != m_torrents.end())
{ {
i->second->disconnect_peers(1, e); i->second->disconnect_peers(1, e);
@ -3512,34 +3548,6 @@ namespace aux {
void session_impl::reset_stat_counters() void session_impl::reset_stat_counters()
{ {
// make these cumulative for easier reading of graphs
/* m_error_peers = 0;
m_disconnected_peers = 0;
m_eof_peers = 0;
m_connreset_peers = 0;
m_connrefused_peers = 0;
m_connaborted_peers = 0;
m_perm_peers = 0;
m_buffer_peers = 0;
m_unreachable_peers = 0;
m_broken_pipe_peers = 0;
m_addrinuse_peers = 0;
m_no_access_peers = 0;
m_invalid_arg_peers = 0;
m_aborted_peers = 0;
m_error_incoming_peers = 0;
m_error_outgoing_peers = 0;
m_error_rc4_peers = 0;
m_error_encrypted_peers = 0;
m_error_tcp_peers = 0;
m_error_utp_peers = 0;
m_connect_timeouts = 0;
m_uninteresting_peers = 0;
m_transport_timeout_peers = 0;
m_timeout_peers = 0;
m_no_memory_peers = 0;
m_too_many_peers = 0;
*/
m_end_game_piece_picker_blocks = 0; m_end_game_piece_picker_blocks = 0;
m_piece_picker_blocks = 0; m_piece_picker_blocks = 0;
m_piece_picks = 0; m_piece_picks = 0;
@ -3920,6 +3928,8 @@ namespace aux {
STAT_LOG(d, m_error_tcp_peers); STAT_LOG(d, m_error_tcp_peers);
STAT_LOG(d, m_error_utp_peers); STAT_LOG(d, m_error_utp_peers);
STAT_LOG(d, int(m_connections.size()));
fprintf(m_stats_logger, "\n"); fprintf(m_stats_logger, "\n");
#undef STAT_LOG #undef STAT_LOG