9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* 127.0.0.1 considered harmful
@ 2020-07-11 11:04 Richard Miller
  2020-07-11 15:46 ` [9fans] " Ethan Gardener
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Miller @ 2020-07-11 11:04 UTC (permalink / raw)
  To: 9fans

This seems weird to me:

cpu% echo $sysname
atom
cpu% ndb/query sys atom ip
192.168.23.25
cpu% ndb/query sys localhost ip
127.0.0.1
cpu% srv atom atom /n/atom
post...
cpu% srv localhost localhost /n/localhost
post...
cpu% time cp /n/atom/386/9pccpuf /dev/null
0.00u 0.02s 0.37r 	 cp /n/atom/386/9pccpuf /dev/null
cpu% time cp /n/localhost/386/9pccpuf /dev/null
0.00u 0.00s 24.54r 	 cp /n/localhost/386/9pccpuf /dev/null
cpu% time cp /n/atom/386/9pccpuf /dev/null
0.00u 0.00s 0.14r 	 cp /n/atom/386/9pccpuf /dev/null
cpu% time cp /n/localhost/386/9pccpuf /dev/null
0.00u 0.00s 24.87r 	 cp /n/localhost/386/9pccpuf /dev/null

Intuitively I would have thought the loopback interface would
be more efficient than going through the ethernet driver.
Certainly not two orders of magnitude slower.

This is on a 386-based cpu + fossil server. The same experiment
on arm and cwfs gives similar results.

It's not about raw bandwidth; streaming in one direction seems ok:

cpu% tcptest & tcptest -i atom -n 10000
cpu% tcp!192.168.23.25!34061 count 10000; 81920000 bytes in 2016503491 ns @ 40.6 MB/s (0ms)

cpu% tcptest & tcptest -i localhost -n 10000
cpu% tcp!127.0.0.1!49090 count 10000; 81920000 bytes in 551924026 ns @ 148 MB/s (0ms)

So the problem seems to be latency of 9p transactions. Could it be
an artifact of tcp flow control not adapting well to the loopback
interface? Can anyone offer an insight?


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

* Re: [9fans] 127.0.0.1 considered harmful
  2020-07-11 11:04 127.0.0.1 considered harmful Richard Miller
@ 2020-07-11 15:46 ` Ethan Gardener
  2020-07-11 18:24   ` David du Colombier
  2020-07-13  7:04   ` Lucio De Re
  0 siblings, 2 replies; 6+ messages in thread
From: Ethan Gardener @ 2020-07-11 15:46 UTC (permalink / raw)
  To: g_patrickb via 9fans

On Sat, Jul 11, 2020, at 12:04 PM, Richard Miller wrote:
> So the problem seems to be latency of 9p transactions. Could it be
> an artifact of tcp flow control not adapting well to the loopback
> interface? Can anyone offer an insight?

A comment in the default /lib/ndb/local makes me think the loopback interface was a bit of an afterthought. It's this one:

#
#  because the public demands the name localsource
#
ip=127.0.0.1 sys=localhost dom=localhost

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

* Re: [9fans] 127.0.0.1 considered harmful
  2020-07-11 15:46 ` [9fans] " Ethan Gardener
@ 2020-07-11 18:24   ` David du Colombier
  2020-07-11 18:57     ` Richard Miller
  2020-07-13  7:04   ` Lucio De Re
  1 sibling, 1 reply; 6+ messages in thread
From: David du Colombier @ 2020-07-11 18:24 UTC (permalink / raw)
  To: g_patrickb via 9fans

I think you may be experiencing an issue I investigated
and fixed a few years ago, due to the TCP stack not
setting up the MTU properly on incoming connections.

You can look at this old thread from 9fans:

https://www.mail-archive.com/9fans@9fans.net/msg33754.html

The fix is available here:

http://9legacy.org/9legacy/patch/9-tcp-mss.diff

-- 
David du Colombier

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

* Re: [9fans] 127.0.0.1 considered harmful
  2020-07-11 18:24   ` David du Colombier
@ 2020-07-11 18:57     ` Richard Miller
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Miller @ 2020-07-11 18:57 UTC (permalink / raw)
  To: 9fans

> The fix is available here:
> 
> http://9legacy.org/9legacy/patch/9-tcp-mss.diff

Yes, that was exactly it.

cpu% time cp /n/localhost/386/9pccpuf /dev/null
0.00u 0.01s 0.07r 	 cp /n/localhost/386/9pccpuf /dev/null

Thank you, David!


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

* Re: [9fans] 127.0.0.1 considered harmful
  2020-07-11 15:46 ` [9fans] " Ethan Gardener
  2020-07-11 18:24   ` David du Colombier
@ 2020-07-13  7:04   ` Lucio De Re
  2020-07-17  9:40     ` Ethan Gardener
  1 sibling, 1 reply; 6+ messages in thread
From: Lucio De Re @ 2020-07-13  7:04 UTC (permalink / raw)
  To: 9fans

On 7/11/20, Ethan Gardener <eekee57@fastmail.fm> wrote:
> #
> #  because the public demands the name localsource
> #
> ip=127.0.0.1 sys=localhost dom=localhost
>
Yes, someone should submit a legacy patch just to correct the comment!

Lucio.

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

* Re: [9fans] 127.0.0.1 considered harmful
  2020-07-13  7:04   ` Lucio De Re
@ 2020-07-17  9:40     ` Ethan Gardener
  0 siblings, 0 replies; 6+ messages in thread
From: Ethan Gardener @ 2020-07-17  9:40 UTC (permalink / raw)
  To: g_patrickb via 9fans

On Mon, Jul 13, 2020, at 8:04 AM, Lucio De Re wrote:
> On 7/11/20, Ethan Gardener <eekee57@fastmail.fm> wrote:
> > #
> > #  because the public demands the name localsource
> > #
> > ip=127.0.0.1 sys=localhost dom=localhost
> >
> Yes, someone should submit a legacy patch just to correct the comment!

An easy patch, but I rather like the comment. It amuses me. ;)

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

end of thread, other threads:[~2020-07-17  9:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-11 11:04 127.0.0.1 considered harmful Richard Miller
2020-07-11 15:46 ` [9fans] " Ethan Gardener
2020-07-11 18:24   ` David du Colombier
2020-07-11 18:57     ` Richard Miller
2020-07-13  7:04   ` Lucio De Re
2020-07-17  9:40     ` Ethan Gardener

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).