Thursday Oct 13, 2005

Peter's Solaris Zone

I found Peter's Solaris Zone while googling Solaris Zones. When I was new at Sun and working on GNOME 1.4 preview for Solaris, Peter provided some really useful feedback. Now he is able to contribute directly to fixing some Solaris annoyances and building enhanced versions of Solaris utilities. If you're new to OpenSolaris (who isn't?), I'd definitely recommend browsing Peter's pages and blog.

P.S. Peter, if you're out there, thanks. I still call "Solaris Containers" Zones too, someday we need to publish a Rosetta Stone which lists all of marketing's AKA's for Sun products. It was only recently that I learned that if you need a JES patch you should search for the official abréviation du jour, "Java ES" which googles to a boatload of Spanish pages such as:"Java es un lenguaje..."

Wednesday Jul 20, 2005

Benchmarks: Apples vs Oranges, minimizing variables vs duplicating user experience

There is a planned lab network reconfiguration this weekend and I'm looking forward to getting the test machines back online Monday so I can rerun some benchmarks. We found that my Solaris 10 SRSS server launches Mozilla 1.7 from a local /usr/sfw/bin while Solaris 9 configured on the same hardware launches Mozilla 1.4 from an NFS mounted share. It's difficult to come up with a consistant benchmark for Mozilla on Solaris 9 because Mozilla wasn't part of Solaris 9. It was up to each system administrator to install Mozilla in an appropriate place. Hardware driver support is another variable which is difficult to eliminate. If two O.S.s are being compared on the same hardware and only one has a driver with support for accelerated graphics, the benchmarks will say much more about the graphics card and driver than the underlying O.S.

I found a similar issue while trying to run a gtk widget resize benchmark on Solaris 9. The binary I built didn't work in Solaris 9 because of a dependency on medialib ( MediaLib can have a significant effect on Solaris graphics performance and it doesn't exist on Solaris 9 by default.

Another issue is capability of earlier releases. A benchmark which tests the capabilities of new software might not even run on the old software. I encountered this problem with Mozilla 1.4 and the i-bench benchmarks. When I ran the resize benchmark on GNOME 2.0.x, some widgets were missing so the names were rendered rather than the pixmaps. This made this test result less useful.

While trying to build a GNOME 2.0.x compatible resize benchmark, I found a new Gtk Benchmark called GtkPerf. I've already run it on a Java Desktop System Linux laptop but I'm looking forward to doing some runs on JDS3 Solaris and having a look inside with dtrace. I hope GtkPerf builds on Solaris 9 with GNOME 2.0.x. Dtrace doesn't exist on Solaris 9, but the Forte collect tools do. Limited testing with collect on the resize benchmark already indicated that the profile of time spent in functions depends is strongly influenced by theme. It also seemed to show much more X syncing should be necessary, but this may have been an artifact of the resize benchmark. Thanks to those who worked on the GtkPerf benchmark, we will have more information soon which may help improve GNOME performance.

Monday Jul 18, 2005

Smart Sessions with GNOME and Sun Ray?

We've been investigating a bug which causes Mozilla's cache to be cleared if the user logs out of GNOME while Mozilla is running and the user does not choose to "save current setup." I hadn't noticed the problem because I rarely logout. When I pull my Java card out of the client and go to lunch or go home for the day, the utsession ends but the gnome-session doesn't. Whenever and wherever I reinsert the card, my session returns just as I left it.

Several years ago when we first started using GNOME in a Sun Ray environment, we encountered a few areas which needed improvement. Most of these improvements are also useful for the Linux Terminal Server Project (LTSP), VNC and other thin-client environments. For example, some screensavers aren't very neighborly in a shared environment. An idle user's screensaver can consume more resources than those who were actively working.1 This was solved by configuring xscreensaver to never use the inefficient screensavers.

Here are a couple of ideas for improving GNOME session and application behaviour in thin client environments. Sun Ray has the facility to run an action (utaction) when a java card is removed and reinserted. Wouldn't it be nice if utaction could tell gaim to change my nickname to bnitzAFK when I removed the card and change it back when I put the card back? Might it be useful to have card removal put GNOME applications into a low resource usage suspend state? Might this also be useful for notebook power management suspend? Any gconf property should be scriptable with a utaction. Unfortunately gaim's /nick isn't available through gconftool-2. I'm sure this isn't the only possible improvement which could be made to GNOME applications and gnome-session, but it may be worth considering for Sun Ray and other thin-client environments.

1 We could have solved this by sending someone around every few minutes to tap the keyboard on all Sun Ray clients, but we didn't.

Tuesday Jul 12, 2005

Bryan's Dtrace vs GNOME vs GNOME myths

Bryan Cantrill has some interesting dtrace data on which processes perform the most I/O and what filenames or file descriptors the I/O is associated with. It appears that at least some of our suspicions, including those mentioned in Rob Love's GNOME optimization talk can be validated or disproved with this technique.

While Gconfd-2 appears to use significant I/O and CPU resources, neither Bryan's nor my own dtrace investigations show bonobo-activation as particularly I/O heavy. I've only used GNOME for about 4 years but I lost track of how many times I've heard, "GNOME is slow because...{something something B.S. ...something} BONOBO-ACTIVATION!" I've even heard rumors that there is a plan to replace bonobo-activation in future versions of GNOME. There may be good reasons to replace bonobo-activation, but performance is unlikely to be one of them. Especially when compared to the potential gain from replacing gconf's backend or even gnome-vfs. I wonder how often a major piece of software is rewritten because of such superstitions? How much does this costs in money, time, stability and market share (since stability and market share are related?) With dtrace and similar tools, we no longer have to rely on divining rods and tarot cards to know what our software is doing.

Tuesday Jun 14, 2005

A userland welcome to Open Solaris

OpenSolaris is live! Unfortunately the CD drive on my laptop is dead. Sometimes even a minor problem can get in the way of our enjoying something really cool. It's like when your brand new car runs out of gas. I'm hoping we can smooth over any rough edges in OpenSolaris. The number of OpenSolaris blog entries is overwhelming. Hackers, kernel experts and students have some great new reading material! I'm already impressed by outside contributers to OpenSolaris, such as Blastware's planned port to PowerPC. I don't know who will be more excited, those of us who would like Solaris on our Apple Powerbooks, or those who want to run it on IBM's hardware. How can a desktop mechanic help? Well, I don't think there's an "OpenSolaris for Mechanics" yet, but here, in no particular order are a few tips which helped me. I'll post them here in case they might help newcomers to OpenSolaris. If others have tips or links to tips, please let me know.
  • 1.)If you'd like to install Solaris alongside another operating system, look here.
  • 2.)Make sure you allocate enough swap space during install. The default Solaris installer can be skimpy on swap space. Just because most X86 boxen have less than a dozen CPUs and only a couple hundred Gigs of storage doesn't mean you shouldn't allocate a few hundred Megabytes of swap space.
  • 3.)Workaround for gnome-settings daemon error. The contents of /var/tmp can persists through Solaris reboots. This can cause intermittant GNOME lock file conflicts. By default, /tmp is taken from swap space which is wiped out on reboot. To change your login so that gconf and bonobo store their temporary stuff in /tmp, edit .dtprofile, and add:
    export TMPDIR
  • 4.)The Rosetta Stone for Unix doesn't yet reference zones or the Service Management Framework, but it is still a useful reference as are the Solaris one liners.
  • export PATH=$PATH:/usr/sfw/bin. This is where you'll find gcc and similar tools.
  • 5.)Manage packages with pkgadd, pkgchk, pkgrm and pkginfo. Manage patches with with smpatch.
  • 6.)For those who prefer gui administration, Sun Management Console (smc) is included. It isn't in the default Java Desktop System menus, but if you installed everything, you'll find it in /usr/sbin/smc.
  • 7.)SMF Administration with Webmin which is another management GUI which is built into Solaris 10.
OpenSolaris Solaris

Thursday Jun 09, 2005

Johan's Interesting GNOME text rendering benchmarks

In case anyone missed it, Johan Steyn began his blog with an interesting GNOME vs CDE performance measurement. He looks at time and network traffic to a Sun Ray appliance on Solaris and Linux. A few interesting comments have already been entered on this topic. Since monochrome fonts can make some GNOME applications at least as fast CDE, would it be possible for fast scrolling (moving?) text to be rendered monochrome and only anti-aliased when stationary? Would it make sense to put this intelligence into individual applications or would it be more appropriate to put it into Cairo or somewhere else? Can extentions such as Xrender and DAMAGE and compositing libraries such as Cairo help optimize the traffic between the thin client and the server?

Wednesday Jun 01, 2005

Accusations of Open Source exploitation?

Mr. Villasante, the head of software technologies at the European Commision's information society had a few harsh accusations of corporate open source involvement. The first thing I thought of when I read this is that neither Sun, nor IBM, nor HP nor anyone else would or could force anyone outside of internal paid open source developers and contractors to write software. If companies could force free developers to do the all of dirty work, why would they spend so much money on i18n, a11y, bug fixes, productisation, support, documentation, marketing and all of the other less interesting ingredients in the open source bakery?

If it's all take and no give, why would corporations ever throw IP over the wall? I don't think the open source world be better off without AT&T's VNC, Sun's OpenOffice, IBM's documentation, Netscape's Mozilla, RedHat's kernel patches, Ximian's Evolution, RealMedia's Helix, SuSE/Novell's YaST... I also disagree with this quote from Mr. Villasante:

"What I think is that Europe doesn't have a software industry today -- the only one we have today is in America. In the future we may have China or India. We should decide if we will have a European software industry in the future,"

I worked in IT in the U.S. I find the European open source economy to be much more progressive. Europe is a powerful force in the software world precisely because it is less afraid of mixing open source software with business. But sometimes I wonder if the E.C. has any idea how open source software works. Again from Mr. Villasante:

"Open source is a complete mess -- many people do lots of different things. There's total confusion today..."

Companies can't force unpaid open source developers to do anything they don't want to. Nor can governments. And that is exactly as it should be.

Update:I'm tempted to remove this whole posting, but I'll leave it here to prove that I can be wrong too. It sounds like Mr Villasante's talk was much more positive about open source than the zdnet article implied. I'm glad to hear that someone who 'gets it' is in such a position. Now why doesn't the U.S. have an open source czar? And why do tech publications get it wrong almost as often as my supermarket overcharges me?

Update:Here's another take on Mr. Villasante's talk. From this and what Simon indicated, I'd have to agree with most of what Mr. Villasante says, though it still surprises me that the E.U. is falling behind the U.S. in open source. Isn't it puzzling that some in the U.S. consider open source "unamerican" and in Europe some consider it too American? We need to grow it on both sides of the Atlantic to prove the critics wrong.

Tuesday May 31, 2005

Memory GN-Optimization tools, (libumem vs nautilus)

In Robert Love's GNOME optimization talk at GUADEC, I thought I heard him say that Nautilus RSS grows by (10-12Mb?) on every folder open but that Valgrind hasn't found any leaks. Well, since libumem doesn't grind nautilus performance to a halt, there's no harm in me giving it a try. I didn't do anything fancy, I just followed followed Adam Leventhal's example replaced 'my_leaky_program' with Nautilus1, set a breakpoint at nautilus_window_close::bp, opened and closed a nautilus folder. Most of the stuff I get is pretty generic strdup leaks, but here are a couple of the interesting bits:

{stuff deleted...}
080eb790      26 089f0c88`strdup+0x25
080eba10      32 08979de8`strdup+0x25
080eb510      25 089e6908`strdup+0x25
The reason I pulled these three entries out of the findleaks output is that they all have an audit which looks something like this:

            ADDR          BUFADDR        TIMESTAMP           THREAD
                            CACHE          LASTLOG         CONTENTS
         8979de8          8978348      e6fb39f5108                6
                          80eba10                0                0
Maybe a nautilus or gnome-vfs expert could tell me if these apparent leaks in _gnome_vfs_xdg_hash_append_glob represent a real problem.

I also wonder if nautilus-throbber has any leaks. Dtrace shows that it certainly does a lot of I/O considering it's only there to tell us that nautilus is busy.

Hmm, I'm missing Glynn's talk because my laptop sound is hosed. Oh cool, the Fluendo java plugin works fine on Sun Ray under Solaris, even with hotdesking. It honors AUDIODEV! Well, that's all I have for now. I'd appreciate hearing whether this or other similar information might help the GNOME optimization project.


Thanks Yusuf for suggesting that I add a link to the libumem tutorial.

1 There isn't room in this blog for the number of leaks you'd find in certain other applications (you know who you are, don't you ;-)

Memory GN-Optimization tools, (mallocfree.d vs gconfd-2)

Memory optimization also came up in Robert Loves GUADEC 6 talk. I already looked at pmap, but I promised BenM and Yusuf that I would write a quick tutorial on using Solaris memory profiling tools for GNOME. Sure, I thought, when am I going to have time to do that? Well, in the 15 minutes before I caught the train home on friday, I found Adam Leventhal's libumem primer and SMG's dtrace script which indicate the frequency malloc and free are called for each code path. In this example, I ran the script against gconfd-2 after launching and closing gnome-calculator.

Here's the script:
# cat mallocfree.d
#!/usr/sbin/dtrace -s

/execname == "gconfd-2"/
        @[ustack(), probefunc] = count();
Here are the call stacks and number of calls of the top five code paths to free/malloc:
./mallocfree.d {process ID}
{stuff deleted}
 free                                                            102

  free                                                            116

  free                                                            181

  free                                                            185

  malloc                                                          460

Monday May 30, 2005

GUADEC 6 GNOptimization talk and nautilus cache fun

I was fortunate to be able to present at last year's GUADEC and learned much at that and the previous GUADEC. I wasn't able to attend this year, but I found time to listen to Robert Love's talk on GNOME optimization. It's great to hear that Rob, Michael, BenM and a few of us Sun guys are interested in improving performance (and therefore, scalability.) In these days of ever increasing CPU clock speed, it's easy to make the mistake of assuming that optimization is obsolete. But as Robert pointed out, disks are still a terrible bottleneck. We shouldn't even take CPU resources for granted. A few thousand unecessary system calls or stats eventually add up to something. And if Moore's observation ever bumps into a physical limit, optimization will become the only way of increasing performane. I'm glad to hear the progress is being made. A few of the suggestions involved features specific to the Linux kernel but the classic problems and solutions, mmaping files, slab allocators, more efficient memory usage, minimizing seek time (thanks MarkM for the gconf patch!)... apply to every platform GNOME runs on, including Solaris.

Towards the end of the talk, Robert talked about the lack of tools. I was like an armchair sports fan, I wanted to shout into the microphone of my JDS laptop, "Hey, this looks like a job for dtrace, or libumem or Solaris pmap!..." Here is an example just for fun. I used Richard McDougall's cache hit ratio dtrace script while opening a directory in nautilus on a machine with a non-infinite amount of physical memory:

/etc/gnome-vfs-2.0/modules/ssl-modules.conf                     logical  6
/etc/gnome-vfs-2.0/modules/smb-module.conf                      logical  6
/etc/gnome-vfs-2.0/modules/mapping-modules.conf                 logical  6
/etc/default/nss                                                logical  6
/etc/gtk-2.0/gdk-pixbuf.loaders                                 logical  8
logical       8
/lib/                                                    logical  8
/usr/share/pixmaps/nautilus/text-selection-frame.png            logical  8
/usr/openwin/lib/locale/locale.dir                              logical  8
/dev/../devices/pseudo/clone@0:ptm                              logical  9
/dev/../devices/pseudo/random@0:urandom                         logical  9
//usr/share/icons/blueprint/36x36/apps/gnome-spinner.png        logical  9
/usr/share/mime-info/staroffice.keys                            logical  9
/usr/openwin/lib/X11/fonts/TrueType/fonts.cache-1               logical 11
/usr/share/themes/blueprint/gtk-2.0/gtkrc                       logical 16
/home/bnitz/.ICEauthority                                       logical 18
/etc/netconfig                                                  logical 18
/usr/openwin/lib/locale/locale.alias                            logical 22
/usr/share/mime-info/gnome-vfs.keys                            physical 64
logical        187

Read Bandwidth
logical      49152
logical      49152
logical      49152
logical      49152
logical      49152
logical      49152
logical      49152
logical      64000
logical      65536
logical   65536
logical      65536
logical      73728
logical      73728
logical      81920
logical      81920
logical      90112
logical     147456
logical     180224
physical     598016
logical    1531904

/dev/../devices/pseudo/clone@0:ptm                              logical  6

Read Bandwidth
logical       7663

In this example, most files have logical counts with no corresponding physical counts, it looks like we hit the cache. But it looks like gnome-vfs.keys only has about a 74% cache read and 71% cache bandwith hit rate. It is also possible to add a few ustack(n) commands to the script in order to see where we are in the code when this physical I/O is taking place.

Monday May 09, 2005

IE is better? Say what!?

I love the Bill Gate's quote on FireFox in this article on the threats to Microsoft's monopoly standing.
"I played around with it a bit, but it's just another browser,
 and IE [Microsoft's Internet Explorer] is better..."
Better? At what? Collecting adware, downloading viruses, displaying content from non World Wide Web Consortium (W3C) compliant web sites? I wish the interviewer hadn't soft-balled this question and followed it up with a "really Bill, what are IE's advantages?" Is there some unknown advantage in IE's crash and virus-prone sluggishness and lack of support for tabbed browsing? I'd really like to know. Is there anyone besides Bill Gates who installed firefox and still prefers IE for anything but the most broken and non-standards compliant websites?

Despite the missing question, the article is interesting. When I see Microsoft today, I can't help but think of monopolies of the past and wonder if Microsoft will be as capable of transitioning from monopoly to competitive corporation. The only advantage to many of Microsoft's products is that they are compatible with Microsoft's products. Once organizations start to look at TCO, and tip-toe out of the corner they've painted themselves into, this advantage quickly evaporates. Because in the non-Microsoft world, OSS, Java, Sun, OASIS... compatibility goes far beyond an individual company's products.

Update:Shortly after I wrote this, a FireFox exploit made the news, however, as usual, few of the news reports regarding the issue mention which OS is vulnerable. The bugzilla bug only lists Windows XP, but it's a good idea to keep an eye on this one, just in case. You might have the same issue on Linux or OSX, especially if you're running as root1. Just because firefox has far fewer exploits than IE doesn't mean it is perfect. P.S. I apologize for any offense in this post, but IE on my wife's computer locked up while I was posting this from firefox. I have been using FireFox 1.0 for several months and have never seen it crash.

1Don't do that. (run your browser as root.)

Sunday May 08, 2005

Focusing in on nautilus glib calls with dtrace

The script in this previous post just counts the number of glib library calls. While this could be a useful bit of information, I'd really like to know how much time is being spent in each glib library call. For that I will take Gleb's script and change it to only look at calls and returns from libglib:
#!/usr/sbin/dtrace -s
#pragma D option quiet
   self->elapsed = timestamp - self->ts;

   printf("\\n%20s %20s %8s %7s %20s\\n","Execname", "Syscall", "Process", "Thread", "Time elapsed");
   printa("%20s %20s %8d %7d %20@u\\n", @time);

It is interesting to run it on an idle system and see how much nautilus and the mixer applet do, but I've done that in a previous entry. So now I'll run the script and open a Nautilus document folder. This time I'll list the top 21 because you'll see that the function I was previously interested in is number 21 on this list:
Execname              Syscall           Process  Thread         Time elapsed(nanoseconds)
 nautilus g_string_maybe_expand          24620       1              3664329
 nautilus g_slist_prepend                24620       1              3785852
 nautilus g_static_rw_lock_reader_unlock 24620       1              4203187
 nautilus g_datalist_id_set_data_full    24620       1              4208898
 nautilus g_ascii_tolower                24620       1              4235995
 nautilus g_mem_chunk_area_search        24620       1              4317412
 nautilus g_static_rw_lock_reader_lock   24620       1              4381652
 nautilus g_data_set_internal            24620       1              4384423
 nautilus g_utf8_get_char                24620       1              5486703
 nautilus g_quark_from_string            24620       1              6065780
 nautilus g_strdup                       24620       1              6991822
 nautilus g_datalist_id_get_data         24620       1              7843746
 nautilus g_direct_hash                  24620       1              9642739
 nautilus g_pattern_match                24620       1             10652166
 nautilus g_str_hash                     24620       1             12129172
 nautilus standard_malloc                24620       1             16639586
 nautilus standard_free                  24620       1             16929274
 nautilus g_malloc                       24620       1             18480955
 nautilus g_str_equal                    24620       1             23843484
 nautilus g_free                         24620       1             24054223
 nautilus g_hash_table_lookup            24620       1             32576285
Well, now I want to focus on the nautilus process and see what is being passed to g_str_equal. I'll pass the pid of nautilus as a parameter to this script:
#!/usr/sbin/dtrace -s

   printf("%s, %s\\n", copyinstr(arg0),copyinstr(arg1));

I get some errors here, presumably because I haven't thinned the data enough or memory is on the other CPU or swapped out, or I made some other mistake:
out of scratch space in action #2 at DIF offset 28
dtrace: error on enabled probe ID 1 (ID 37446: 
But I also get some data. This first part is interesting, seemingly whenever I hover over an icon on nautilus, someone looks up the width, height, color depth, alpha...:
CPU     ID                    FUNCTION:NAME
  0  37446                g_str_equal:entry pixels, pixels
  0  37446                g_str_equal:entry rowstride, rowstride
  0  37446                g_str_equal:entry height, height
  0  37446                g_str_equal:entry width, width
  0  37446                g_str_equal:entry GnomeVFSVolumeMonitor, has-alpha
  0  37446                g_str_equal:entry GnomeDateEditFlags, has-alpha
  0  37446                g_str_equal:entry has-alpha, has-alpha
  0  37446                g_str_equal:entry GConfClient, bits-per-sample
  0  37446                g_str_equal:entry bits-per-sample, bits-per-sample
  0  37446                g_str_equal:entry n-channels, n-channels
  0  37446                g_str_equal:entry colorspace, colorspace
  0  37446                g_str_equal:entry pixels, pixels
  0  37446                g_str_equal:entry rowstride, rowstride
  0  37446                g_str_equal:entry height, height
  0  37446                g_str_equal:entry width, width
  0  37446                g_str_equal:entry GnomeVFSVolumeMonitor, has-alpha
  0  37446                g_str_equal:entry GnomeDateEditFlags, has-alpha
  0  37446                g_str_equal:entry has-alpha, has-alpha
  0  37446                g_str_equal:entry GConfClient, bits-per-sample
  0  37446                g_str_equal:entry bits-per-sample, bits-per-sample
  0  37446                g_str_equal:entry n-channels, n-channels
  0  37446                g_str_equal:entry colorspace, colorspace
And then:
 0  37446                g_str_equal:entry image/bmp, x-directory/normal
 0  37446                g_str_equal:entry /home/bn/Documents, /home/bn/Documents
 0  37446                g_str_equal:entry image/x-icb, x-directory/normal
 0  37446                g_str_equal:entry image/x-icb, x-directory/normal
 0  37446                g_str_equal:entry x-directory/normal, x-directory/normal
 0  37446                g_str_equal:entry description, icon_filename
 0  37446                g_str_equal:entry gtk-goto-bottom, gnome-mime-x-directory-normal
 0  37446                g_str_equal:entry gtk-print, gnome-mime-x-directory-normal
 0  37446                g_str_equal:entry gtk-go-forward-ltr, gnome-mime-x-directory-normal
 0  37446                g_str_equal:entry gtk-indent, gnome-mime-x-directory-normal
 0  37446                g_str_equal:entry gtk-print-preview, gnome-mime-x-directory
With open source we are lucky, we can pepper the code with printfs and rebuild the application and get the same information I gathered above. But this takes time. With dtrace I can get valuable debug information from all applications and I can change what I'm looking at as quickly as I can type 'wq!'

Thursday May 05, 2005

Profiling GNOME glib with Dtrace

I noticed that dtrace -l | grep glib shows probes available for glib. So here is a variation on a script on my friend Gleb's blog. His script looks at time in system calls. This one just looks at entries into glib functions:
#!/usr/sbin/dtrace -s

There are a couple of interesting things here. First of all, I'm not just measuring the number of function calls from one process (though I could), I'm also including anything gnome-vfs-daemon, bonobo-activation, nautilus and even nautilus-throbber are doing. It also includes other users on my system. So, I'll run it, switch workspaces and open up a nautilus documents folder.

{Stuff deleted, here's the top 20...}
 g_static_rw_lock_reader_lock                                   7697
  g_static_rw_lock_reader_unlock                                 7697
  g_datalist_id_set_data_full                                    7733
  g_data_set_internal                                            8183
  g_utf8_get_char                                               10441
  g_quark_from_string                                           10999
  g_strdup                                                      12326
  g_datalist_id_get_data                                        14068
  g_pattern_match                                               21518
  g_str_hash                                                    22092
  g_direct_hash                                                 23809
  g_string_append_len                                           24494
  g_string_insert_len                                           26298
  g_string_maybe_expand                                         28720
  standard_free                                                 30569
  standard_malloc                                               30751
  g_malloc                                                      33444
  g_free                                                        43051
  g_str_equal                                                   43970
  g_hash_table_lookup                                           64280

I wonder why there are so many calls to g_string_maybe_expand? I haven't found docs for the function, but the code seems to take a GString as arg0 and realloc memory if necessary. So why are we doing this so much?
#!/usr/sbin/dtrace -s
  printf("Maybe expanding:'%s'\\n\\n", copyinstr(arg0));
This document explains how copyinstr and ustack are used. Now look at this, we're just creating a bunch of new strings for converting the uri:
CPU     ID                    FUNCTION:NAME
  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

  0  36667      g_string_maybe_expand:entry

Once I learn a bit more about dtrace I'd like to improve the script to ignore library calls which take less than say, 10000 nanoseconds. It's great that GString automatically grows when necessary, I sure hope GString isn't leaky! Maybe a glib, nautilus or GNOME expert could tell me whether this is meaningfull at all, or if not, where should I be looking? I just noticed that probes are available for libgtk also. Stay tuned!

Note:The first script above does not measure time as Gleb's script does.

Monday Mar 21, 2005

Keyboards and globalization

I may have been the one who stumbled across Tim Foster's blog by googling spanish keyboards
Some of the comments on Tim's blog mentioned the gnome keyboard applet and Vicky Lee published more information about keyboard configuration. It turns out that there are many different variables which determine what appears on the screen when I type the "A" key.

It was so simple back in the Vic 20 days. The kernel received a keyboard interrupt, checked the port for the scancode, looked up the corresponding character in a table and found it's visual representation in the character font ROM Where at offset 8 it would find the numbers 24, 36, 66, 126, 66, 66, 66, 00. Which in binary is represented as:

If you squint that almost looks like an "A" doesn't it? What made this so simple was that each VIC-20 only had one keyboard, one font and one language. There was a direct correspondance between a keycode and its screen representation. This is not true in the modern world. JDS and other linux's have been installed on computers from Poland to China.

Here are some of the variables we have to consider in translating a keycode to an on screen character on a typical linux distribution with a GNOME desktop:
  • 1) physical keyboard (and for some keyboards you have dip switches)
  • 2) kbd_mode setting
  • 3) /etc/X11/Xmodmap and /etc/X11/Xmodmap.remote
  • 4) /etc/X11/XF86Config
  • 5) xkb and associated configuration.
  • 6) gdm loaded xmodmaps (from /etc/X11/gdm)
  • 7) local user's Xmodmap (~/.Xmodmap ignored/overidden by #8)
  • 8) gnome keyboard applet switcher loaded xmodmaps (from gkb_default.xmm or by invoking gkb_xmmap with a parameter) type xmodmap -pk to see what your xmodmap looks like.
  • 9) IIIM input method selected
  • 10) Font (I'm not goint to discuss this right now)

I know this looks confusing, but for the most part we can ignore kbd_mode and the (mostly deprecated) xmodmap stuff. But the fact that keycode translation is done by the toolkit means two different applications can have different keyboard behavior. And the fact that no one has come to an agreement on what this behavior should be means there is nothing we can depend on. The kernel, Xserver and toolkit each do their own keycode translation. So the toolkit might translate a keycode that has already been translated by the Xserver. And it seems that libraries such as libxklavier assume that the server's X11 configuration files can be used to determine the behaviour of the remote client. What if the remote client is a VNC, Sun Ray, XDMCP or Linux (LTSP) terminal with a keyboard layout or language not identical to that on the server? Good luck!

Jamie Zawinski's xkeycaps man page explains this in more depth than I can at the moment, but it sure looks like a mess to me.

Sunday Mar 06, 2005

GNOME memory bounty!

Someone is offering a bounty for GNOME memory optimization.

A few of the stats I gathered here might be useful to anyone looking for this bounty. In the meantime I'm going to have a closer look at Solaris 10 dtrace and scripts such as anonprofile.d.

Tuesday Feb 22, 2005

GNOME memory

A question on the Java Desktop System Developer forum got me to thinking about memory usage of the GNOME desktop and various basic applications. Whenever I give a talk on JDS or GNOME, one of the most common complaints/questions is why does X use so much memory? (Where X is nautilus, metacity, mozilla, clock-applet...)
While answering the forum posting, I learned something. Here is the output of prstat -s size (sorted by resident memory size) on an ordinary Java Desktop System GNOME desktop:
-bash-3.00$ prstat -s size
   434 root       58M   23M sleep   59    0   0:00:08 0.1% Xorg/1
   637 root       50M   25M sleep   59    0   0:00:01 0.0% nautilus/4
   658 root       45M   17M sleep   59    0   0:00:07 0.1% gnome-terminal/2
   578 root       41M   16M sleep   59    0   0:00:00 0.0% gnome-session/1
   635 root       39M   14M sleep   59    0   0:00:01 0.0% gnome-panel/1
   593 root       36M 9512K sleep   59    0   0:00:00 0.0% gnome-settings-/1
   650 root       36M   12M sleep   59    0   0:00:00 0.0% wnck-applet/1
   652 root       36M   10M sleep   59    0   0:00:02 0.1% gnome-netstatus/1
   648 root       35M   11M sleep   59    0   0:00:00 0.0% clock-applet/1
   654 root       35M 9784K sleep   59    0   0:00:01 0.0% mixer_applet2/1
   656 root       34M 9120K sleep   59    0   0:00:00 0.0% notification-ar/1
   639 root       34M 8240K sleep   59    0   0:00:00 0.0% gnome-volcheck/1
   640 root       34M 2164K sleep   59    0   0:00:00 0.0% gnome-volcheck/1
   631 root       32M 9892K sleep   59    0   0:00:00 0.0% metacity/1
   583 root       12M   10M sleep   59    0   0:00:01 0.0% gconfd-2/1
     7 root     9944K 7628K sleep   59    0   0:00:02 0.0% svc.startd/12
     9 root     8760K 7780K sleep   59    0   0:00:06 0.0% svc.configd/19
   629 root     7868K 3616K sleep   59    0   0:00:00 0.0% gnome-smproxy/1
   478 root     7692K 2984K sleep   59    0   0:00:00 0.0% dtlogin/1
  1156 root     7468K 3708K sleep   59    0   0:00:00 0.0% sshd/1
  1159 bnitz    7428K 2248K sleep   59    0   0:00:00 0.0% sshd/1
Total: 72 processes, 184 lwps, load averages: 0.01, 0.01, 0.02
35 Meg for a clock applet! Sigh. But wait a minute what is "SIZE" measuring?
man prstat shows:
The total virtual memory size of the process, including all mapped files and devices, in kilobytes (K), mega- bytes (M), or gigabytes (G).
Here is an explanation from GNOME's Miguel de Icaza on how to interpret memory statistics In this case size isn't very useful. It just tells us how much address space the process maps, not how much memory the process consumes!

What about resident set size (RSS)? Well it's a somewhat more meaningful statistic, but it also includes memory used by shared libraries. But the whole idea of shared libraries is that they are shared, that is, several processes can use a library without having multiple copies of the library in memory. For a typical GNOME application/applet, everything from libc to libX11, libgtk... is counted multiple times! And as Miguel's article explains, RSS doesn't count memory which is swapped out. So on the one hand we are massively overestimating the memory usage for applications which use many shared libraries (e.g. GNOME applications) and on the other hand we are underestimating the memory usage for applications which may be swapped out.
The manpage for prstat (Solaris) mentions another memory utility called pmap, which can give more detailed memory statistics for a process. For our clock-applet process:
# pmap -x 648
648:    /usr/lib/clock-applet --oaf-activate-iid=OAFIID:GNOME_ClockApplet_Fact
 Address  Kbytes     RSS    Anon  Locked Mode   Mapped File
0803E000      40      40      40       - rwx--    [ stack ]
08048000     132     132       -       - r-x--  clock-applet
08078000      16      16      12       - rwx--  clock-applet
0807C000       4       -       -       - rwx--  clock-applet
0807D000    1260    1248    1248       - rwx--    [ heap ]
D0400000   11476     504       -       - r-x--
D0F44000     304     128     104       - rwx--
D0F90000       4       -       -       - rwx--
D112E000     384     128       -       - rwxs-    [ shmid=null ]
D1190000       4       4       4       - rwx--    [ anon ]
D11A0000       4       4       -       - r-x--
D11B0000       8       8       8       - rwx--
D11C0000       4       4       -       - r-x--
D11D0000       8       8       4       - rwx--
D11E0000       4       4       4       - rwx--    [ anon ]
D11F0000     192     148       -       - r-x--
D122F000       8       8       8       - rwx--
D1240000      12      12       -       - r-x--
D1252000       4       4       4       - rwx--
D1260000      12      12       -       - r-x--
D1273000       4       4       4       - rw---
D1280000      24      20       -       - r-x--
D1296000       4       4       4       - rw---
D12A0000       4       4       -       - r-x--
D12B1000       4       4       4       - rw---
D12C0000      88      88       -       - r-x--
D12E6000       4       4       4       - rw---
D12F0000      44      44       -       - r-x--
D130A000       4       4       4       - rwx--
D1310000       4       4       -       - r-x--
D1320000       4       4       4       - rwx--
D132D000      68      60       -       - r----  dev:102,0 ino:5950
D1340000       4       4       -       - r-x--
D1350000       4       4       4       - rwx--
D1361000       4       4       -       - rwxs-    [ anon ]
D1370000      12      12      12       - rwx--    [ anon ]
D1380000       4       4       4       - rwx--    [ anon ]
D1390000       4       4       -       - r-x--
D13A1000       4       4       4       - rw---
D13B0000      28      12       -       - r-x--
D13C7000       4       4       4       - rw---
D13C8000       4       -       -       - rw---
D13D0000       4       4       4       - rwx--    [ anon ]
D13E0000     228     156       -       - r-x--
D1428000       8       8       8       - rwx--
D1430000       4       4       4       - rwx--    [ anon ]
D1440000       4       4       4       - rwx--    [ anon ]
D1450000      72      52       -       - r-x--
D1472000       4       4       4       - rw---
D1480000      28      24       -       - r-x--
D1497000       4       4       4       - rw---
D14A0000      12      12       -       - r-x--
D14B3000       4       4       4       - rw---
D14C0000       4       4       4       - rwx--    [ anon ]
D14D0000       4       4       4       - rwx--    [ anon ]
D14E0000      24      20       -       - r-x--
D14F6000       4       4       4       - rw---
D1500000      24      20      20       - rwx--    [ anon ]
D1510000     916     428       -       - r-x--
D1605000      84      72      72       - rw---
D161A000       8       4       4       - rw---
D1620000       4       4       4       - rwx--    [ anon ]
D1630000     200      64       -       - r-x--
D1672000      12      12      12       - rw---
D1680000      40      40       -       - r-x--
D1699000       8       8       8       - rwx--
D16A0000       4       4       4       - rwx--    [ anon ]
D16B0000     108      20       -       - r-x--
D16DA000      12      12      12       - rwx--
D16E0000      28       8       -       - r-x--
D16F6000       8       8       8       - rwx--
D1700000       4       4       4       - rwx--    [ anon ]
D1710000     420     248       -       - r-x--
D1788000      36      36      36       - rwx--
D17A0000     200     180       -       - r-x--
D17E1000      20      20      20       - rwx--
D17E6000       4       4       4       - rwx--
D17F0000      24      24       -       - r-x--
D1806000       4       4       4       - rw---
D1810000      60      56       -       - r-x--
D182F000       4       4       4       - rw---
D1840000       4       4       4       - rwx--    [ anon ]
D1850000     488     392       -       - r-x--
D18DA000      16      16      16       - rw---
D18E0000       4       4       4       - rwx--    [ anon ]
D18F0000     104      72       -       - r-x--
D1919000       4       4       4       - rwx--
D1920000      24       8       -       - r-x--
D1935000       4       4       4       - rwx--
D1940000       4       4       4       - rwx--    [ anon ]
D1950000      28      12       -       - r-x--
D1966000       4       4       4       - rwx--
D1970000       4       4       4       - rwx--    [ anon ]
D1980000     728     640       -       - r-x--
D1A46000      24      24      24       - rw---
D1A4C000       8       8       8       - rw---
D1A50000      16      16       -       - r-x--
D1A60000       4       4       4       - rwx--    [ anon ]
D1A70000     512     400       -       - r-x--
D1AFF000       4       4       4       - rwx--
D1B10000       8       8       -       - r-x--
D1B21000       4       4       4       - rwx--
D1B30000     220     220       -       - r-x--
D1B76000       4       4       4       - rwx--
D1B80000     172     156       -       - r-x--
D1BBA000      20      20      20       - rwx--
D1BD0000       4       4       4       - rwx--    [ anon ]
D1BE0000      36      12       -       - r-x--
D1BF8000       8       8       8       - rwx--
D1C00000    8720     236       -       - r-x--
D2493000      68      32      24       - rwx--
D24B0000      12      12       -       - r-x--
D24C2000       8       8       8       - rwx--
D24D0000     268      60       -       - r-x--
D2522000      16       8       8       - rwx--
D2530000       4       4       4       - rwx--    [ anon ]
D2540000      80      72       -       - r-x--
D2563000       8       8       8       - rwx--
D2570000      80      72       -       - r-x--
D2593000       8       8       8       - rwx--
D25A0000     372     356       -       - r-x--
D260C000      20      20      16       - rwx--
D2620000     512     396       -       - r-x--
D26A0000      20      20      20       - rw---
D26A5000      32      24      24       - rw---
D26B0000       4       4       4       - rwx--    [ anon ]
D26C0000      44      36       -       - r-x--
D26DB000       4       4       4       - rw---
D26E0000      40      32       -       - r-x--
D26F9000       8       8       8       - rwx--
D2700000      12      12       -       - r-x--
D2710000     864     372       -       - r-x--
D27F7000      40      40      40       - rwx--
D2801000      32       4       4       - rwx--
D2810000       4       4       4       - rwx--    [ anon ]
D2820000    2416    1444       -       - r-x--
D2A8B000      40      40      40       - rwx--
D2A95000       4       4       4       - rwx--
D2AA0000      76      24       -       - r-x--
D2AC2000       8       8       8       - rwx--
D2AD0000      12       8       -       - r-x--
D2AE2000       4       4       4       - rwx--
D2AF0000     216     168       -       - r-x--
D2B36000       8       8       8       - rw---
D2B40000       4       4       4       - rwx--    [ anon ]
D2B50000     252     240       -       - r-x--
D2B9E000      32      32      32       - rwx--
D2BB0000      68      68       -       - r-x--
D2BD0000       8       8       8       - rwx--
D2BE0000     304     284       -       - r-x--
D2C3B000      20      20      20       - rwx--
D2C40000       4       4       4       - rwx--
D2C50000       4       4       4       - rwx--    [ anon ]
D2C60000     184     184       -       - r-x--
D2C9D000      12      12      12       - rwx--
D2CB0000     292     280       -       - r-x--
D2D08000      40      40      40       - rwx--
D2D20000     132      36       -       - r-x--
D2D50000       4       4       4       - rwx--
D2D60000      80      12       -       - r-x--
D2D83000       4       4       4       - rwx--
D2D90000       4       4       4       - rwx--    [ anon ]
D2DA0000      24      20       -       - r-x--
D2DB5000       4       4       4       - rwx--
D2DC0000      72      72       -       - r-x--
D2DE1000       4       4       4       - rwx--
D2DF0000     156      28       -       - r-x--
D2E26000       8       8       8       - rwx--
D2E30000     328     300       -       - r-x--
D2E91000      12      12      12       - rwx--
D2EA0000       4       4       4       - rwx--    [ anon ]
D2EB0000      64      64       -       - r-x--
D2EC0000       4       4       4       - rw---
D2EC1000       8       -       -       - rw---
D2ED0000      28      28       -       - r-x--
D2EE7000       4       4       4       - rw---
D2EF0000     524     328       -       - r-x--
D2F82000      16      16      16       - rwx--
D2F90000       4       4       4       - rwx--    [ anon ]
D2FA0000      56      52       -       - r-x--
D2FBD000       8       8       8       - rwx--
D2FD0000       4       4       -       - r-x--
D2FDB000     128     128       -       - r-x--
D2FFB000       4       4       4       - rwx--
D2FFC000       8       8       8       - rwx--
-------- ------- ------- ------- -------
total Kb   36292   12264    2336       -

What does this mean?

Again from the pmap man page. Resident memory is 12264 Kilobytes but much of this physical memory can be shared with other instances of the clock applet. But the anon column, the memory used by each instance of a clock applet, that's kind of high too. Should a clock applet really take over 2 megabytes?
Thanks Yusuf for pointing me to Ben Maurer's blog and a Wiki on GNOME memory usage. I think we're all pulling in the same direction here and as I learn more about which tools can be applied to this problem, I'll try to contribute what I learn.
There is certainly room for improvement on GNOME memory usage, but before we get started we need to make sure we are using meaningful measurements.

Thursday Sep 23, 2004

Anybody can reboot

My uncle is a shade-tree auto mechanic. Whenever my dad had a problem with his 1969 AMC Rambler, Uncle Dell would recommend, "Jack up the radiator cap and drive another car under it." From what I've seen, that's often how problems in the Microsoft desktop world are solved. Reboot or reinstall the O.S. Fear not, whatever demons were possessing your desktop will be exorcised...for a while anyway. But you don't learn much that way.

Last week I was running SunRay Server 3 beta on a Java Desktop System 2.0. A couple of users had problems logging into their NIS home directories which mounted /home on a local NFS server. I logged into my NIS home directory and experienced the same problem. Nautilus and gconfd-2 weren't happy. df -k showed mounts for dozens of users under home, even though only three of them were being used, and it showed multiple mounts for some users. Earlier I had found that restarting autofs fixed a similar problem so:

/etc/init.d/autofs restart

Well, the extra automounts are gone, but my session is still messed up. I cleared out my .gnome\*, .nautilus, .gconf, .gconfd preference files and found the problem only became worse. It would have been easy to just reboot. The system had been working fine for a couple of weeks before that.

Aha, it turns out I accidently wiped out the global configuration database in /etc/gconf while experimenting with an optimization script. I decided to kill the APOC configuration daemon before I reinstalled the gconf RPMS, but I did it in the most clumsy way and killed all JVM instances running on the machine, including those responsible for core SunRay services! The SunRay clients displayed a box indicating that they can't find the server. I should just reboot, but let me look at the SunRay manual. Hmmm, /opt/SUNWut/sbin/utrestart. Like magic my session reappeared along with the sessions anyone else who had been sharing that box.

Earlier versions of nautilus/gnome-vfs had a nasty habit of searching for trash and for a writable directory on any share where it could put trash. This was not nice on a SunRay server with hundreds of deep automounted NFS trees. But I thought I remembered that this problem was solved by Sun engineers and other GNOME community members. So my next suspect was autofs. I found a Sun engineer's whitepaper on some autofs deficiencies.. Further investigation showed these deficiencies to be unrelated to my immediate problem. Then I remembered that NFS home directories were being shared between Solaris 8/9 GNOME 2.0 and the newer GNOME in Java Desktop System 2.0. The file
contained entries for nearly every user under /home. Apparently even the newer gnome-vfs reads this cache and stats everything it sees there. Autofs notices that someone is looking and mounts the shares. Sure enough, if I launch nautilus without gconfd-2 and with the trash cache in place, mtab immediately fills with extra junk. So now how do we solve the problem of forward and backward compatability of GNOME configuration files? I think this will take agreement from the entire GNOME community. As configuration moves from flat files into LDAP backends the problem may become irrelevant. In the meantime, I'm glad I didn't reboot.

10:32am  up 30 days, 13:58,  3 users,  load average: 0.13, 0.09, 0.02 
Yeah, this is a beta.
I once explained my reboot philosophy to my brother as:
  • Microsoft Windows: Reboot for minor configuration changes, even to change IP address or upgrade a library!
  • GNU/Linux: You should only reboot when installing new hardware.
  • Solaris: Why would you reboot just to install new hardware?
Apologies if Linux and Microsoft Windows have improved recently, but can you swap out a CPU without rebooting?

Wednesday Sep 08, 2004

This is a Windows town

racinesunset You can't go home again, well not completely anyway. Ten years ago Canada geese were a rare sight in Wisconsin, now they are a plentiful pest. Racine's harbor has less water now, and more zebra mussles. The tractor plant foundry burned down, subdivisions are replacing cornfields, downtown is finally recovering from a rust-belt industrial hangover, and my favorite electronic parts store is now a Spanish Apostolic Pentecostal church. But some things never change...

"May I help you?", The manager of the home office store used a cliche uncommon in Irish retail. I was actually waiting for my wife, but to make conversation I asked for something I really was looking for:

"Do you have a SCSI to USB or SCSI to Firewire converter?"\*

I had asked the question at three other retailers whose salesman looked at me as if I had asked for a flux capacitor or a chunk of kryptonite\*\*. But this manager had an answer.

"SCSI? No, is that for a Mac or what?"

"It's for a slide scanner, you know like the Kodak slides?"

"You're not going to find anything like that here. This is a Windows town." He suggested that I try the internet, or Milwaukee.

"Windows town?" I told him that governments and businesses elsewhere are switching to alternatives such as Linux.

"Lie nucks? Wait a minute, do you mean unix or the free operating system?"

"Linux." I told him that Allied Irish Bank, the British health system and the city of Munich adopted linux based IT solutions. (I forgot to mention the Peoples Republic of China.)

"Huh, that reminds me of how the Amiga computer caught on so much in Germany, but never came here. Some of these Linux guys remind me of those Amiga guys."

"It's too bad people in Racine don't have more choices." Lack of competition here in Ireland leads to high prices in everything from real-estate to beer.

"Yeah, If there were anything other than XP I would use it because XP watches everything you do."

I asked him to elaborate, "Really, like what?"

"The other day when Windows crashed it asked me if I wanted to send the information to Microsoft. Heck no! I don't want to tell them that I was being stupid. I was trying to run 5 applications at a time." I reminded him that the Amiga could run more than 5 applications simultaneously on a 7 MHz processor with 1/2 Mb of RAM and assured him that what he was doing was totally reasonable. Modern operating systems shouldn't have any problem coping with a few dozen applications, this JDS box is currently running a few hundred processes for 6 user sessions and it has been up for 17 days.

"Yeah, I guess those computers were pretty good. I have to get back to work now."

I wish I had brought my Morphix-based Java Desktop System demo. It would have been nice to leave him a sample of the future. The old saying "Will it play in Peoria" referred to testing theater productions in a U.S. heartland town a few dozen miles southwest of Racine. Linux counter shows only 25 known linux users in Peoria and 10 in Racine so it may take a while for towns such as these to abandon the monopoly, but it will happen. The forerunner to the automobile was invented in Racine in the early 1870s and later dismantled because it frightened a horse to death. But the horseless carriage eventually came to Racine in a variety of models and brands. Alternatives to Microsoft Windows will eventually play in Peoria, and Racine.

\* SCSI: An interface standard which supports up to 80 Megabytes/Sec, requires only one interrupt for up to 15 devices and often requires less CPU resources than typical IDE configurations. SCSI was used on Apple computers and Sun workstations, it is still used on servers and in performance critical applications (e.g. uncompressed video.) Firewire/IEEE1394 initially supported up to 50 Megabytes/sec, USB 1 supports up to 2 Megabytes/sec. Firewire and USB speeds are usually expressed in Megabits/second rather than Megabytes/second because 400 Megabits/second sounds much more impressive than 50 megabytes/second ;-)

\*\*You can however buy USB and Firewire cables that glow in the dark.

Monday Aug 09, 2004

What happened to WORLD Wide Web?

It was about half past forever o'clock last night. My wife was beginning to design a patchwork quilt. Her quilt software was built for Microsoft Windows 3.1 but was compatible with newer versions. So I brought our windows 98 machine out of storage, dusted it off and hooked it up. I reluctantly asked if she needed it on the web. I was dreading the number of reboots that would be required to install every security patch since the machine was last powered up. No, she said she would look up what she needed to on the Powerbook. So I left the appropriate air gap between the Windows 98 machine and the broadband modem and continued reading "The Far Side of the World." Only minutes later she encountered a problem. "It says 'This website must be viewed with Netscape 4.7'" What?! I've encountered dozens of websites which only work properly with Internet Explorer, some which refuse to work without a specific version of Macromedia Flash (not the newer version that is on the Mac) and a few which refuse to work on anything but Windows 98 running a specific version Internet Explorer. I've even encountered airline websites with browser specific bugs in its leap year calcuating code. But this is the first time I've encountered a website which required a version of Netscape from the previous millenium.

Can we agree on this one thing?

I hope users of Apple OSX, OS9, RedHat, SuSE, Debian, FreeBSD, Solaris and the various versions of Microsoft windows can agree that the world wide web should be as open and accessible as possible. As far as I'm concerned, websites which are hard-coded to a particular distribution and/or browser are broken. Whenever possible I try to gently notify webmasters of these problems. I hope others do the same. In most cases they are happy for the feedback. Most well run businesses strive to be accessible to as many customers as possible. Now that people are beginning to switch from Internet Explorer to more secure and powerful browsers such as Mozilla, Firebird and Safari, we need to encourage web designers to use tools such as Bobby to indicate whether a website meets accessibility and W3C standards. We don't design our roads for a particular brand of car, nor do we design our telephone, television, or radio communications to be brand specific. Wherever possible, the world wide web should also be a standards based platform neutral communications medium.

Thursday Aug 05, 2004

Will it scale? (Back of the envelope calculation)

Hmm, there are only 8 users on this machine, but quite a few open files:
# lsof | wc -l
A fair number of processes:
# ps -ef | wc -l
and how many threads?
# ps -m m
ps: error: Thread display not implemented.
Uh oh. How do I find out how many threads are in use? Well it looks like ps -ef actually shows threads so 472 is the approximate number of threads (and the process count isn't accurate!)

So, as I scale up users with this usage pattern, would I bump into the thread limit first or the process table limit, or the number of open files? Or something else? The linux 2.4 kernel FAQ gives:
         \* The default maximum number of threads is set to a safe
         \* value: the thread structures can take up at most half
         \* of memory.
        max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 2;
# sysctl kernel.threads-max
kernel.threads-max = 14336

or alternatively:

# cat /proc/sys/kernel/threads-max

And how many open files can the linux reiser filesystem handle:
# ulimit -n
1024? That can't be right, I already have 36844 files open! Further googling revealed that ulimit -n gives the per process limit. The system maximum for open files is the third number in:
# cat /proc/sys/fs/file-nr
11991   1267    412819
That's about 11 times what 8 users are currently using. So the filesystem limit is a respectable 88 users.

What is the thread limit?
threads-per-user=current-threads/8 = 472/8 = 59
max-users= threads-max/threads-per-user = 14336/59
That's about 242 users. I wonder what other limits are lingering out there? Does anyone have a nice table of limits for various operating systems? I know many are configurable but I'd be interested in the out of the box "supported" limit the absolute theoretical limits for various Linux distributions and Solaris. Be very quiet, I'm hunting limits...


I took this offline for a while because I didn't want anyone skimming the blog and coming to the conclusion that "Sun says I can run 242 users on a X86 linux box." But today I found myself referring to it so maybe it could be useful to someone else.

Friday Jul 30, 2004

In search of an automagic document store

I'm helping out with a project which makes heavy use of rsync and I'm starting to discover its usefulness elsewhere. I wonder if the GNOME team have considered putting a nice GUI front end on rsync so that it is as easy to use as Microsoft's briefcase? CVS or Webdav would probably be even better for the sort of document management I need. Nautilus already supports webdav via gnome-vfs, but would it be useful if a future version of JDS had something like this under every file menu:

Save As
Synchronize {Hostname | Hostname:path} 
Undo  {move back in document history}
Redo  {move forward in document history}
View Document history

Synchronize could grab content from the associated document at the IP address and try to automatically merge it with the current document, but it would be more useful if it presented the changes in something like an xdiff window so the user could select the changes they want.

Undo and Redo are pretty simple concepts, but to make them ubiquitous would require something at the gnome-vfs or base filesystem level. Digital's VMS had file versioning built into the filesystem at least 10 years ago so there isn't anything new here. If I'm totally wrong or offbase here, let me know. I'm open to suggestions.

Friday Jul 09, 2004

A rose by any other name... or what is Linux?

I previously mentioned a Linux Insider magazine article entitled Sun's bum rap on Open-Source. While at GUADEC, I read a linux magazine article which gave another company credit for work that was done by Sun. An open-source advocate at GUADEC also referred to this GNOME developers conference as "a linux conference." This got me wondering whether people understand that the open-source movement is not limited to linux. For example, I use the GNOME desktop on four machines:
  1. Solaris 9[tm] on an Ultra-Enterprise SunRay[tm] server
  2. Solaris 10 express on an X86 desktop
  3. Yellowdog linux on a Powerbook G3
  4. Java Desktop System 2.0 on an X86 laptop
If I had installed the same version of GNOME, the same themes and the same applications on all of these platforms, most people wouldn't be able to tell them apart. But only the last two would be considered linux by most definitions and few are aware that linux runs on non x86 hardware such as SPARC and PowerPC. This brought me to another very simple (non controversal ;-) question. What is linux?

The Purist definition
The computing-dictionary starts with:
Linux - ("Linus Unix") /li'nuks/ (but see below) An implementation of the Unix kernel originally written from scratch with no proprietary code. This is the definition that GNU experts such as Richard Stallman might subscribe to. However, it is not universally accepted. There is also:

The trademark definition gives:
Lin·ux A trademark for an open-source version of the UNIX operating system.

The purist definition says Linux is a kernel, and the trademark definintion says it's an operating system. Is there a difference between a kernel and an operating system? Yes, the kernel provides only the most basic core services for using your computer's hardware. If your computer hardware is the engine, the kernel is the gearbox. The kernel is a crucial component, but a computer with just a kernel is about as useful as an engine with just a gearbox. The operating system uses kernel services to provides other services which allow applications to run. There is a third definition of linux, which I would call:

The folk definition
This definition includes the kernel, the OS libraries, the GNU applications and the non-GNU applications... It includes everything that comes on the CD or in the box with a {some brand} logo such as Sun Java Desktop System Just as the vast majority of people celebrated the millenium one year early, conventional wisdom confuses GNU/linux with Linus' kernel and the Linux trademark. It also equates linux with open-source and can't always disinguish free beer from free speech. (Side note: both linux and Solaris are already free as in beer, however, Guinness is far from free here in Ireland.)

Finally there is:
The buzzword definition
Maybe you know a pointy-haired boss who strives to deploy {latest buzzword} on everything from bathroom fixtures to garden gnomes. When all you have is a hammer, the whole world looks like a nail! Linux kernel expert Alan Cox was quoted by linux user magazine as saying, 'We want people to adopt Linux not because Linux is a buzzword but because it genuinely solves their problems.'

So depending on who you are, your definition of linux probably includes one or more of the following:
  1. Linus Torvald's Kernel
  2. GNU Operating system and libraries (libgnome, gnome-vfs, gdk, gtk...)
  3. Open source applications (Nautilus, Mozilla,
  4. Other Applications and libraries (StarOffice, Qt, Java...)
What does this have to do with Sun? Well it turns out that Sun contributes to, interoperates with and sells products which include every layer of this stack. When people truly understand the technology behind the buzzwords, I think they will find that linux and Solaris compete in a few markets, but complement each other in many more.

That was just one opinion on a very simple question. I'll let others answer such imponderables such as why is it called the Java Desktop System? ,how do you pronounce 'linux' and how do you pronounce GNOME?

Friday Jul 02, 2004

GUADEC 2004 in Kristiansand Norway

This was only my second GUADEC and the first time I've presented there. Here are a few highlights:

Owen Taylor's "The future of rendering in GNOME" talk explained why GNOME rendering seems complex and confusing. Because it is complex and confusing. Rendering can take several paths to the frame buffer depending on whether you are rendering a character, an icon or an image. Adding a Cairo layer won't necessarily reduce the number of paths, but it should make it possible to eventually remove or replace them without breaking things.

Cleanup was also the topic of Jonathan Blandford & Anders Carlsson's talk on "The future of libgnome and libgnomeui." I'm looking forward to a gHelloWorld that won't have to load every library from Alexandria to Zanzibar!

Zaheer Abbas Merali's talk on gstreamer was interesting. Multimedia playback is currently a weakness in GNOME, but the gstreamer API appears to be very well designed. I wonder if anyone has written a graphical gstreamer interface similar to VisiQuest (previously known as Khoros) I wrote some extensions and customizations to Khoros in a previous job and found the user interface quite good for connecting data streams to filters and output devices. A kind of graphical software bus.

Speaking of "buses", Kristiansand bus stops had LED displays and (GPS?) devices indicating exactly when a bus would arrive. By contrast in Dublin if you're lucky you find a torn schedule sticker which indicates when a bus theoretically left the first stop. No schedules were posted at the Dublin airport and some stops post schedules for routes which no longer exist. Well designed bike paths and the more gentle way of driving also made this a less harrowing place for bicycling or walking. Come on Ireland and U.S.A., Norway is winning the race to a sustainable future!

My talk went reasonably well, though the large hall echo was disorienting. Public speaking isn't my best talent and I'm sure I made mistakes. Please feel free to correct me here.

Miguel's talk on C# wasn't quite what I expected. I need to research C#, .NET and Mono elsewhere. Whenever I see a C# program I get a feeling of deja vous and a craving for coffee. Where have I seen a programming language like that before?

The panel discussion on "Defining open standards" touched topics close to my interests. Why is public information ever stored in single vendor privately licensed formats? Here is one example from the U.S. army. When I visited the U.S. Library of Congress I viewed copies of Gutenburg's bible, Jefferson books and Lincoln's speeches and... an array of information kiosks all displaying blue screens of death. I don't think this is a good sign. I'll devote a future blog specifically to this topic. Some people were confused by Bruce Perens' comment about a "west coast company" attempting to push an XML document standard with proprietary extensions on the E.U. I don't think he was talking about Sun and the XML document format. There are quite a few companies on the west coast, one very well known one.

Two other talks were relevant to things Sun is doing. Kathy Fernandes' customers encounter some of the same issues that our usability and accessibility engineers are addressing. I never would have thought about night vision GNOME or the difficulty in using a mouse aboard a storm-tossed ship.

The Linux Terminal Server Project is just now encountering some of the issues we found when we deployed GNOME on a SunRay thin client environment. Its good to see that changes Sun was able to get accepted into the community will benefit others.

The skerries, lakes and woods surrounding Kristiansand reminded me of Door County Wisconsin and the northwoods lakes where I spent many summers growing up. But Kristiansand is less commercial and more beautiful with higher hills and bluer skies. The people were very helpful and friendly. One local man bought beers for 10 GNOME engineers because he saw one with a linux T-shirt and he loved linux! Is this valhalla? I don't know but the amusement park/zoo in Kristiansand is more family friendly than any I'd ever seen. A boardwalk at treetop level gives an overview of a nordic forest where elk, wolves and deer roam. You can even go in with the monkeys. A wave pool, luge, log water ride, baby buggies, canoes, paddleboats, rowboats and two full sized pirate ships are available at no extra charge. Wally's dream is alive in Norway! Here is our little GNOME enthusiest at the zoo, telling her daddy to put down his camera and continue to row row row the boat:
put down the camera and row!
GNOME's energy and direction may change as governments and corporations adopt it and the founders grow older. But I came back with quite a positive outlook on the future of GNOME and a very positive view of the people of Norway.

Wednesday Jun 16, 2004

Bloomsday and opensource

A sunny, breezy Dublin day marks the 100th anniversary of the day James Joyce met Nora Barnacle and immortalized in his novel Ulysses. Stepehen Daedalus in "Portrait of an artist..." reminded me of a childhood friend back in Racine, but I'm not the ulitimate Joyce fan. I didn't eat inner organs of beast and fowl for breakfast and to date I've only read Ulysses as far as lunch at Davy's pub on Duke street. Most Dublin landmarks haven't changed and knowing something about Irish culture does make the book more understandable. When Joyce writes about traffic jams, Sinn Fein and acceptance of immigrants, he could be talking about Dublin of 2004. Joyce's puzzle of walking through Dublin without passing a pub is more relevant now that pub smoking is illegal. Smokers must stand outside pubs so it can be difficult to push a pram past a pub. Bloomsday appears to be celebrated at least as enthusiastically in Champaign, Melbourne, Denver, Bradenton... Something of Ireland can be found nearly everywhere. I thought I noticed a faint Kerry accent in Native Americans of Northern Wisconsin, and I've met people from Japan, a nation with very few Irish immigrants, who regularly enjoy Ceili dancing and Irish Music in Tokyo. Denver doesn't have a large Irish population, but was quite the place to be on St. Patrick's day. Pipe bands, Floats, Irish dancers, free Kilian beer (as Irish as John Kerry.) Stagecoaches, cowboys, longhorn cattle? None of this really represented the Ireland of today but it celebrated aspects of Irish culture, music, history and language that the Celtic tiger may leave behind. I hope the world can be forgiven for celebrating and exaggerating aspects Irish culture. After all, what is more Irish than a good story?

What does this have to do with opensource?

A topic relevant to opensource came up at a Bloomsday celebration in Sandycove. In 1904 Joyce encountered great difficulty in publishing his works. A publisher purposely destroyed the manuscript for Dubliners and when Ulysses was finally published, it was banned in Britain and not generally available in Ireland until the 1960s. In 2004 Joyce's works are published in many languages and available on bookshelves throught the world. But now copyright restrictions and legal threats are preventing public Ulysses readings at many of Dublin's Bloomsday events. One of my favorite Irish expressions is "lost the plot." The expression certainly applies when an artistic or technical work is published with such severe restrictions that no one can use or promote it. I'm not a lawyer, I'm just an engineer with an individual opinion on end user license agreements (EULAs), so here it is:
  1. Simplify Simplify Simplify (Simplify \^3)
  2. Users generally don't have a lawyer at their side when they click the O.K. box on the "This software is not to be used to sell rashers..." EULA.
  3. Users seldom have a translator at their side when they click O.K.
  4. Consider locale specific EULAs, most nations do not have the legal complexity of the U.S., these locales may not require 20 page EULAs.
  5. Most users are not criminals, be gentle, don't drive them away.
  6. If you can opensource something, explore the benefits and risks, then just do it.
One last word, don't let anyone tell you that Sun isn't involved in the opensource movement. Sun has contributed hundreds of thousands of lines of code to, JXTA, GNOME, Mozilla and quite a few other projects.



« April 2014