pf: Increase default hash table size

Now that we (by default) limit the number of states to 100.000 it makse sense
to also adjust the default size of the hash table.

Based on the benchmarking results in
https://github.com/ocochard/netbenches/blob/master/Atom_C2758_8Cores-Chelsio_T540-CR/pf-states_hashsize/results/fbsd12-head.r332390/README.md
128K entries offers a good compromise between performance and memory use.

Users may still overrule this setting with the net.pf.states_hashsize and
net.pf.source_nodes_hashsize loader(8) tunables.
This commit is contained in:
Kristof Provost 2018-08-05 13:54:37 +00:00
parent 5abe8cb6de
commit 91e0f2d200
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337350
2 changed files with 4 additions and 4 deletions

View File

@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 14, 2013
.Dd August 5, 2018
.Dt PF 4
.Os
.Sh NAME
@ -84,11 +84,11 @@ tunables are available.
.It Va net.pf.states_hashsize
Size of hash tables that store states.
Should be power of 2.
Default value is 32768.
Default value is 131072.
.It Va net.pf.source_nodes_hashsize
Size of hash table that store source nodes.
Should be power of 2.
Default value is 8192.
Default value is 32768.
.El
.Pp
Read only

View File

@ -1470,7 +1470,7 @@ struct pf_idhash {
extern u_long pf_hashmask;
extern u_long pf_srchashmask;
#define PF_HASHSIZ (32768)
#define PF_HASHSIZ (131072)
#define PF_SRCHASHSIZ (PF_HASHSIZ/4)
VNET_DECLARE(struct pf_keyhash *, pf_keyhash);
VNET_DECLARE(struct pf_idhash *, pf_idhash);