Hi Ben, Please help to review this patch ,which to optimize the flow-limit adjustment.
The v1 patch links to http://patchwork.ozlabs.org/project/openvswitch/patch/20210511075200.19037-1-taoyunxi...@cmss.chinamobile.com/ Thanks, Yun At 2021-05-17 15:22:48, "Tao YunXiang" <taoyunxi...@cmss.chinamobile.com> wrote: >OVS uses a set of gentle mechanisms to control the number of flows in >datapath. However, it is difficult for the number of datapath flows to >reach a high level in a short time. > >Through some tests with Apache benchmark, I found the point is that >the value of flow-limit increases too slowly, but decreases very quickly. > >This change has two improvements. One is the flow-limit will adjust more >linearly. The other one is, when the duration is small, the flow-limit will >increase faster. > >Through this change, the test result of Apache benchmark can reach 12k from 5k, >the test command is as follows: > >ab -n 200000 -c 500 -r http://1.1.1.2/ > >v1->v2: Make flow-limit changes linearly. Add a limitation to make flow_limit >won't overflow UINT_MAX. > > >Signed-off-by: Tao YunXiang <taoyunxi...@cmss.chinamobile.com> >Cc: Ben Pfaff <b...@ovn.org> > >--- > ofproto/ofproto-dpif-upcall.c | 20 +++++++++++++------- > 1 file changed, 13 insertions(+), 7 deletions(-) > >diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c >index ccf97266c..805409165 100644 >--- a/ofproto/ofproto-dpif-upcall.c >+++ b/ofproto/ofproto-dpif-upcall.c >@@ -963,14 +963,20 @@ udpif_revalidator(void *arg) > > duration = MAX(time_msec() - start_time, 1); > udpif->dump_duration = duration; >- if (duration > 2000) { >- flow_limit /= duration / 1000; >- } else if (duration > 1300) { >- flow_limit = flow_limit * 3 / 4; >- } else if (duration < 1000 && >- flow_limit < n_flows * 1000 / duration) { >- flow_limit += 1000; >+ >+ /* Use duration as a reference, adjust the value of flow_limit, >+ * when the duration is short, increase the flow_limit, and vice >+ * versa. The purpose of using multiple conversions between int >+ * and float is to make the flow_limit change more linear. */ >+ >+ if (duration >= 1000) { >+ flow_limit = (int) ((float) (flow_limit) / (duration / >1000.0)); >+ } else if (flow_limit * (1000.0 / duration) >= UINT_MAX) { >+ flow_limit = ofproto_flow_limit; >+ } else { >+ flow_limit = (int) (flow_limit * (1000.0 / duration)); > } >+ > flow_limit = MIN(ofproto_flow_limit, MAX(flow_limit, 1000)); > atomic_store_relaxed(&udpif->flow_limit, flow_limit); > >-- >2.17.1 > > > >_______________________________________________ >dev mailing list >d...@openvswitch.org >https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev