LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1436|回复: 0

zz:osnews:一些有关内存使用量的摘抄

[复制链接]
发表于 2005-5-14 10:46:46 | 显示全部楼层 |阅读模式
http://www.osnews.com/comment.php?news_id=10555&limit=no

RE: FC-performance
By William (IP: 200.30.100.---) - Posted on 2005-05-11 13:55:23
Hi. I posted a simple performance comparision between FC3 and FC4T2 on d-d-l@gnome.org.
http://mail.gnome.org/archives/d ... 5-May/msg00050.html
  1. The hall of bloat

  2.     * From: William Lovaton <walovaton yahoo com mx>
  3.     * To: desktop-devel-list gnome org
  4.     * Subject: The hall of bloat
  5.     * Date: Mon, 09 May 2005 19:39:45 -0500

  6. Hi there guys.  I've been following the Gnome development for a long
  7. time and I am a good advocate of this desktop here in my country
  8. (Colombia).

  9. I write this for two reasons.  First, to congratulate you all for a very
  10. good 2.10 release, it has improvements and refinements all over the
  11. place like every new release.  Second, to give some comparisons results
  12. from Gnome 2.8 and 2.10 about performance and memory consumption using
  13. Fedora Core 3 and Fedora Core 4 Test 2 systems respectively.

  14. The FC4T2 machine (G2.10) is an old Athlon 600MHz computer with 384 MB
  15. of RAM.  The FC3 machine (G2.8) is an Athlon XP 2000MHz computer with
  16. 512 MB of RAM. So take the differences into account when reading the
  17. comparison.

  18. First, I configured an standard gnome setup in new accounts, the
  19. standard applets, and a few launchers.  Then I changed the theme for
  20. Clearlooks, the fonts to bitstream and 8 pixels, set a colorful
  21. background, deactivated unneeded services and finally, get rid of the
  22. ugly Redhat Network Applet (rhn) which frees a few megs of RAM.

  23. On both systems the binaries were prelinked to improve start up time and
  24. reduce memory consumption.  Both systems were using the spanish locale.

  25. Here are some results:

  26.                                 FC4T2                FC3
  27.                                 -----------        ------------
  28. System boot time                1 min 2 sec        1 min 10 sec
  29. Desktop start up time                18 sec                21 sec
  30. Memory usage after login        62 MB                83 MB


  31. The following chart shows the memory consumption by programs as shown by
  32. gnome-system-monitor.  The first value is the virtual memory size and
  33. the value in parenthesis is the resident size.  Both values are in
  34. megabytes.  The first section of the table will show the processes
  35. started by default when you log into gnome which correspond to the
  36. "Memory usage after login" field in the previous table.

  37.                 FC4T2 (G2.10)        FC3 (G2.8)
  38.                 -------------        ----------
  39. X                66.6 (15.0)        91.1 (18.4)
  40. nautilus        38.2 (13.0)        40.0 (16.0)
  41. g-s-m                32.1 (10.8)        22.9 (10.5)
  42. gnome-panel        31.6 (9.9)        22.0 (10.8)
  43. mixer_applet2        22.3 (9.3)        23.7 (10.2)
  44. wnck-applet        21.1 (9.2)        21.1 (9.3)
  45. gnome-session        20.9 (8.5)        23.4 (9.9)
  46. clock-applet        21.2 (8.0)        21.5 (7.9)
  47. g-s-d                19.8 (7.0)        20.7 (7.3)
  48. gconfd-2        10.2 (6.9)        10.4 (6.5)
  49. metacity        13.3 (6.5)        14.7 (6.6)
  50. g-v-m                19.4 (6.4)        20.1 (6.3)

  51. These were the most relevant processes after login which in theory
  52. represents the 62 MB for G2.10 and 83 MB for G2.8.

  53. The following are the memory consumption for some gnome/gtk+ apps.

  54.                 FC4T2 (G2.10)        FC3 (G2.8)
  55.                 -------------        ----------
  56. evolution        75.0 (18.7)        43.5 (17.2)
  57. firefox                95.3 (23.9)        99.5 (22.9)
  58. epiphany        96.4 (20.4)        99.2 (21.6)
  59. gedit                25.4 (12.2)        24.9 (12.3)
  60. gimp                33.4 (26.3)        31.5 (23.2)
  61. evince/gpdf        23.4 (9.7)        22.3 (9.2) [1]
  62. gconf-editor        20.8 (9.3)        20.8 (8.8)
  63. dia                27.7 (14.9)        27.6 (14.8)
  64. planner                25.0 (11.9)        34.5 (14.8)
  65. totem                35.4 (13.5)        121.0 (30.6) [2]
  66. glade-2                23.3 (12.1)        23.7 (11.9)
  67. gnome-terminal        35.7 (11.7)        37.0 (12.0)
  68. gcalctool        21.0 (9.3)        21.1 (9.1)
  69.                 -------------        ----------
  70. [subtotal]        151.3 MB        181 MB

  71. oowriter        152.9 (51.3)        146 (52.8)
  72.                 -------------        ----------
  73. [total]                167.8 MB        199 MB

  74. [after closing
  75. all apps]        81.1 MB                99 MB


  76. [1] evince for FC4 and gpdf for FC3
  77. [2] FC4 uses the GStreamer backend, FC3 uses the totem backend.


  78. These values were obtained just opening the apps without loading any
  79. file or document, eg. firefox and epiphany were configured to load a
  80. blank page by default.

  81. During constant use it was a lot easier to raise memory consumption on
  82. the G2.8 system.  G2.10 was a lot more consistent and it was very
  83. difficult to make the system swap.  For this to happen I had to use
  84. several apps and load many documents (word, pdfs, images, etc.).

  85. You can see that nautilus have improved over the previous version, the
  86. same goes for X and gnome-session.  gnome-panel got a reduction in the
  87. resident size bot got bigger in the virtual memory size.  What does that
  88. mean? What would cause this change in behavior?

  89. I know that the new version of evolution have got some optimizations
  90. that would reduce its memory usage over the previous version when
  91. working with a huge mail box.

  92. The other doubt I have is the difference of memory consumption when I
  93. started the desktop (62 MB), started many apps, and closed all the apps
  94. (81.1).  The difference is 19 MB for G2.10 and 16 MB for G2.8.  What
  95. would that mean? any leakage problem?

  96. The other problems I see are the applets, the clock for example, gets
  97. bigger after using the evo integration going from 21.2 (8.0) to 64.0
  98. (10.4) of virtual and resident size respectively, even evince is
  99. smaller.  The reason for this is that the clock is not simple any more
  100. because it got new features and it integrates very nicely with
  101. evolution.  Any idea about this?  I know Ben Maurer have been suggesting
  102. to change some applets in-process (into gnome-panel) to reduce the
  103. overhead but this is not a very good idea stability wise.

  104. A suggestion of mine (I'm not a C expert) would be to move some applets
  105. (or group them) into some programs, for example, the trashapplet uses 9
  106. MB of resident size which is a lot for such a simple functionality.
  107. Maybe we can save a lot moving the trashapplet into wnck-applet or
  108. creating a new program that would group some applets which have common
  109. functionality.  That way we can get the best of both worlds, a very
  110. stable panel and less independent processes running on the system for
  111. every single applet.

  112. To summarize, we can see a lot of improvements in this new Gnome version
  113. and I am looking forward to the optimizations that will be in G2.12.
  114. I'd really like to see the memory consumption of the standard desktop
  115. reduced from 62 to less than 50 MB.

  116. The other thing I'd really like to see optimized is the desktop startup
  117. speed, like Nat Friedman said in an earlier thread, it takes a very long
  118. time.

  119. Cheers,


  120. -William
复制代码


In short, FC4 is a lot better in memory usage. More that 20 MB less that FC3 with an equal desktop setup. I turned off unneeded services with out being paranoic (I left sendmail turned on I swear :-)).

