Subject: Still slow
To: None <current-users@NetBSD.ORG>
From: alphaepsilon <aellwood@MIT.EDU>
List: current-users
Date: 08/02/1995 11:13:00
Hi, I upgraded to XFree86 3.1.2 last night and my garbled colormap
problems have gone away.  In fact I seem to have fixed all but one of
the problems I reported earlier (with help -- thanks guys).
Unfortunately that is the problem I have had since I first updated to
current.  X still gets slow.

Sorry this is so long.  I'm trying to provide as much info as I can.


Why I think this is a bug and not slow hardware:

* X starts out fast.  Really zippy fast.  Commands like ps, ls, more,
  etc are really fast.  I can generally get two xterms and one emacs 
  up.  The second emacs usually starts the slowdown, even if I close 
  the first one before opening the second one.

* Very rarely it starts out fast and never gets slow.  

* When it starts out fast I can do an infinite number of things which
  don't open windows, and it will never slow down.

* The slowdown appears to be based on the number of windows that have
  been opened, not on the number of windows that *are* open at a time.

* Closing everything does not speed it up again, only killing X.

* The slowdowns started to occur after updating to May 15th current
  from 1.0.  I had not changed the version of X (3.1.1 at the time).
  NetBSD 1.0 and XFree86 3.1.1 never slowed down at all.

* When I updated to Jul 16th current the problem got worse (it now
  gets slow much sooner).


My machine:
-----------
NCR Pentium motherboard with 16MB RAM, Phoenix BIOS, and a P90 processor
PCI NCR SCSI-II card
1 gig HP SCSI-II drive
240 meg Quantum SCSI-I drive
PCI ATI Mach64 with 2MB DRAM
ISA SMC Elite 16C Ultra ethernet card
ISA Sound Blaster 16

I have turned off *all* caching in setup except for BIOS shadowing.
For some reason it won't let me disable that.

Under 1.0 this machine was wonderfully fast, both when running X and
not.  I have thought about downgrading to 1.0 but it seems too much of
a hassle and I worry that if this is a bug, it will be in the next
release of NetBSD if I don't try to fix it now.

Kernel builds and other major memory hogging operations do not create
this behavior.  Netscape, when popped up on another machine's console
does not cause the slowdown.


What happens:

This is going to be a pretty qualitative description, but I'm hoping
the more info I give, the better someone can direct me as to what is
going on.

Basically I start X and it seems great.  I start up 2 xterms and both
seem fine.  Then I start up an emacs and that seems fine.  However, if
I start up another emacs, or start up netscape (or chimera or Mosaic)
instead of the first emacs, I get the following behavior:

* reads and writes to and from the hard drive take a really long time.
  If I watch the hard drive indicator light it's pretty obvious why it's
  slow.  The light flashes about once a second.  Basically I'm dependent
  on the seek time of the drive, and I have to wait a second on top of
  that.  

