Views on software from Bryan Cantrill's deck chair The Observation Deck

Monday Jul 11, 2005

I read with some interest about the GNOME startup bounty. As Stephen O'Grady pointed out, this problem is indeed perfect for DTrace. To get a feel for the problem, I wrote a very simple D script:
#!/usr/sbin/dtrace -s

#pragma D option quiet

proc:::exec-success
/execname == "gnome-session"/
{
        start = timestamp;
        go = 1;
}

io:::start
/go/
{
        printf("%10d { -> I/O %d %s %s %s }\n",
            (timestamp - start) / 1000000, pid, execname,
            args[0]->b_flags & B_READ ? "reads" : "writes",
            args[2]->fi_pathname);
}

io:::done
/go/
{
        printf("%10d { <- I/O to %s }\n",
            (timestamp - start) / 1000000, args[2]->fi_pathname);
}

io:::start
/go && ((struct buf *)arg0)->b_file != NULL &&
    ((struct buf *)arg0)->b_file->v_path == NULL/
{
        printf("%10s   (vp %p)\n", "", ((struct buf *)arg0)->b_file);
}

io:::start
/go/
{
        @apps[execname] = count();
        @files[args[2]->fi_pathname] = count();
        @appsfiles[execname, args[2]->fi_pathname] = count();
}

proc:::exec
/go/
{
        self->parent = execname;
}

proc:::exec-success
/self->parent != NULL/
{
        printf("%10d -> %d %s (from %d %s)\n",
            (timestamp - start) / 1000000, pid, execname,
            curpsinfo->pr_ppid, self->parent);
        self->parent = NULL;
}

proc:::exit
/go/
{
        printf("%10d <- %d %s\n",
            (timestamp - start) / 1000000, pid, execname);

}

profile-101hz
/go && arg1 != NULL/
{
        printf("%10d [ %d %s ]\n",
            (timestamp - start) / 1000000, pid, execname);
}

profile-101hz
/go && arg1 == NULL &&
  (curlwpsinfo->pr_flag & PR_IDLE)/
{
        printf("%10d [ idle ]\n",
            (timestamp - start) / 1000000);
}

END
{
        printf("\n  %-72s %s\n", "APPLICATION", "I/Os");
        printa("  %-72s %@d\n", @apps);
        printf("\n  %-72s %s\n", "FILE", "I/Os");
        printa("  %-72s %@d\n", @files);
        printf("\n  %-16s %-55s %s\n", "APPLICATION", "FILE", "I/Os");
        printa("  %-16s %-55s %@d\n", @appsfiles);
}
This script uses a combination of CPU sampling and I/O tracing to determine roughly what's going on over the course of logging in. I ran the above script on on my Acer Ferrari 3400 laptop running OpenSolaris by dropping to the command-line login after a reboot and running:
# nohup ./login.d > /var/tmp/login.out &
I then logged in, and made sure that the first thing I did was launch a gnome-terminal to pkill dtrace. (This could obviously be made quite a bit more precise, but it works as a crude way of indicating the completion of login.) Here is the output from performing this experiment. The first column is the millisecond offset from the start of gnome-session. CPU samples are contained within square brackets, launched programs are contained withing curly braces, and I/O is explicitly noted. An I/O summary is provided at the end. A couple of observations:
  • Nearly one third of all I/O is to shared object text and read-only data. This is classic death-of-a-thousand-cuts, and it's hard to see that there's an easy way to fix this. But perhaps text could be reordered to save some I/O? More investigation is probably merited here.

  • Over a quarter of all I/O is from GConf -- and many of these are from wandering around an expansive directory hierarchy looking for configuration information. It is well-known that the XML backend is a big performance problem, and a better backend is apparently being worked on. At any rate, solving this problem is clearly in GConf's future.

  • Of the remaining I/O, a bunch is to icon files. Glynn Foster pointed out that this looks to be addressed by the GTK+ gtk-update-icon-cache, new in GTK+ 2.6 and contained within GNOME 2.10, so this experiment will obviously need to be repeated on GNOME 2.10.

  • CPU utilization doesn't look like a big issue -- or it's one that is at least dwarfed by the cost of performing I/O. That said, gconfd-2 looks to be a bit piggy in this department as well. We're only using CPU sampling -- and we're using a pretty coarse grained sample -- and gconfd-2 still showed up. More precise investigation into CPU utilization can be performed with the sched provider and its on-cpu and off-cpu probes.