The boot up process is faster too (I guess I wasn't using early login) and the Gnome login speed seems better. All of this with a not so fast computer, FC4 was on an Athlon 600 while FC3 was on an Athlon 2000.

About xfs, I just checked out top in my FC3 system and it says 3.5MB of VM size and 1.7MB of residen size. That is not a big deal. If you want to save memory you should kill the RHN Applet for good... lots of megs in there.

About SELinux, I just noticed that I consumend a bit more of RAM but everything was fast. During the comparision I posted I turned off SELinux but that's something that everyone should have enabled all the time.

Finally, remember that the most important thing is to use prelink after installation. It can take about 1H 30Min depending on the number of packages installed. It really makes a difference in start up speed and memory consumption.

Cheers,


-William



2.
RAM Usage
By Father Baker (IP: ---.lcwireless.net) - Posted on 2005-05-11 13:19:11
Why do people think that filling RAM is a bad thing? As long as you're not heavily swapping, you *should* be using your RAM. You paid for it, remember? Having 512 MB of it sitting idle while programs starved themselves would not make your system "optimized."
RE: RAM Usage
By William (IP: 200.30.100.---) - Posted on 2005-05-11 14:08:43
Father Baker, It is _always_ good that a developer try to reduce memory usage of a program (without hacks) because of the reason you just said.

The RAM shuold always be full, like you said, but with the OS buffer and cache data, _NOT_ with user space software bloat. That's the big difference. When you read files or do other operations the OS will cache as many data as it can as long as it has spare RAM. If you start many programs, or use a lot of bloatware, the OS will have to reduce the cache size to give memory back to user space programs.

Another advantege is that smaller programs improve cache behavior on the processor and reduce cache misses making the system more responsive.

Cheers,

-William


3.
RE: RAM USAGE
By JeffS (IP: ---.ded.pacbell.net) - Posted on 2005-05-11 17:12:12
"Why do people think that filling RAM is a bad thing? As long as you're not heavily swapping, you *should* be using your RAM. You paid for it, remember? Having 512 MB of it sitting idle while programs starved themselves would not make your system "optimized.""

Bingo. I just learned this myself recently. I was always getting anal about Linux RAM usage. If I had it running on a machine with 128 megs, it would always be using around 124 megs. If it were on a machine that had 256, it would be using around 248. On a machine with 512, 490, and so on. So this led me to believe that Linux was being inefficient with RAM. I was completely wrong.

This is because the Linux kernel uses RAM intelligently. I caches data files that programs use into memory, since reading from memory is a zillion times faster than reading from hard drive. This speeds up performance of the applications.

Then, when another program, say a big one like Mozilla/Firefox, is launched, instead of going into swap (as one would expect since it appears that it's at near capacity already) the kernel first goes to the unallocated space, then deallocates the cached data files and reallocates those to the new program. And if the data cache file has been changed, the kernel will "flush" it to the hard drive (saving changes, of course). If the data file has not been changed, the kernel will simply deallocate it.

This RAM data file caching gives the best of all worlds. It speeds up the performance of apps, and efficiently allocates RAM for all apps.

Just type "free" at the command line. It will report total capacity, total RAM usage, buffers, cache, +/- buffers/cache, swap capacity, and swap usage. The total RAM usage does not reflect what the kernel, the services, and the apps are actually using themselves, but what they are using plus the buffers and cache. The actual usage is the +/- buffers/cache figure.

Windows, by contrast, doesn't do this caching technique (AFAIK), and actually uses lots of memory for the apps and itself (that's not buffers/cache). Someone who really knows internals of Windows please feel free to correct me if I'm wrong.

So with this knowledge, if the "total" RAM usage is not near capacity when you type "free", then you should actually be concerned because that would mean the kernel is not using memory in the most efficient manner possible. But I've never encountered this myself.

In short, Fedora, as well as most other distros, is actually quite efficient with RAM usage. Making it faster or use less memory is a matter of turning off unneeded services and/or depricating features.



4.
yeah, intelligent... right...
By Steve (IP: 12.178.38.---) - Posted on 2005-05-12 10:09:55
When I said Fedora's performance was poor in comparison to other things I didn't mean noticable surface performance, I meant underlying i/o performance.. base install it's just slower at many "common" user activities, many things by only a few seconds, a frighteningly sizable sum by several minutes (I'm running pretty small tests first, on a scale of something like full system sources the differences could be a lot more, up to 30-90 minutes, who knows, I haven't tested anything that large yet due to current time constraints, but I'll get there).

The one big difference I've noticed is bzip2 though. For whatever reason bzip2 in Fedora was seriously about 15-25% faster than in yoper, slackware, arch, etc. Not sure if it's just some compile option redhat used or what, but aside from that one outstanding case it was pretty sluggish on everything else... after I get a base install data set on everything I'll try recompiling it myself from clean sources to see if that is in fact what the difference is.

Anyway, what I was saying about memory usage is not that "low memory usage means a system is optimized", only that low memory usage comes from cutting the frills out. You don't need 15 extra plugins compiled in/loading with Gaim, for instance. At least I don't. ispell is about the only thing with it I use, anything else only wastes RAM and increases the program load time. There seems to be a lot of that, though I don't have the charts handy just now to say exactly what the differences are.

Any attempt at a "One size fits all" approach ends up with bloat, some in HDD space, some in memory, in the case of Fedora it just seemed to be a bit of a mix of each.

Normal users probably won't really see a difference unless they start going crazy with leaving things open like I do, but I'm not really even concerned with that.

I've seen too many "Well that was pretty boring, why doesn't anyone ever go into the internals" comments on here, so that's exactly what I'm doing... examining I/O performance, standards compatibility, available software, ease of porting simple applications, a 30000 foot view of the internal design ideas, available performance tweaks, time install/setup takes to get to a workable system, general usablitily, etc... which is taking forever, as I'm not even done getting the ISOs yet for everything.

