netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] option for large routing hash
@ 2003-12-09 15:09 Robert Olsson
  2003-12-09 20:20 ` David S. Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Olsson @ 2003-12-09 15:09 UTC (permalink / raw)
  To: davem; +Cc: kuznet, netdev, Robert.Olsson


Hello!

I think patch should be useful as it helps performance a lot during high 
flow load. I have some numbers if you are interested.

Cheers.	
						--ro


--- net/ipv4/Kconfig.orig	2003-12-09 14:00:14.000000000 +0100
+++ net/ipv4/Kconfig	2003-12-09 14:51:27.000000000 +0100
@@ -75,6 +75,19 @@
 
 	  If unsure, say N.
 
+config IP_ROUTE_LARGE_HASH
+	  bool "IP: large routing hash"
+	---help---
+	  Say yes to increase the number of dst hash buckets. Most likely you
+	  are running a server or router with lots of flows. Saying yes 
+	  will increase used dst hash 8 times typically from 16Kbytes to 128 
+	  Kbytes on a 256Mbytes system.
+
+	  dst hash is otherwise tunable via /proc/sys/net/ipv4/route/
+	  Monitoring can be done with rtstat utility this comes with iproute2.
+
+	  If unsure, say N.
+
 config IP_ROUTE_FWMARK
 	bool "IP: use netfilter MARK value as routing key"
 	depends on IP_MULTIPLE_TABLES && NETFILTER
--- net/ipv4/route.c.orig	2003-12-09 13:59:57.000000000 +0100
+++ net/ipv4/route.c	2003-12-09 14:49:48.000000000 +0100
@@ -2747,6 +2747,9 @@
 
 	goal = num_physpages >> (26 - PAGE_SHIFT);
 
+#ifdef CONFIG_IP_ROUTE_LARGE_HASH
+	goal <<= 3;
+#endif
 	for (order = 0; (1UL << order) < goal; order++)
 		/* NOTHING */;
 

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH] option for large routing hash
@ 2003-12-10 14:47 Robert Olsson
  2003-12-10 23:05 ` David S. Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Olsson @ 2003-12-10 14:47 UTC (permalink / raw)
  To: David S. Miller; +Cc: Robert Olsson, kuznet, netdev


Hello!

More thoughts and observations before doing anything else maybe we can wake 
up Alexey...

> IP: routing cache hash table of 4096 buckets, 32Kbytes
 ...
> And tot+hit gives the pps throughput 152 kpps.
 ...
> IP: routing cache hash table of 32768 buckets, 256Kbytes
 ...
> We see cache is now used as hit > tot and we get a performance jump from 
> 152 to 265 kpps.
> 

Some more experiment details. First full Internet routing table was used. 
Processor UP XEON 2.6 GHz.

With large route hash see dst cache overflow. Somewhat surprising it 
seems at first sight but as we increase to 265 kpps so we get much 
closer to max_size (265k entries). So if RCU get problems with getting
the batch job (freeing the dst entries) done. We get dst cache over-
flow. 

The RCU/sofirq stuff pop-up again (now with routing table loaded).
RCU will probable get on the agenda again as from what I heard the
netfilter folks have plans to use it.

It's also worth to notice that focusing just of getting rid of 
"dst cache overflow" can give half performance as seen here. :-)

Since have max_size, gc_elasity,  gc_thresh same. I think it's goal of 
GC that causes the difference. (rt_hash_mask). With a smaller number the
GC gets much more aggressive.

I think this is indicated in rtstat:

 size   IN: hit     tot
35320     62700   88890

Versus:

212976    212665  52703

Much more entries when we increased the bucket size. RCU can play some tricks
here as well.

Conclusions? IMO the dst cache "within it's operation range" is well behaved 
traffic is giving us very good performance and something we don't have pay
attention to. We see cache is in effect simply as hit > tot.

But when hit <= tot we have at least two cases:
1) Traffic is not well behaved. DoS.
2) Traffic is well behaved but tuning is bad.

As the actions is totally different from above cases:
w. 1. Reduce size to avoid searching. 
w. 2. Increase size so cache becomes active.

So it crucial to distinguish between the cases. Can it be done from incoming 
traffic? 


Cheers.
						--ro

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-12-12 23:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-09 15:09 [PATCH] option for large routing hash Robert Olsson
2003-12-09 20:20 ` David S. Miller
2003-12-09 22:28   ` Robert Olsson
2003-12-10  8:15     ` David S. Miller
  -- strict thread matches above, loose matches on Subject: below --
2003-12-10 14:47 Robert Olsson
2003-12-10 23:05 ` David S. Miller
2003-12-12 23:10   ` Robert Olsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).