And an end-note: you might note many files named "<unknown>" in the output. This is due to I/Os being induced by lookups that are going through directories and/or symlinks that haven't been explicitly opened. For these I/Os, my script also gives you the pointer to the vnode structure in the kernel; you can get the path to these by using ::vnode2path in MDB:
# mdb -k
Loading modules: [ unix krtld genunix specfs dtrace ufs ip
sctp usba uhci s1394 random nca lofs nfs audiosup sppp ptm ipc ]
> ffffffff8f6851c0::vnode2path
/usr/sfw/lib/libXrender.so.1
>
Yes, having to do this sucks a bit, and it's a known issue. And rumor has it that Eric even has a workspace with the fix, so stay tuned...

Update: Eric pointed me to a prototype with the fix, and I reran the script on a GNOME cold start; here is the output from that run. Interestingly, because the symlinks now show up, a little postprocessing reveals that we chased nearly eighty symlinks on startup! From the output, reading many of these took 10 to 20 milliseconds; we might be spending as much as one second of GNOME startup blocked on I/O just to chase symlinks! Ouch! Again, it's not clear how one would fix this; having an app link to libpango-1.0.so.0 and not libpango-1.0.so.400.1 is clearly a Good Thing, and having this be a symlink instead of a hardlink is clearly a Good Thing -- but all of that goodness leaves you with a read dependency that's hard to work around. Anyway, be looking for Eric's fix in OpenSolaris and then in an upcoming Solaris Express release; it makes this kind of analysis much easier -- and thanks Eric for the quick prototype!


Technorati tags:
Comments:

Interesting stuff. Do you think a valid solution for this would be to link against libumem? :)

Posted by 24.152.137.250 on July 11, 2005 at 10:26 PM PDT #

If I understand correctly crle(1) could be used to create a cache for the resolutions of gnome-session's and gconfd-2's library dependencies, and their dependencies, and so on. And if a significant part of that text/data I/O is for object relocation then dldump(3C)ed objects can be cached as well.

Posted by Nico on July 27, 2005 at 12:11 PM PDT #

[b]香港会计事务所 [b]日聪注册香港公司 登尼特香港公司注册香港登尼特:专业公司注册、香港公司注册,上海公司注册,美国公司注册,注册深圳公司,中国及海外公司. 登尼特注册香港公司香港登尼特:专业注册公司、注册香港公司,注册上海公司,注册美国公司,注册深圳公司,中国及海外公司,香港公司注册,深圳公司注册,上海公司注册,中国公司注册。 上海企业注册中心,专业香港公司注册主要提供香港公司注册、香港公司注册咨询,香港公司注册代办,香港公司注册办理,香港公司注册银行开户,商务秘书等一条龙服务。香港公司注册登记处,致力于注册香港公司、工商企业登记、香港会计税务、香港律师咨询等服务,是香港政府唯一的工商企业登记注册机构 登尼特注册香港公司专业注册香港公司,权威全球公司注册,注册英、美、BVI公司,中国及全球商标注册.

Posted by 注册香港公司 on July 16, 2007 at 11:16 PM PDT #

登尼特北京香港公司注册 上海公司注册中心专业注册香港公司海外公司注册、深圳公司注册、香港公司注册、注册公司、注册商标及提供注册公司的配套服务,公司注册成立后是企业运作的开始,注册香港公司电话:0755-82143660刘小姐 登尼特注册香港公司专业服务,包括注册香港公司价格咨询,注册香港公司知识,注册香港公司的优势及发展,有需要注册香港公司的欢迎和我们联系。0755-82143660刘小姐 海鸥注册香港公司简况,香港公司注册:包括公司名称查册核实、准备首次会议记录、准备所有法定文件、安排所有股东签署文件、担任香港公司注册法定秘书、香港公司注册处代宣誓、代付香港公司注册费用、标准章一枚、香港公司注册更改章一枚。本公司提供一切香港公司注册的业务活动。香港公司注册电话:0755-82143660刘小姐 波仕达会计事务所专业注册香港公司服务:*注册香港公司咨询,*注册香港公司服务,本公司提供一切条件方便客户;

