-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicated flush in onvm_pkt_process_rx_batch
#281
Comments
I have tried solution 1 (comment out EnvVNF Chain: fwd -> fwd -> fwd -> firewall Performance==CPU USage==
|
Thanks @JackKuo-tw. I believe the reason we have Can you test to see how your solution behaves under a low traffic rate, for example just using a In any case, it is interesting that you find this consuming a large amount of CPU. We have not done much profiling to find the main sources of overhead. |
@twood02 You're right, solution 1 blocks all packets if the buffer count is lower than It's a trade-off, for either low latency or high throughput. AFAIK, the following modification should reach our goal, which uses the timeout concept:
rx_thread_main(void *arg) {
...
!! int flush_threshold = 0;
!! int enable_flush_count = 0;
...
for (; worker_keep_running;) {
/* Read ports */
for (i = 0; i < ports->num_ports; i++) {
rx_count = rte_eth_rx_burst(ports->id[i], rx_mgr->id, pkts, PACKET_READ_SIZE);
ports->rx_stats.rx[ports->id[i]] += rx_count;
/* Now process the NIC packets read */
if (likely(rx_count > 0)) {
// If there is no running NF, we drop all the packets of the batch.
if (!num_nfs) {
onvm_pkt_drop_batch(pkts, rx_count);
} else {
onvm_pkt_process_rx_batch(rx_mgr, pkts, rx_count);
!! enable_flush_count = 1;
}
}
}
!! if (enable_flush_count && flush_threshold++ == 1000) {
!! onvm_pkt_flush_all_nfs(rx_mgr, NULL);
!! flush_threshold = 0;
!! enable_flush_count = 0;
!! }
}
...
}
In my test, CPU usage can be as low as About additional latency, I insert So if we adopt 1000 as the threshold, the impact is < 0.01 ms, which is a very small overhead but can solve this problem. |
@twood02
We can see the batch sizes are uneven when NF is at the beginning of the chain. And as time goes on, they get much more even. I think the key reason is the long processing time, which causes the buffer to accumulate more packets. This concept is like the "timespan" in the SIGCOMM paper "Microscope", which means the time between the first packet and the last packet leave the NF. |
I think this is a necessary evil and would not PR this code. My modification in this issue could be tuned by those who need it. |
Bug Report
Current Behavior
The function
onvm_pkt_process_rx_batch
calls the following 2 function, and both of them callonvm_pkt_flush_nf_queue
finally, which could lower the performance.onvm_pkt_enqueue_nf
onvm_pkt_flush_nf_queue
whenbuf count
meetsPACKET_READ_SIZE
onvm_pkt_flush_all_nfs
onvm_pkt_flush_nf_queue
Expected behavior/code
Call it once only.
Steps to reproduce
Provide command line instructions if possible.
Environment
Possible Solution
Because
onvm_pkt_process_tx_batch
also callsonvm_pkt_enqueue_nf
and do NOT calls any flush function, I think there are 3 solutions:onvm_pkt_flush_all_nfs
inonvm_pkt_process_rx_batch
onvm_pkt_enqueue_nf
, which can control whether to callonvm_pkt_flush_nf_queue
onvm_pkt_flush_nf_queue
fromonvm_pkt_enqueue_nf
, and addonvm_pkt_flush_nf_queue
toonvm_pkt_process_tx_batch
BTW
I trace this code because I found that if I have multiple
simple_forward
the first one in the chain must consume much more CPU usage than others, this is so strange.But I think this issue could not solve my problem, I haven't verified this guess.
The text was updated successfully, but these errors were encountered: