diff --git a/conf/stellar.toml b/conf/stellar.toml index 708acc0..3d01ef4 100644 --- a/conf/stellar.toml +++ b/conf/stellar.toml @@ -15,9 +15,9 @@ cpu_mask = [5, 6, 7, 8, 9, 10, 11, 12] [ip_reassembly] enable = 1 -timeout = 10000 # range: [1, 60000] (ms) -bucket_entries = 256 # range: [1, 4294967295] (must be power of 2) -bucket_num = 4096 # range: [1, 4294967295] +timeout = 10000 # range: [1, 60000] (ms) +bucket_entries = 32 # range: [1, 4294967295] (must be power of 2) +bucket_num = 1024 # range: [1, 4294967295] [session_manager] # max session number diff --git a/src/core/stellar_core.cpp b/src/core/stellar_core.cpp index 824e079..baac4e1 100644 --- a/src/core/stellar_core.cpp +++ b/src/core/stellar_core.cpp @@ -430,6 +430,7 @@ static void stellar_thread_clean(struct stellar *st) struct stellar_runtime *runtime = &st->runtime; struct stellar_config *config = &st->config; + STELLAR_LOG_FATAL("cleaning worker thread context ..."); for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++) { struct stellar_thread *thread = &runtime->threads[i]; @@ -439,6 +440,7 @@ static void stellar_thread_clean(struct stellar *st) ip_reassembly_free(thread->ip_mgr); } } + STELLAR_LOG_FATAL("worker thread context cleaned"); } static int stellar_thread_run(struct stellar *st) @@ -464,6 +466,7 @@ static void stellar_thread_join(struct stellar *st) struct stellar_runtime *runtime = &st->runtime; struct stellar_config *config = &st->config; + STELLAR_LOG_FATAL("waiting worker thread stop ..."); for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++) { struct stellar_thread *thread = &runtime->threads[i]; @@ -472,6 +475,7 @@ static void stellar_thread_join(struct stellar *st) usleep(1000); // 1ms } } + STELLAR_LOG_FATAL("all worker thread stoped"); } struct stellar *stellar_new(const char *stellar_cfg_file, const char *plugin_cfg_file, const char *log_cfg_file) diff --git a/src/core/stellar_stat.cpp b/src/core/stellar_stat.cpp index 3e36cdb..b14057c 100644 --- a/src/core/stellar_stat.cpp +++ b/src/core/stellar_stat.cpp @@ -109,6 +109,7 @@ enum METRIC_TYPE // TCP segments METRIC_TYPE_TCP_SEGS_INPUT, + METRIC_TYPE_TCP_SEGS_CONSUMED, METRIC_TYPE_TCP_SEGS_TIMEOUT, METRIC_TYPE_TCP_SEGS_RETRANSMITED, METRIC_TYPE_TCP_SEGS_OVERLAPPED, @@ -215,6 +216,7 @@ const char *name[] = { // TCP segments "tcp_segs_input", + "tcp_segs_consumed", "tcp_segs_timeout", "tcp_segs_retransmited", "tcp_segs_overlapped", @@ -522,6 +524,9 @@ void stellar_stat_output(struct stellar_stat *stat) case METRIC_TYPE_TCP_SEGS_INPUT: stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_input; break; + case METRIC_TYPE_TCP_SEGS_CONSUMED: + stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_consumed; + break; case METRIC_TYPE_TCP_SEGS_TIMEOUT: stat->metric_val[j] += thr_stat->session_mgr->tcp_segs_timeout; break; diff --git a/src/session/session.cpp b/src/session/session.cpp index 335f7f3..528f1b2 100644 --- a/src/session/session.cpp +++ b/src/session/session.cpp @@ -206,6 +206,7 @@ struct tcp_segment *session_get_tcp_segment(struct session *sess) if (half->in_order.data != NULL && half->in_order.len > 0 && half->in_order_ref == 0) { + sess->mgr_stat->tcp_segs_consumed++; half->in_order_ref++; return &half->in_order; } @@ -218,6 +219,7 @@ struct tcp_segment *session_get_tcp_segment(struct session *sess) session_inc_stat(sess, dir, STAT_TCP_PAYLOADS_REORDERED, seg->len); // TODO + sess->mgr_stat->tcp_segs_consumed++; sess->mgr_stat->tcp_segs_reordered++; } return seg; diff --git a/src/session/session_manager.h b/src/session/session_manager.h index ea8509e..4e1d2be 100644 --- a/src/session/session_manager.h +++ b/src/session/session_manager.h @@ -82,6 +82,7 @@ struct session_manager_stat // TCP segments uint64_t tcp_segs_input; // sum + uint64_t tcp_segs_consumed; // sum uint64_t tcp_segs_timeout; // sum uint64_t tcp_segs_retransmited; // sum uint64_t tcp_segs_overlapped; // sum diff --git a/test/packet_inject/conf/stellar.toml b/test/packet_inject/conf/stellar.toml index 9a98991..18860ef 100644 --- a/test/packet_inject/conf/stellar.toml +++ b/test/packet_inject/conf/stellar.toml @@ -17,7 +17,7 @@ cpu_mask = [5] enable = 1 timeout = 10000 # range: [1, 60000] (ms) bucket_entries = 8 # range: [1, 4294967295] (must be power of 2) -bucket_num = 4096 # range: [1, 4294967295] +bucket_num = 1024 # range: [1, 4294967295] [session_manager] # max session number