Posted by 注册香港公司 on July 16, 2007 at 11:18 PM PDT #

登尼特香港公司注册咨询 登尼特香港公司注册,香港公司注册:包括香港公司注册名称查册核实、准备首次会议记录、准备所有法定文件、安排所有股东签署文件、担任香港公司注册法定秘书、香港公司注册处代宣誓。 登尼特注册香港公司条件 波仕达香港公司注册 [b]日聪专业注册香港公司海外公司注册、深圳公司注册、香港公司注册、注册公司、注册商标及提供注册公司的配套服务,公司注册成立后是企业运作的开始,注册香港公司电话:0755-82143660刘小姐 日聪香港公司注册简况,香港公司注册:包括公司名称查册核实、准备首次会议记录、准备所有法定文件、安排所有股东签署文件、担任香港公司注册法定秘书、香港公司注册处代宣誓、代付香港公司注册费用、标准章一枚、香港公司注册更改章一枚。本公司提供一切香港公司注册的业务活动。香港公司注册电话:0755-82143660刘小姐 注册香港公司

Posted by 注册香港公司 on July 16, 2007 at 11:18 PM PDT #

日聪专业提供深圳注册香港公司服务:*注册香港公司咨询,*注册香港公司服务,本公司提供一切条件方便客户; 日聪香港公司注册 香港日聪注册香港公司、海鸥注册香港公司、登尼特注册香港公司、瑞丰注册香港公司、东莞注册香港公司、上海注册香港公司、代理注册香港公司、注册香港公司留言、香港公司注册处。 登尼特注册香港公司 香港登尼特:专业注册公司、注册香港公司,注册上海公司,注册美国公司,注册深圳公司,中国及海外公司,香港公司注册,深圳公司注册,上海公司注册,中国公司注册。[b] Piers 怎样抓住中东市场新机会,作为浙江企业中开拓中东市场比较成功的典型,宁波燎原灯具股份公司今年1至4月出口中东地区的销售额已达300多万美元。该公司董事长邵云蒸说:“中东地区的市场有三个特点:一是中东地区消费者平均年龄相当年轻;二是中东国家的家庭成员人数比发达国家多;三 ... 电子狗,专业汽车电子狗生产厂家,集研发,销售于一体QQ:775008741。 欧洲资源[b]

Posted by 注册香港公司 on July 16, 2007 at 11:19 PM PDT #

[b]香港登尼特专业注册公司提供注册公司咨询0755-82143181 [b]登尼特专业注册公司提供注册公司咨询0755-82143181 [b]香港日聪专业注册公司提供注册公司咨询0755-82143181 [b]登尼特专业注册公司提供注册公司咨询0755-82143181 香港海鸥注册公司提供公司注册咨询0755-82143272 [b]登尼特专业公司注册提供公司注册咨询0755-82143181 [b]登尼特专业公司注册提供公司注册咨询0755-82143181 [b]香港日聪专业公司注册提供注册公司咨询0755-82143181 [b]登尼特专业公司注册提供注册公司咨询0755-82143181

Posted by 注册香港公司 on July 16, 2007 at 11:21 PM PDT #

[b]香港日聪专业公司注册提供注册公司咨询0755-82143181 [b]登尼特专业公司注册提供注册公司咨询0755-82143181 香港日聪商标事务所专业注册商标,包括注册香港商标,注册中国商标,注册海外商标,马德里商标注册,商标买卖,商标异议,品牌规划,商标注册,专利申请,版权登记等服务。中国区电:0755-82143272,atahkhk@21cn.com 香港日聪商标注册网,免费提供商标注册信息查询,根据国际惯例,查询所涉及的商标注册信息仅供参考,无任何法律效力。尽管如此,国家工商行政管理总局商标局仍会尽最大努力向中外公众提供尽可能准确的商标注册信息,并及时更新商标注册数据库信息。 登尼特专业注册公司 香港日聪商标事务所专业注册香港商标 香港日聪商标事务所专业香港商标注册 香港日聪商标事务所专业中国商标注册

Posted by 注册香港公司 on July 16, 2007 at 11:21 PM PDT #

Post a Comment:
Comments are closed for this entry.