* commands (like ps, ls, more -- cd is fast but it's a shell builtin)
  take a really long time:

When X is slow:
---------------
aellwood@tetrahydrocannabinol: /usr/bin/time ps augxww
USER       PID %CPU %MEM   VSZ  RSS TT  STAT STARTED       TIME COMMAND
[...]
       46.15 real         0.10 user         0.13 sys

When X just started:
--------------------
aellwood@tetrahydrocannabinol: /usr/bin/time ps augxww
USER       PID %CPU %MEM   VSZ  RSS TT  STAT STARTED       TIME COMMAND
        1.57 real         0.03 user         0.20 sys

With no X running:
------------------
aellwood@tetrahydrocannabinol: /usr/bin/time ps augxww
USER       PID %CPU %MEM   VSZ  RSS TT  STAT STARTED       TIME COMMAND
[...]
        0.30 real         0.06 user         0.10 sys

* vmstat output looks really crazy when X is running.  Note I have 50
  megs of swap:

vmstat 2 without X:
-------------------
 procs   memory     page                    disks         faults      cpu
 r b w   avm   fre  flt  re  pi  po  fr  sr ?0 ?1 ?2 ?3   in   sy  cs us sy id
 0 6 0 42692  3408    3   1   0   0   0   0  0  0  0  0    0   25   3  1  0 99
 0 6 0 42692  3408    3   0   0   0   0   0  0  0  0  0    0   17   3  0  0 100
 0 6 0 42692  3408    1   0   0   0   0   0  0  0  0  0    0   14   2  0  0 100
>start emacs 
 0 6 0 63560  3164  260 152   7   0   0   0  0  0  0  0    0  150  13  6  6 88
 0 6 0 63560  3164    1   0   0   0   0   0  0  0  0  0    0   51   2  2  1 97
 0 6 0 63560  3164    1   0   0   0   0   0  0  0  0  0    0   12   2  0  0 100
>kill emacs 
 0 6 0 42700  3544   16   5   0   0   0   0  0  0  0  0    0   61   7  0  1 99
 0 6 0 42700  3544    1   0   0   0   0   0  0  0  0  0    0   17   2  0  0 100
 0 6 0 38104  3544    1   0   0   0   0   0  0  0  0  0    0   16   3  0  0 100
 0 6 0 38104  3544  117  27   0   0   0   0  0  0  0  0    0  311  10  6  2 92
 0 6 0 38104  3544    1   0   0   0   0   0  0  0  0  0    0   20   5  0  0 100
 0 6 0 38104  3544    1   0   0   0   0   0  0  0  0  0    0   15   4  0  0 100

vmstat 2 with X without slowdown:
---------------------------------
 procs   memory     page                    disks         faults      cpu
 r b w   avm   fre  flt  re  pi  po  fr  sr ?0 ?1 ?2 ?3   in   sy  cs us sy id
 0 6 02208804   336    3   1   0   0   0   0  0  0  0  0    0   25   3  1  0 99
 0 6 02191580   336    3   1   0   0   0   0  0  0  0  0    0  210  57  0  1 99
 0 6 02179204   336    1   0   0   0   0   0  0  0  0  0    0   60   5  2  0 97
 0 6 02154408   336    1   0   0   0   0   0  0  0  0  0    0   19   5  0  0 100
 0 6 02154408   336    1   0   0   0   0   0  0  0  0  0    0   25   7  0  0 100
>start emacs
 0 8 02174608   300  256 128  10   0   0  47  0  0  0  0    0  289 130 12 10 78
 0 6 02174740   312   78   9   9   1   0  39  0  0  0  0    0  964 246 15 10 75
 0 6 02174796   328   48   5  10   9   0  43  0  0  0  0    0 1151 310 32 18 50
 0 6 02174796   328    1   0   0   0   0   0  0  0  0  0    0  291  66  0  0 100
 0 6 02174796   328    1   0   0   0   0   0  0  0  0  0    0  481 112  2  0 98
 0 6 02162292   328    1   0   0   0   0   0  0  0  0  0    0   21   4  0  0 100
 1 6 02157696   328    1   0   0   0   0   0  0  0  0  0    0  281  64  0  0 100
>kill emacs
 0 6 02137332  1008   12   1   3   0   0   0  0  0  0  0    0  345  71  4  2 94
 0 6 02137332  1008    1   0   0   0   0   0  0  0  0  0    0  228  52  0  0 100
 0 6 02137332  1008    1   0   0   0   0   0  0  0  0  0    0  160  36  0  0 100
 0 6 02137332  1008    1   0   0   0   0   0  0  0  0  0    0  177  39  0  0 100
 0 6 02137184  1008    1   0   0   0   0   0  0  0  0  0    0   40  10  0  0 100

Isn't that a really large value for "avm"?

vmstat 2 with X when it starts to slowdown:
-------------------------------------------
 procs   memory     page                    disks         faults      cpu
 r b w   avm   fre  flt  re  pi  po  fr  sr ?0 ?1 ?2 ?3   in   sy  cs us sy id
 1 6 02154436   804    3   1   0   0   0   0  0  0  0  0    0   26   3  1  0 99
 0 6 02154436   804    3   0   0   0   0   0  0  0  0  0    0  168  41  1  0 99
 0 6 02154436   804    6   1   0   0   0   0  0  0  0  0    0  162  42  2  2 96
 0 6 02154436   804    1   0   0   0   0   0  0  0  0  0    0   69  17  0  0 99
 0 6 02149840   804    1   0   0   0   0   0  0  0  0  0    0   21   5  0  0 100
 0 6 02149840   804    1   0   0   0   0   0  0  0  0  0    0   59   5  2  1 96
>start netscape
 0 8 02165040   496   90   8  21   0   0   0  0  0  0  0    0   80  31  1  4 94
 0 8 02165252   304   95  59  62  24   0 171  0  0  0  0    0  610 234  6 14 81
 0 8 02165492   260   66   9  37  50   0 244  0  0  0  0    0  219 102 10  8 82
 1 7 02165692   340   72  75  55  29   0 186  0  0  0  0    0  242 142 16 12 71
 0 8 02153280   260   83   0  39   0   0  67  0  0  0  0    0  669 185 50 23 27
 0 6 02153656   296   41   0  10   0   0  44  0  0  0  0    0  438 117 56  8 35
 0 8 02153712   284   20   0  14   0   0  12  0  0  0  0    0 1031 279 13 10 77
 0 6 02154052   272   89   0  40   0   0  44  0  0  0  0    0  634  92 24  8 68
>everything starts to get really jerky and slow
 0 6 02158796   272    1   0   0   0   0   0  0  0  0  0    0  413  95 19  3 78
 0 8 02158796   256    4   0   3   0   0   0  0  0  0  0    0  496  89 10  2 88
 0 8 02157528   340    1   0   1   0   0  11  0  0  0  0    0   42   9  0  0 100
 0 7 02144796   340    1   0   0   0   0   0  0  0  0  0    0   75   8  2  2 96
 0 8 02149592   328    2   0   1   0   0   0  0  0  0  0    0   18   6  0  0 100
 0 8 02144996   324    2   0   1   0   0   0  0  0  0  0    0   20   6  0  0 100
 0 8 02149732   312    2   0   1   0   0   0  0  0  0  0    0  109  16  2  2 97
 017 02149732   328    5   3   2   0   0   4  0  0  0  0    0  118  27  0  0 100
 0 8 02149732   328    1   0   1   0   0   0  0  0  0  0    0   45  10  1  0 99
 0 8 02149732   320    2   0   1   0   0   0  0  0  0  0    0   21   5  0  0 100
 0 8 02149584   312    2   0   1   0   0   0  0  0  0  0    0   22   6  0  0 100
 0 8 02136720   308    1   0   1   0   0   0  0  0  0  0    0   81  11  4  0 96
 0 8 02124440   296    2   0   1   0   0   0  0  0  0  0    0   46  11  0  0 100
 0 8 02124440   288    2   0   2   0   0   0  0  0  0  0    0   45  12  0  0 100
 0 7 02137304   272    3   0   2   0   0   0  0  0  0  0    0  349  68  1  0 98
 0 6 02137312   268    1   0   1   0   0   0  0  0  0  0    0  361  68  0  1 99
 0 7 02137312   340    2   0   2   3   0  13  0  0  0  0    0  465  61  2  2 96
 0 8 02137312   332    2   0   1   0   0   0  0  0  0  0    0   39  11  2  0 98
 0 8 02137312   324    2   0   1   0   0   0  0  0  0  0    0   32   7  0  0 100
 0 7 02137312   312    5   0   0   0   0   0  0  0  0  0    0   21   4  2  0 98
 0 8 02132716   292    3   0   2   0   0   0  0  0  0  0    0   14   3  0  0 100
 0 8 02132716   284    2   0   1   0   0   0  0  0  0  0    0   61   5  2  2 96
 0 8 02132716   272    2   0   2   0   0   0  0  0  0  0    0   19   5  0  0 100
 0 7 02132724   264    5   0   4   0   0   0  0  0  0  0    0  229  16  8  2 90
>netscape stops loading and the mouse starts moving again
 0 8 02127928   340    2  31   0  15   0  57  0  0  0  0    0  392  81  0  0 99
 0 8 02127780   340    1   0   0   0   0   0  0  0  0  0    0  513 106  0  0 100
 0 7 02127780   340    1   0   0   0   0   0  0  0  0  0    0  197  33  2  1 97
 0 7 02127780   340    1   0   0   0   0   0  0  0  0  0    0  257  54  1  0 99
 0 7 02127780   340    1   0   0   0   0   0  0  0  0  0    0  148  31  0  0 100
 0 7 02127856   340    4   0   0   0   0   3  0  0  0  0    0  315  37  2  0 97
 0 7 02132652   272   42   0  19   0   0  11  0  0  0  0    0  344  61 15  5 80
 0 7 02132692   264    2   0   0   0   0   0  0  0  0  0    0  453  79  3  1 96
 0 8 02145180   340    6  16   0  17   0  49  0  0  0  0    0   23   6  2  0 98
 0 8 02132328   340   24   7  16  12   0  40  0  0  0  0    0  597  92  9  4 87
 procs   memory     page                    disks         faults      cpu
 r b w   avm   fre  flt  re  pi  po  fr  sr ?0 ?1 ?2 ?3   in   sy  cs us sy id
 1 8 02132328   340    1   0   0   0   0   0  0  0  0  0    0   90  18  1  0 99
 0 8 02127732   340    1   0   0   0   0   0  0  0  0  0    0   21   5  2  0 98
 1 8 02132468   340    1   0   0   0   0   0  0  0  0  0    0  232  36  3  1 96
 0 8 02132468   340    1   0   0   0   0   0  0  0  0  0    0  117  22  0  0 100
 1 7 02132468   340    1   0   0   0   0   0  0  0  0  0    0  106  20  0  0 100
 1 6 02132468   340    1   0   0   0   0   0  0  0  0  0    0  133  25  1  0 99
 0 6 02132320   340    1   0   0   0   0   0  0  0  0  0    0  169  31  0  0 100
 0 6 02132320   340    1   0   0   0   0   0  0  0  0  0    0   62   5  2  1 97
 0 6 02120040   340    1   0   0   0   0   0  0  0  0  0    0   92  18  0  0 100
 0 6 02120040   340    1   0   0   0   0   0  0  0  0  0    0  455  77  0  0 100
 0 6 02132904   340    1   0   0   0   0   0  0  0  0  0    0  723 122  1  0 99
>try to quit netscape
 0 8 02132912   256   13   0   4   0   0   0  0  0  0  0    0  285  54  1  1 98
 0 8 02132912   336    2   0   1   0   0  11  0  0  0  0    0   65   8  2  2 96
 0 6 02132912   332    4   0   3   0   0   0  0  0  0  0    0  491  73  2  1 98
 0 6 02132912   328    1   0   1   0   0   0  0  0  0  0    0  474  80  3  0 97
 0 7 02132912   328    1   0   0   0   0   0  0  0  0  0    0  163  32  5  0 95
 0 7 02128316   328    1   0   0   0   0   0  0  0  0  0    0   38   9  0  0 100
 0 7 02128316   328    1   0   0   0   0   0  0  0  0  0    0   83  11  2  1 97
 0 7 02128316   324    1   0   1   0   0   0  0  0  0  0    0   25   5  0  0 100
 0 7 02128316   324    1   0   0   0   0   0  0  0  0  0    0   17   5  0  0 100
>netscape quits
 0 8 02138372  1536    4   0   1   0   0   0  0  0  0  0    0   90  19  5  1 94
 0 7 02138224  1536    7   0   0   0   0   0  0  0  0  0    0   76  17  1  0 99
 0 6 02138224  1536    1   1   0   0   0   0  0  0  0  0    0   90  12  3  0 97
 0 6 02138224  1536    1   0   0   0   0   0  0  0  0  0    0  192  45  1  0 99
 0 6 02138224  1536    1   0   0   0   0   0  0  0  0  0    0  137  30  0  0 100
 0 6 02138224  1536    1   0   0   0   0   0  0  0  0  0    0   72  16  0  0 100

* In slow mode I tried to launch an emacs to paste the above output
  into.  It took 1.5 mins to give me something to position and then 30
  seconds for me to be able to type into it (it sets colors and resizes
  itself during this).  After it had loaded it was terribly slow to load
  and save files.

* Eventually, if the system is left up in slow mode, it gets so slow it
  stops pinging and then hangs (not eternally, just for a reallly
  reallly long time).  Ctrl-Alt-Backspace does nothing, even if left
  for 8 hours (tried just waiting).

* If I do manage to kill X before it gets that slow, X comes up again
  fine without rebooting.  Again it is fast until I run too many
  windows.


It seems to me that something is wrong with the behavior of the
virtual memory system when X is running.  Unfortunately I don't
understand the internals of the vm system to be able to say more than
that (which is why I'm writing here :-)

If anyone has *any* ideas, or any suggestions on what might give more
clueful output, please please please tell me.  The term is going to
start soon, and I need my computer working so I can do my classwork on
it.  And if anyone in the Boston area is psyched to help me debug it,
you are welcome.  Debugging remotely is almost impossible because in
slow mode, people can't log in remotely -- it takes 10-20 minutes just
to get logged in and typing anything is sort of out of the question...


Thanks in advance,

-- 
-----------------------------------------------------------------------------
Alexandra Ellwood             finger aellwood@monk.mit.edu for PGP public key
IS/DCNS (MIT)           http://www.mit.edu:8001/people/aellwood/aellwood.html
<aellwood@mit.edu>        "Did you know there's pornography on the internet?"
-----------------------------------------------------------------------------