Any suggestions on tests anyone would like are welcome at this point also, as this is going to be my summer project, taking about 3-4 days with each system to give a full summary of strengths and weaknesses.




5.
exactly what I said...
By Steve (IP: 12.178.38.---) - Posted on 2005-05-12 10:39:04
"In short, Fedora, as well as most other distros, is actually quite efficient with RAM usage. Making it faster or use less memory is a matter of turning off unneeded services and/or depricating features."

Which is why I said "It's tweakable if you want to spend the time."

I mentioned "base install" specifically...

But given that it's install takes about 5x as long as a lot of other things, plus having to tweak it to get it to where I want, it's not for me...

Also, 300MB of memory usage at fresh boot is not "Intelligent use of memory" no matter what. Not when the same kernel and userland systems respond faster on another system with 1/2 the memory usage. In this case it was mere bloat (read: mostly was not cached memory). It was also a test run with FC4RC3, or whatever it was (it's late, I don't feel like looking), they may have cleaned it up a bit.

But the point I was trying to make still remains. If I boot a system and it is using the bare minimum of what I need, instead of trying to make sure it can handle every weird thing I might choose to do, then there is more memory available by default. That's more memory for a system cache, more memory for paging crap it thinks I'm going to use but won't, more memory to keep me from waiting while it decides to swap it's cache at the same time it tries to load firefox for me.

And that argument goes both ways... "The main difference between FreeBSD and Linux in this regard is that FreeBSD will proactively move entirely idle, unused pages of main memory into swap in order to make more main memory available for active use. Linux tends to only move pages to swap as a last resort. The perceived heavier use of swap is balanced by the more efficient use of main memory."

Yeah, that means in your "high cache" machine that when you load up firefox you have to wait for two things. First you have to wait for a disk swap to free up some of your "quick access cache", and second you have to wait for firefox to actually load into memory. That's twice as much disk activity that you have to wait for at that exact time...

Which makes the cache a good idea only about 50% of the time, which means more "live" memory usage (non-cache) increases the chances of causing the "cache-and-load" sequence to occur... and Fedora, "base install" has a much higher "live" memory usage than other things I've tried.

The "intelligent" memory usage of any system is only a best case idea.

I'm actually going to be doing a bit on Windows 2003 just for comparison sake... in response to your "Windows doesn't do this caching thing (AFAIK)" comment... on this current W2K3 install I have exactly 237MB taken up by the system cache... yes that's right, the cache. Every developed OS has some form of the caching scheme, though the ideas behind them vary a bit.

Windows does like paging a lot more than other things though... or so it seems from the surface. I have to wait on firefox to reload from the page file even though I have 200MB of completely free memory at the moment (minimizing tends to == swapping it seems, I'll look into that more though).
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表