On Monday 26 February 2007 06:07, you wrote:
> Hello,

cc to the list, it may help others.

> Thanks for your answer
> Do you know a method  to choose hashSize  as you explain me for
> conntrack max ?

Yes, the hash table size(search wikipedia if you do not know what a hash table 
is) is the numbers of bucket that you have. 
So if you have a table with 10 buckets and you put 160 conntrack 
entries(conntrack_max), then each bucket will have 16 average  entries. In 
practice can happens that a bucket has 0 and other has 30 or more, it depends 
on the eficency of the hash algorithm, but you can assume an average of 16 to 
do your maths.
After the bucket is found by the hash function, the entrie is searched 
lineary, so in our example with hash_size at 10 and conntrack_max at 160, the 
kernel will do at last an 16 items linear search, so just to simplify, whe 
can assume an average linear search of 8 items.

In a 1GB memroy i386PC, the linux kernel defaults to 8180 buckets and 65440 
entries, if you start reciving messages that conntrack table is full, you can 
just rise up the entries to an 1/16 ratio (as in the example above), this 
means set conntrack_max to 13088 and leave hash_size in 8180.
At 5000 searches per second you will have an average of 5000*8=40000 aditional 
operations to search an item, 40000 operations/second shure cost some cpu 
cycles.
But if you rise up the bucket as well to  65440(1/2 ratio) you will reduce the 
number to just 5000 operations per second.

To choose the rigth number just depends on how much RAM you have, how fast is 
you CPU, and how many searches are made in the conntrack table.
--
Luciano
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

Reply via email to