Hi Elias, mentioned formula was updated per guidance from Damjan: optimal number of bihash buckets is number of expected entries divided by 2.5 rounded to closest pow2 (might he higher or lower).
Regarding memory usage: bihash code has been changed and now uses main heap. Consequently, it ignores memory setting passed to its init function. Old behaviour is available, but we saw no reason to tinker with it and so NAT code now passes 0 in memory_size parameter to bihash init. Thanks, Klement > On 26 Nov 2020, at 17:54, Elias Rudberg <elias.rudb...@bahnhof.net> wrote: > > Hello VPP experts, > > We are using VPP for NAT44 and are currently looking at how to move > from VPP 20.05 to 20.09. There are some differences in the way the NAT > plugin is configured. > > One difficulty for us is the maximum number of sessions allowed, we > need to handle large numbers of sessions so that limit can be > important for us. For VPP 20.05 we have used "translation hash buckets > 1048576" and then the maximum number of sessions per thread becomes 10 > times that because of this line in the source code in snat_config(): > > sm->max_translations = 10 * translation_buckets; > > So then we got a limit of about 10 million sessions per thread, which > we have been happy with so far. > > With VPP 20.09 however, things have changed so that the maximum number > of sessions is now configured explicitly, and the relationship between > max_translations_per_thread and translation_buckets is no longer a > factor of 10 but instead given by the nat_calc_bihash_buckets() > function: > > static u32 > nat_calc_bihash_buckets (u32 n_elts) > { > return 1 << (max_log2 (n_elts >> 1) + 1); > } > > The above function corresponds to a factor of somewhere between 1 and > 2 instead of 10. So, if I understood this correctly, for a given > maximum number of sessions, the corresponding translation_buckets > value will be something like 5 to 10 times larger in VPP 20.09 > compared to how it was in VPP 20.05, leading to significantly > increased memory requirement given that we want to have the same > maximum number of sessions as before. > > It seems a little strange that the translation_buckets value would > change so much between VPP versions, was that change intentional? The > old relationship "max_translations = 10 * translation_buckets" seems > to have worked well in practice, at least for our use case. > > What could we do to get around this, if we want to switch to VPP 20.09 > but without reducing the maximum number of sessions? If we were to > simply divide the nat_calc_bihash_buckets() value by 8 or so to make > it more similar to how it was earlier, would that lead to other > problems? > > Best regards, > Elias > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#18161): https://lists.fd.io/g/vpp-dev/message/18161 Mute This Topic: https://lists.fd.io/mt/78533277/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-