<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5527241191615022462</id><updated>2024-10-23T23:52:19.664-07:00</updated><category term="solaris"/><category term="Solaris 11"/><category term="desktop"/><category term="fonts"/><category term="mesos"/><category term="mongodb solaris performance"/><category term="pycc"/><category term="sparc"/><title type='text'>Sun will rise</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-156306354144598806</id><published>2013-05-05T06:31:00.001-07:00</published><updated>2013-05-05T06:37:35.163-07:00</updated><title type='text'>My Chinese Teacher</title><content type='html'>My high school Chinese teacher, Mr. Zhang Jun Qiu, passed away in his fifties this week. He&#39;s a role model and I respect him so much. I never expected a few words in QQ chat last year was the last communication with him...&lt;br /&gt;
&lt;br /&gt;
Rest In Peace, my teacher.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/156306354144598806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2013/05/my-chinese-teacher.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/156306354144598806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/156306354144598806'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2013/05/my-chinese-teacher.html' title='My Chinese Teacher'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-6657017490901439322</id><published>2013-04-22T03:11:00.002-07:00</published><updated>2013-04-23T03:02:24.538-07:00</updated><title type='text'>dd on devices the difference between Linux and Soalris</title><content type='html'>People like to use dd to do the micro benchmark because it is simple. However, we should be careful about what is being measured by dd. This can be &lt;b&gt;complicated&lt;/b&gt; than we imagine.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s take a look on a simple scenario: &lt;b&gt;single dd writes on devices with bs=16k&lt;/b&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;    # dd if=/dev/zero of=dev_name bs=16k count=655360  
&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;b&gt;The difference between block I/O and raw I/O and The difference between Solaris and Linux&lt;/b&gt;&lt;/h3&gt;
The device name can be block devices or raw devices. For I/O on block devices, there&#39;s a cache layer in OS kernel. For I/O on raw devices, I/O bypasses the kernel&#39;s buffer cache.&lt;br /&gt;
&lt;br /&gt;
The device names are different between Linux and Solaris:&lt;br /&gt;
- Solaris block device: /dev/dsk/...&lt;br /&gt;
- Solaris raw device: /dev/&lt;b&gt;r&lt;/b&gt;dsk/...&lt;br /&gt;
- Linux block device: /dev/sdxxx, /dev/mapper/xxxx, etc.&lt;br /&gt;
- Linux raw device: /dev/raw/xxxx (raw binding on block device)&lt;br /&gt;
&lt;br /&gt;
What do they look like in iostat? (Don&#39;t look at performance numbers, I tested on different disks), I&#39;m illustrating the behavior of single dd write on block devices and raw devices.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Solaris block device (bs=16k):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extended device statistics
&amp;nbsp;&amp;nbsp;&amp;nbsp; r/s&amp;nbsp;&amp;nbsp;&amp;nbsp; w/s&amp;nbsp;&amp;nbsp; Mr/s&amp;nbsp;&amp;nbsp; Mw/s wait actv wsvc_t asvc_t&amp;nbsp; %w&amp;nbsp; %b device
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0 13006.1&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0&amp;nbsp; 101.6 133.5 256.4&amp;nbsp;&amp;nbsp; 10.3&amp;nbsp;&amp;nbsp; 19.7 100 100 c5t20360080E536D50Ed0

Linux block device (bs=16k&lt;span style=&quot;font-size: x-small;&quot;&gt;)&lt;/span&gt;:
Device:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rrqm/s&amp;nbsp;&amp;nbsp; wrqm/s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r/s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; w/s&amp;nbsp;&amp;nbsp;&amp;nbsp; rkB/s&amp;nbsp;&amp;nbsp;&amp;nbsp; wkB/s avgrq-sz avgqu-sz&amp;nbsp;&amp;nbsp; await r_await w_await&amp;nbsp; svctm&amp;nbsp; %util
sda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 14098.00&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00&amp;nbsp; 115.00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 57868.00 1006.40&amp;nbsp;&amp;nbsp; 140.86 1325.40&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 1325.40&amp;nbsp;&amp;nbsp; 8.70 100.00

Solaris raw device (bs=16k):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extended device statistics
&amp;nbsp;&amp;nbsp;&amp;nbsp; r/s&amp;nbsp;&amp;nbsp;&amp;nbsp; w/s&amp;nbsp;&amp;nbsp; Mr/s&amp;nbsp;&amp;nbsp; Mw/s wait actv wsvc_t asvc_t&amp;nbsp; %w&amp;nbsp; %b device
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0 2805.0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0&amp;nbsp;&amp;nbsp; 43.8&amp;nbsp; 0.0&amp;nbsp; 0.9&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.3&amp;nbsp;&amp;nbsp; 3&amp;nbsp; 87 c5t20360080E536D50Ed0

Linux raw device (bs=8k):
Device:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rrqm/s&amp;nbsp;&amp;nbsp; wrqm/s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r/s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; w/s&amp;nbsp;&amp;nbsp;&amp;nbsp; rkB/s&amp;nbsp;&amp;nbsp;&amp;nbsp; wkB/s avgrq-sz avgqu-sz&amp;nbsp;&amp;nbsp; await r_await w_await&amp;nbsp; svctm&amp;nbsp; %util
sda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 3645.00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 29160.00 16.00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.63&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.18&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.18&amp;nbsp;&amp;nbsp; 0.17&amp;nbsp; 62.90
&lt;/span&gt;
&lt;/pre&gt;
For &quot;single dd write&quot; on block devices, look at &quot;actv&quot; column (Solaris) and &quot;avgqu-sz&quot; column (Linux), which means that average number of transactions actively being serviced (removed from the wait queue but not yet completed) are much larger than 1. On Solaris, the &quot;actv&quot; limit is controlled by kernel parameter ssd_max_throttle or sd_max_throttle, the default is 256. If the limit is hit, the I/O request will be queued (&quot;wait&quot; in iostat). The upper layer (e.g. ZFS filesystem) may also limit the I/Os sent for each device . &lt;br /&gt;
&lt;br /&gt;
For &quot;single dd write&quot;  on raw devices,&amp;nbsp; the &quot;actv&quot; or&amp;nbsp; &quot;avgqu-sz&quot; is never larger than 1 (unless the backend of dev is not a real device, e.g. a regular file), which means that only when previous data transfer is completed, the next data can be send to the device. In this regard, Solaris and linux behave similarly. In addition, since this is I/O on raw devices, the I/O size in iostat is equal to application write size. While modern CPU and memory subsystem is very fast,&amp;nbsp; &quot;single dd write&quot;  on raw devices becomes more like a disk subsystem latency testing. &lt;br /&gt;
&lt;br /&gt;
On the other hand, Solaris and Linux has different caching implementations for dd writes on block devices. From above iostat output, you can see Solaris write() splits the data into 8k trunks then send data to the I/O driver, while Linux can smartly merge small I/Os (&quot;wrqm&quot; column in iostat).&amp;nbsp; This means that for &quot;dd writes on block devices&quot; Linux usually performs better than Solaris. However, this is not very common in Solaris, in most cases, application I/O writes are on the file system which can consolidate writes or on raw devices which is usually used and optimized by databases. Below is iostat during the write testing on a file in a ZFS filesystem.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;$ dd if=/dev/zero of=TEST bs=16k count=655360
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extended device statistics
&amp;nbsp;&amp;nbsp;&amp;nbsp; r/s&amp;nbsp;&amp;nbsp;&amp;nbsp; w/s&amp;nbsp;&amp;nbsp; Mr/s&amp;nbsp;&amp;nbsp; Mw/s wait actv wsvc_t asvc_t&amp;nbsp; %w&amp;nbsp; %b device
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0&amp;nbsp; 154.0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.0&amp;nbsp; 154.0&amp;nbsp; 0.0 10.0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.1&amp;nbsp;&amp;nbsp; 64.7&amp;nbsp;&amp;nbsp; 2 100 c7t0d0&lt;/span&gt;&lt;/pre&gt;
We can see the above I/O write size is 154.0/154.0=1MB/s.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
What&amp;nbsp; you can expect for single dd write performance&lt;/h3&gt;
Below is my test result on a modern server, yours may be different.&lt;br /&gt;
&lt;br /&gt;
2.5&quot; 10KPM internal disk without using internal hardware raid:&lt;br /&gt;
single dd writes on block device bs=16k: 160MB/s.&lt;br /&gt;
single dd writes on raw device bs=16k: 160MB/s  (drive write-cache enabled)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.3MB/s (drive write-cache disabled)&lt;br /&gt;
&lt;br /&gt;
A low-end SAN storage:&lt;br /&gt;
single dd writes on block device  bs=16k: depends on OS, LUN disk layout, raid level etc.&lt;br /&gt;
single dd writes on raw device  bs=16k: a little more than 40MB/s (with some tweak on storage settings can get 75MB/s)&lt;br /&gt;
&lt;br /&gt;
Additional notes:&lt;br /&gt;
----------------------- &lt;br /&gt;
- On linux, raw I/O&amp;nbsp; is similar as O_DRIECT, GNU dd has a &quot;oflag=direct&quot; option for block device.&lt;br /&gt;
- Also tested on internal hardware raid0 volume of internal disk, the performance is similar as above internal disk testing result. A benefit of using internal hardware raid is for &quot;oflag=dsync&quot; writes, if you configure the internal raid controller cache as write-back enabled, then you will get much better performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/6657017490901439322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/dd-on-devices-difference-between-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6657017490901439322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6657017490901439322'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/dd-on-devices-difference-between-linux.html' title='dd on devices the difference between Linux and Soalris'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-793149225575699911</id><published>2013-04-21T20:53:00.001-07:00</published><updated>2013-04-21T20:55:47.870-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="solaris"/><title type='text'>CLOSE_WAIT </title><content type='html'>It&#39;s not the first time to hear that people complain CLOSE_WAIT state remains on the system.&lt;br /&gt;
It is because that the peer closes the connection (close the socket explicitly or the peer process is terminated), but your side does not take correct action on this connection.&lt;br /&gt;
&lt;br /&gt;
So, what happens if the peer closes the connection?&lt;br /&gt;
&lt;br /&gt;
- If your side does not take correct actions, the peer will NOT result in bad state and the peer&#39;s connection state will be cleaned up after tcp_fin_wait_2_flush_interval .&lt;br /&gt;
&lt;br /&gt;
- If your side is doing write() or send() on the connection, your side will receive SIGPIPE signal (&quot;broken pipe&quot;, see signal.h man page). The default action for SIGPIPE is exiting the application. So your application probably need change this default behavior.&lt;br /&gt;
&lt;br /&gt;
-&amp;nbsp; If your side is doing read() or recv() on the connection, your side will receive the return code &quot;0&quot;. Your side must handle this situation.&lt;br /&gt;
&lt;br /&gt;
- If your side is waiting for POLLIN event via select() or poll() or port_get(), then it will fire the event and consequently your recv() code will return &quot;0&quot;, thus you can handle this situation in your application.&lt;br /&gt;
&lt;br /&gt;
- If your side does not take any action on the connection, CLOSE_WAIT 
will remains on your side until you exit or restart your side 
application. (The tcp_keepalive_interval or&amp;nbsp; 
tcp_keepalive_abort_interval in&amp;nbsp; tcp/ip settings does not help on this)&lt;br /&gt;
&lt;br /&gt;
A typical mistake in application is as below, see below example:&lt;br /&gt;
....
&lt;br /&gt;
recvbytes=recv(sockfd, buf, BUFSIZE, 0);
&lt;br /&gt;
&amp;nbsp;if (recvbytes &amp;lt; 0) {
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; perror(&quot;recv error&quot;);
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; close(sockfd);
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .....
&lt;br /&gt;
}
&lt;br /&gt;
....
&lt;br /&gt;
&lt;br /&gt;
this is buggy, the correct way is&amp;nbsp; &quot; if (recvbytes &amp;lt;&lt;b&gt;=&lt;/b&gt; 0) {&quot;
&lt;br /&gt;
&quot;0&quot; means the peer has closed the connection.
&lt;br /&gt;
&lt;br /&gt;
It&#39; strange that Linux man page clearly says &quot;recv() returns 0&quot; means the 
peer &amp;nbsp;has&amp;nbsp; performed&amp;nbsp; an&amp;nbsp; orderly shutdown but current Solaris man page says 
nothing about it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/793149225575699911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/closewait.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/793149225575699911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/793149225575699911'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/closewait.html' title='CLOSE_WAIT '/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-3169068092372073859</id><published>2013-04-20T04:37:00.001-07:00</published><updated>2013-04-20T04:37:17.824-07:00</updated><title type='text'>Be careful to use valloc and libmalloc on Solaris 10</title><content type='html'>If you application uses valloc(),&amp;nbsp;be careful to use with libmalloc.so on Solaris 10.&lt;br /&gt;
Solaris 10&#39;s libmalloc (at least for several versions I tested) does 
not have implementation of valloc(), then valloc() is called from libc 
but free() is called from libmalloc, this will cause core dump.&lt;br /&gt;
&lt;br /&gt;
You can use DTrace to check it. For example:&lt;br /&gt;
~/tmp$ dtrace -qn &#39;pid$target::valloc:entry {ustack();}&#39; -c ./a.out&lt;br /&gt;
&lt;br /&gt;
To check if you libmalloc has valloc:&lt;br /&gt;$ elfdump /usr/lib/libmalloc.so|grep valloc&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; </content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/3169068092372073859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/be-careful-to-use-valloc-and-libmalloc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3169068092372073859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3169068092372073859'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/be-careful-to-use-valloc-and-libmalloc.html' title='Be careful to use valloc and libmalloc on Solaris 10'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-7929450765771359460</id><published>2013-04-20T04:28:00.001-07:00</published><updated>2013-04-20T04:28:36.165-07:00</updated><title type='text'>Four Years</title><content type='html'>Four years ago today, my colleague called me while I was washing dishes after dinner. He said: &quot;our company is sold! check your email now...&quot; &lt;br /&gt;Yes, I cannot forget it for ever. The bitterness is still deeply in my heart.&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/7929450765771359460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/four-years.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/7929450765771359460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/7929450765771359460'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2013/04/four-years.html' title='Four Years'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-3942098012636215008</id><published>2013-01-30T00:53:00.000-08:00</published><updated>2013-01-30T01:01:07.792-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mesos"/><category scheme="http://www.blogger.com/atom/ns#" term="pycc"/><category scheme="http://www.blogger.com/atom/ns#" term="solaris"/><category scheme="http://www.blogger.com/atom/ns#" term="sparc"/><title type='text'>Build Mesos on Solaris</title><content type='html'>&lt;a href=&quot;http://incubator.apache.org/mesos/&quot; target=&quot;_blank&quot;&gt;Mesos&lt;/a&gt; is a cluster manager that provides efficient resource isolation and sharing across distributed applications, or frameworks. The purpose to build it is that I want to have experiments on &lt;a href=&quot;http://spark-project.org/&quot; target=&quot;_blank&quot;&gt;Spark&lt;/a&gt; , a popular framework for cluster computing (e.g. big data analysis).&lt;br /&gt;
Mesos integrated a lots of third party software,&amp;nbsp; the build process on Solaris is not very smooth. At first, I tried Solaris Studio (SunCC), but had some troubles. To save time, I decided to use gcc.&lt;br /&gt;
The build environment is: Solaris 11 11/11 sparc;&amp;nbsp; gcc is 4.5.2 from Solaris 11 IPS repository; mesos 0.9.0.&lt;br /&gt;
&lt;h3&gt;
Preparation Steps:&lt;/h3&gt;
-&lt;b&gt; need to build automake-1.11.6&lt;/b&gt; (automake-1.11.2 from Solaris 11 is not enough for mesos 0.9.0)&lt;br /&gt;
wget http://ftp.gnu.org/gnu/automake/automake-1.11.6.tar.gz&lt;br /&gt;
CC=cc CXX=CC ./configure --program-suffix=-1.11&lt;br /&gt;
gmake;gmake install&amp;nbsp; (in /usr/local/bin)&lt;br /&gt;
&lt;br /&gt;
- &lt;b&gt;modify configure.ac&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
in &quot;solaris&quot; section:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CC=cc&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CXX=CC&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CFLAGS=&quot;$CFLAGS&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CXXFLAGS=&quot;$CXXFLAGS&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; LIBS=&quot;$LIBS -lsocket -lnsl -lproject -lproc -lresolv -lsendfile -lxnet&quot;&lt;br /&gt;
&lt;br /&gt;
then in &quot;JAVA_LDFLAGS&quot; section, add something:&lt;br /&gt;
&amp;nbsp; ...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; elif test &quot;$OS_NAME&quot; = &quot;solaris&quot;; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JAVA_LDFLAGS=&quot;&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for arch in sparc; do&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dir=&quot;$JAVA_HOME/jre/lib/$arch/server&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if test -e &quot;$dir&quot;; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Note that these are libtool specific flags.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JAVA_LDFLAGS=&quot;-L$dir -R$dir -ljvm&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; done&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;
&amp;nbsp;...&lt;br /&gt;
&lt;br /&gt;
-&amp;nbsp; &lt;b&gt;execute autoconf&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
-&amp;nbsp; &lt;b&gt;run configure:&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;./configure CC=gcc CXX=g++ CFLAGS=&quot;-m32 -pthreads&quot; CXXFLAGS=&quot;-m32 -pthreads&quot; JAVA_HOME=/usr/java --prefix=/opt/mesos&lt;br /&gt;
&lt;h3&gt;
Porting issues and solutions:&lt;/h3&gt;
1) process.cpp in libprocess&lt;br /&gt;
compile process.cpp and future.hpp failed because syntax error in assembly.&lt;br /&gt;
using CC -S, then cc -c process.s, we found it use &quot;pause&quot; instruction.&lt;br /&gt;
Solution: use smt_pause()&lt;br /&gt;
&lt;br /&gt;
2) process.cpp in libprocess&lt;br /&gt;
ssize_t length = sendfile(s, fd, offset, size);&lt;br /&gt;
=&amp;gt;&lt;br /&gt;
ssize_t length = sendfile(s, fd, &amp;amp;offset, size);&lt;br /&gt;
&lt;br /&gt;
3)pid.cpp in libprocess&lt;br /&gt;
for gethostbyname2_r, it is not availabe on Solaris, has to modify the codes to use gethostname_r&lt;br /&gt;
&lt;br /&gt;
4)port_posix.h, atomic_pointer.h&lt;br /&gt;
for macros and memory barriers.&lt;br /&gt;
&lt;br /&gt;
5)getpwuid_r in zookeeper.c&lt;br /&gt;
getpwuid_r(uid, &amp;amp;pw, buf, sizeof(buf), &amp;amp;pwp))&lt;br /&gt;
smiliar as gethostbyname2&lt;br /&gt;
&lt;br /&gt;
6)recordio.c&amp;nbsp; in zookeeper&lt;br /&gt;
redefined htonll: &lt;br /&gt;
recordio.h:int64_t htonll(int64_t v);&lt;br /&gt;
On solaris, the prototype is: uint64_t htonll(uint64_t hostlonglong);&lt;br /&gt;
linux doesn&#39;t have htonll&lt;br /&gt;
Solution: comment out htonll&lt;br /&gt;
&lt;br /&gt;
7)mt_adapter.c in zookeeper&lt;br /&gt;
atomic ops: fetch_and_add&lt;br /&gt;
&lt;br /&gt;
8)cli.c in zookeeper&lt;br /&gt;
ctime_r(&amp;amp;tctime, tctimes)&lt;br /&gt;
Solaris requires: char *ctime_r(const time_t *clock, char *buf, int buflen);&lt;br /&gt;
&lt;br /&gt;
9)mesos&lt;br /&gt;
./common/utils.hpp:359:17: error: ‘NAME_MAX’ was not declared&lt;br /&gt;
Solution: define it #define NAME_MAX 255&lt;br /&gt;
&lt;br /&gt;
10)slave/solaris_project_isolation_module.hpp&lt;br /&gt;
Solaris project implementation is not completed, so got compiling error.&lt;br /&gt;
Workaround: skip it by modifying macro definition&lt;br /&gt;
&lt;br /&gt;
11) protobuf is compiled in 64-bit by default.&lt;br /&gt;
Solution: reconfigure in thirdparty/protobuf according to config.log and add -m64 in CFLAGS and CXXFLAGS: (it&#39;s better to add -m32 in top level of mesos configure).&lt;br /&gt;
&lt;br /&gt;
12) /usr/lib/python2.6/pycc complained:&lt;br /&gt;
cc: No valid input files specified, no output generated&lt;br /&gt;
because the src file is c++: native/proxy_executor.cpp&lt;br /&gt;
Workaround (by looking at /usr/lib/python2.6/pycc, pycc and pyCC is same):&lt;br /&gt;
in ~/Downloads/mesos-0.9.0/src/python&lt;br /&gt;
$ PYCC_CC=g++ PYCC_CXX=g++ LDFLAGS=&quot;-lnsl -lresolv -lsendfile -lsocket&quot; python setup.py build&lt;br /&gt;
(It seems on Solaris 11.1 there&#39;s no such issue).&lt;br /&gt;
&lt;br /&gt;
13) gmake test&lt;br /&gt;
need -lxnet&lt;br /&gt;
&lt;br /&gt;
14) got runtime error:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (errno != EINPROGRESS) {...&lt;br /&gt;
&amp;nbsp;&amp;nbsp; in fact, errno is 0 here.&lt;br /&gt;
Reason: not with &quot;-pthreads&quot; in build libprocess.&lt;br /&gt;
Solution: also add&amp;nbsp; &quot;-pthreads&quot; in configure.ac so that it take effects for each thread having a private copy of errno.&lt;br /&gt;
&lt;h3&gt;
Other notes:&lt;/h3&gt;
- Building mesos 0.9.0 fails with gcc 4.7 on Linux. Most current linux versions come with this gcc version.&lt;br /&gt;
- I also built mesos 0.9.0 on Solaris 11.1 x64, the code modifications are less because the platform is x64.&lt;br /&gt;
- The modified files are now put into &lt;a href=&quot;https://github.com/xinfengliu/mesos-solaris&quot; target=&quot;_blank&quot;&gt;github&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/3942098012636215008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2013/01/build-mesos-on-solaris.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3942098012636215008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3942098012636215008'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2013/01/build-mesos-on-solaris.html' title='Build Mesos on Solaris'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-3117062625277204054</id><published>2012-10-29T02:28:00.000-07:00</published><updated>2012-10-29T19:22:12.091-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mongodb solaris performance"/><title type='text'>Micro Benchmark MongoDB 2.2 performance on Solaris </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
 &lt;!--
  @page { margin: 0.79in }
  P { margin-bottom: 0.08in }
  A:link { so-language: zxx }
 &lt;/style&gt;
 &lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
I 100% agree on the statement by
&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Benchmarks&quot;&gt;MongoDB&lt;/a&gt;:
&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;“MongoDB does not publish any official benchmarks. We recommend
running application performance tests on your application&#39;s work-load
to find bottleneck and for performance tuning.”&lt;/i&gt;&lt;/blockquote&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
However I don&#39;t have real world workload, so I just tried some micro benchmarks to observe the behaviors of MongoDB and OS. Although the result numbers mean nothing, but I would share some findings here.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;b&gt;1) Using JS Benchmark Harness&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
MongoDB provides &lt;a href=&quot;http://www.mongodb.org/display/DOCS/JS+Benchmarking+Harness&quot;&gt;JS
Benchmarking Harness&lt;/a&gt; as a QA baseline perf measurement tool, not
designed to be a &quot;benchmark&quot;. This is a good start for
having a first look at  MongoDB performance. The harness is very easy
to setup. However, there are a few things  to be considerded.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
The sample code on that web page is
really really a micro benchmark. I tested it against MongoDB 2.2 for
Solaris x64 and got suboptimal result comparing against Linux
version. After analyzing the workload characteristics, it is  more
like a multi-threaded malloc and small TCP/IP packet ping-pong
testing.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
By passing &lt;b&gt;LD_PRELOAD_64=libmtmalloc.so&lt;/b&gt;
to starting mongod, I got the performance on Solaris  parallel to
Linux. If the test client and sever are on separate systems, I may
also need disable nagle algorithm: $ sudo ndd -set /dev/tcp
tcp_naglim_def 1&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
The harness also has an interesting
feature: RAND_INT [ min , max , multiplier &lt;multiplier&gt;], it looks like
we are able to only touch a fix fraction of data during the testing.
Two things need be considered here:&lt;/multiplier&gt;&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;I looked at the current
harness implementation,  RAND_INT is translated to rand(), this is
not really random for big (millions of records) data sets. &lt;a href=&quot;https://github.com/xinfengliu/mongo/commit/cb1473eddc5a50f2d5b14d6e2552e49d17de939d&quot; target=&quot;_blank&quot;&gt;The fix&lt;/a&gt; is
using &lt;b&gt;lrand48()&lt;/b&gt; instead. 
&lt;/li&gt;
&lt;li&gt;MongoDB uses mmap to cache data, like
many other databases, it is still a &lt;b&gt;page-level cache&lt;/b&gt; rather than
row-level cache. So if your record size is small, RAND_INT [ 1,
10000000, 10 ] doesn&#39;t make you only touch 1/10 data, rather it makes
you touch all the data.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;
&lt;b&gt;2) Using YCSB.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;a href=&quot;http://research.yahoo.com/Web_Information_Management/YCSB&quot;&gt;YCSB&lt;/a&gt;
is an extensive load testing tool. But its tests codes for mongodb is
a little outdated. I need modify a little bit to add more
writeConcern type. &lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
YCSB&#39;s testing driver has some
limitations:&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;
You can set read/write proportion, but
they are in same thread context, which means writes can block reads.
So I prefer to put them in separate simultaneous jobs in
testing.&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;The “recordcount” also implicitly set the max Id of data
to be tested. when testing mongodb, the small number means only a few
data files are mapped into the memory during transaction phase. So
setting “recordcount”in transaction phase is not the right way to
test against only small portion of the data.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;b&gt;3) Solaris related stuff.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;
The Solaris version of  mongodb 2.2 has
a large binary size compared to Linux, although it nearly does not
affect the performance, but I don&#39;t like it. A quick check on its
build info got “GCC 4.4 on snv_89 January 2008”, too old. This
should be fixed by adding GCC option &lt;b&gt;&quot;-fno-function-sections&quot;
and &quot;-fno-data-sections&quot;.&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;
When starting mongod for
Solaris, a warning message shows: “your operating system version
does not support the method that MongoDB uses to detect impending
page faults. This may result in slower performance for certain use
cases”. After browsing the source codes, I found processinfo
support is not there. So I added the &lt;a href=&quot;https://github.com/xinfengliu/mongo/commit/f44ea1d88fd4b8b6c824051d0b9311fdffa2ce8f&quot; target=&quot;_blank&quot;&gt;Solaris support&lt;/a&gt;, currently the
functions that count are &lt;b&gt;ProcessInfo::blockInMemory()&lt;/b&gt; and
&lt;b&gt;ProcessInfo::blockCheckSupported()&lt;/b&gt;. &lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;
The mongodb &lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/src/mongo/util/mmap_posix.cpp#L127&quot;&gt;source
code&lt;/a&gt; says “madvise not supported on solaris yet”, this is
funny. Solaris certainly supports madvise. But madvise() is only
useful when you understand your workloads. So I don&#39;t think this
piece of code of calling madvise() is important.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;
ZFS and UFS. &lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
==========&lt;br /&gt;
Since mongodb uses
mmap(), it leaves a lot of things to the OS file system. UFS is a
traditional file system, it uses traditional page cache (cachelist )
for caching file data. ZFS has quite a lot features beyond a file
system, ZFS has its own ARC cache.  The physical memory usage can be
inspected using mdb ::memstat command:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;# echo &quot;::memstat&quot;|mdb -k
Page Summary&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pages&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MB&amp;nbsp; %Tot
------------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----------------&amp;nbsp; ----------------&amp;nbsp; ----
Kernel&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 293720&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1147&amp;nbsp;&amp;nbsp;&amp;nbsp; 7%
ZFS File Data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 85347&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 333&amp;nbsp;&amp;nbsp;&amp;nbsp; 2%
Anon&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 138902&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 542&amp;nbsp;&amp;nbsp;&amp;nbsp; 3%
Exec and libs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1638&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp; 0%
Page cache&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 27118&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 105&amp;nbsp;&amp;nbsp;&amp;nbsp; 1%
Free (cachelist)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3036514&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11861&amp;nbsp;&amp;nbsp; 73%
Free (freelist)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 576129&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2250&amp;nbsp;&amp;nbsp; 14%

Total&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4159368&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16247
Physical&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4159367&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16247


&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
In my test, ZFS is very good
performance in data loading. However, because ZFS has its own cache,
if the data is not mmaped, it will be searched firstly from cachelist
then ZFS cache, if it&#39;s not there, then data is read from the disk into ARC cache, then data is mapped into mongod process address space as page cache. Using ZFS need more memory and when &lt;b&gt;all&lt;/b&gt; data cannot fit in
physical memory, there would be fights for memory between cachelist
and ZFS cache. Tweaking ZFS parameters (manually set ARC cache size, adjust &quot;primarycache&quot; property, etc) did not help in my tests. For read intensive workload, using SSD as 2nd-level ARC cache will help. In addition, depending the workload and data characteristics, adjusting ZFS recordsize or disabling ZFS prefetching may worth a try.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
An interesting madvise option for UFS
is  MADV_WILLNEED, when this option is set, the system will try to 
pull all data into the memory (quick warm) while during this period the mongod could not response to clients. So if your whole dataset
can fit into the physical memory and you can stand the short period of unresponsive to outside during startup, you can consider using it because it
warms fast and get peak performance quickly.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/3117062625277204054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2012/10/micro-benchmark-mongodb-22-performance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3117062625277204054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3117062625277204054'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2012/10/micro-benchmark-mongodb-22-performance.html' title='Micro Benchmark MongoDB 2.2 performance on Solaris '/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-3888217259839634177</id><published>2012-08-22T08:03:00.000-07:00</published><updated>2012-09-13T21:54:34.181-07:00</updated><title type='text'>Build CouchDB 1.2 on Solaris 11 (SPARC)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I want to play a little bit with Document-oriented DB. The first try was MongoDB, however, building MongoDB on SPARC is a horrible experience: MongoDB is written for x86/x64; in addition, it uses scons as its build tool and scons doesn&#39;t work with IPS-based Solaris Studio 12.3 (I need hack scons to make it work), in fact in MongoDB&#39;s source code, it never consider other compilers but VC and GCC. Therefore, I decided to try CouchDB. Allthough CouchDB has a lot of dependencies, but they are friendly for porting.&lt;br /&gt;
&lt;br /&gt;
1)&amp;nbsp;&lt;b&gt; ICU&lt;/b&gt; (International Components for Unicode)&lt;br /&gt;
This is easy on Solaris 11:&lt;br /&gt;
&lt;code&gt;# pkg install developer/icu &lt;/code&gt;(this will also cause library/icu to be installed)&lt;br /&gt;
Note: the ICU library 4.6 is built with Sun CC, so the C++ code that will link to it also should be built with Sun CC.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) &lt;b&gt;Build&lt;/b&gt; &lt;b&gt;Erlang&lt;/b&gt;&lt;br /&gt;
Solaris 11 11/11 IPS repository provides Erlang 5.6.5, this is too old. CouchDB 1.1.x or later requires Erlang &amp;gt;= 5.7.3. Although Erlang website says they do daily build for Solaris Sparc (may be because Ericsson was Sun&#39;s shop), but why don&#39;t they publish the binary package for Solaris? Fortunately, the build procedure is not that difficult:&lt;br /&gt;
&lt;br /&gt;
- Grab the source code from Erlang website. I chose &lt;a href=&quot;http://www.erlang.org/download/otp_src_R14B04.tar.gz&quot;&gt;14B04&lt;/a&gt; which version is 5.8.5.&lt;br /&gt;
&lt;br /&gt;
- &lt;code&gt;./configure --prefix=/opt/local &amp;nbsp;&lt;/code&gt;(I use default gcc-45 from Solaris 11 IPS repository, since it is said erlang uses some GCC features (label vars?).&lt;br /&gt;
Ignore configure warnings unless configure fails.&lt;br /&gt;
&lt;br /&gt;
- fix&lt;b&gt;&amp;nbsp;erts/emulator/drivers/common/inet_drv.c&lt;/b&gt;:&lt;br /&gt;
&lt;code&gt;ifreq.ifr_hwaddr.sa_data &lt;/code&gt;would cause compiling error because ifreq does not have that member. Since Solaris 11 has defined both&amp;nbsp; SIOCGIFHWADDR and SIOCGENADDR, we only need&amp;nbsp;SIOCGENADDR.&lt;br /&gt;
&lt;code&gt;
//#ifdef SIOCGIFHWADDR
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ioctl(desc-&amp;gt;s, SIOCGIFHWADDR, (char *)&amp;amp;ifreq) &amp;lt; 0)
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buf_check(sptr, s_end, 1+2+IFHWADDRLEN);
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *sptr++ = INET_IFOPT_HWADDR;
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put_int16(IFHWADDRLEN, sptr); sptr += 2;
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* raw memcpy (fix include autoconf later) */
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys_memcpy(sptr, (char*)(&amp;amp;ifreq.ifr_hwaddr.sa_data), 
IFHWADDRLEN);
&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sptr += IFHWADDRLEN;
&lt;br /&gt;//#elif defined(SIOCGENADDR)
&lt;br /&gt;#ifdef SIOCGENADDR&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;
- After gmake install, prepend &lt;b&gt;/opt/local/bin&lt;/b&gt; to PATH.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) &lt;b&gt;Build SpiderMonkey 1.8.5&lt;/b&gt;&lt;br /&gt;
- Download source code from &lt;a href=&quot;http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
- It&#39;s interesting that Mozilla&#39;s project need autoconf-2.13, so I had to build this old version.&lt;br /&gt;
Get the &lt;a href=&quot;http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz&quot;&gt;source&lt;/a&gt; from GNU webiste, then:&lt;br /&gt;
&lt;code&gt;./configure --prefix=/usr/local --program-suffix=-2.13&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt; &lt;/code&gt;
- Run autoconf in SpiderMonkey&#39;s source tree: to generate configure script.&lt;br /&gt;
&lt;code&gt;&amp;nbsp;cd&amp;nbsp;&amp;nbsp;js-1.8.5/js/src&lt;br /&gt;&amp;nbsp;/usr/local/bin/autoconf-2.13
&lt;/code&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;
-&amp;nbsp;This time I used Sun CC from&amp;nbsp;&lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CFsQFjAA&amp;amp;url=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fserver-storage%2Fsolarisstudio%2Fdownloads%2Findex.html&amp;amp;ei=pO80UIbRDqfniwKpwoDoCQ&amp;amp;usg=AFQjCNEHJyaPBu8oc8Y1VFdBKQYVP2D-gg&amp;amp;sig2=lwpGhqT2fgmDPWirjY6K-Q&quot;&gt;Solaris Studio 12.3&lt;/a&gt;&amp;nbsp;which is freely available.&lt;br /&gt;
&lt;code&gt;&amp;nbsp; &amp;nbsp;CC=cc CXX=CC ./configure&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
- gmake; sudo gmake install &amp;nbsp;(in /usr/local)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4)&lt;b&gt; Build CouchDB 1.2&lt;/b&gt;&lt;br /&gt;
Before proceeding, I need to fix something:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;-&amp;nbsp;&lt;b&gt;apache-couchdb-1.2.0/src/couchdb/priv/Makefile.in&lt;/b&gt;:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; replace &quot;-Wall -Werror&quot; with &quot;-v&quot; &amp;nbsp;because I use Sun CC.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;-&amp;nbsp;&lt;code&gt;cd /usr/local/lib;&amp;nbsp;ln -s libmozjs185.so.1.0 libmozjs185-1.0.so&lt;/code&gt;&lt;br /&gt;
(because configure.ac always choose&amp;nbsp;libmozjs185-1.0 instead of&amp;nbsp;libmozjs185 due to existence of&amp;nbsp;&amp;nbsp;libmozjs185-1.0.a)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;- apache-couchdb-1.2.0/src/snappy/google-snappy/snappy-stubs-internal.h&lt;/b&gt;:&lt;br /&gt;
solaris does not have byteswap.h, I replaced it with byteorder.h and defined a few macros.&lt;br /&gt;
&lt;code&gt;...
&lt;br /&gt;#else
&lt;br /&gt;//#include &lt;byteswap .h=&quot;.h&quot;&gt;
&lt;br /&gt;#include &lt;sys byteorder.h=&quot;byteorder.h&quot;&gt;
&lt;br /&gt;#define bswap_16(x) BSWAP_16(x)
&lt;br /&gt;#define bswap_32(x) BSWAP_32(x)
&lt;br /&gt;#define bswap_64(x) BSWAP_64(x)
&lt;br /&gt;....&lt;/sys&gt;&lt;/byteswap&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;code&gt;&lt;byteswap .h=&quot;.h&quot;&gt;&lt;sys byteorder.h=&quot;byteorder.h&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;- configure&lt;/span&gt;&lt;/sys&gt;&lt;/byteswap&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code&gt;
&amp;nbsp;./configure CC=cc CXX=CC LDFLAGS=&quot;-R /usr/local/lib&quot; --with-erlang=/opt/local/lib/erlang/usr/include --with-js-lib=/usr/local/lib/ --with-js-include=/usr/local/include/js/ --prefix=/opt/couchdb1.2&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;
- gmake&lt;br /&gt;
&lt;br /&gt;
- Run test:&lt;br /&gt;
&amp;nbsp; $ export PATH=/usr/perl5/5.12/bin:$PATH&lt;br /&gt;
&amp;nbsp; $ gmake check&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Wait for a while, all tests should be successful.&lt;br /&gt;
&lt;br /&gt;
- sudo gmake install&lt;br /&gt;
&lt;br /&gt;
-&amp;nbsp; create a script couchdb.sh in /opt/couchdb1.2/bin (since I don&#39;t want the couchdb output to be at arbitrary place).&lt;br /&gt;
#!/usr/bin/bash&lt;br /&gt;
BIN_DIR=$(dirname $0)&lt;br /&gt;
cd $BIN_DIR&lt;br /&gt;
./couchdb -o ../var/log/couchdb.stdout -e ../var/log/couchdb.stderr ${1+&quot;$@&quot;}&lt;br /&gt;
&lt;br /&gt;
- modify /opt/couchdb1.2/etc/couchdb/default.ini, change bind_address to let couchdb accessible from anywhere&lt;br /&gt;
&amp;nbsp; bind_address&amp;nbsp; = 0.0.0.0&lt;br /&gt;
&lt;br /&gt;
- start couchdb: /opt/couchdb1.2/bin/couchdb.sh -b&lt;br /&gt;
&lt;br /&gt;
Now, enjoy CouchDB!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;UPDATE (Sept 2012&lt;/b&gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;- I also tested Erlang 15B01 and latest 15B02, erts/emulator/drivers/common/inet_drv.c has already been fixed. But for building couchdb, we need to add something to /opt/local/lib/erlang/usr/include/erl_driver.h:&lt;br /&gt;
&amp;nbsp;#if defined(__sun)&lt;br /&gt;
#include  &amp;lt;unistd.h&amp;gt; &amp;nbsp;&amp;nbsp; /* for ssize_t */&lt;br /&gt;
#endif&lt;/div&gt;
&lt;br /&gt;
- Running couchdb testsuite in browser (Erlang 14B04 and 15B01) caused erlang process crash. I posted the core dump analysis and temporary workaround in &lt;a href=&quot;http://erlang.org/pipermail/erlang-bugs/2012-September/003040.html&quot;&gt;erlang mailing list&lt;/a&gt;. Using 15B02 doesn&#39;t have this problem, but still should be careful when the Erlang application on Solaris reloads crypto.so, see discussions &lt;a href=&quot;http://erlang.org/pipermail/erlang-bugs/2012-September/003050.html&quot;&gt;here&lt;/a&gt;. One solution might be adding &quot;-z nodelete&quot; LDFLAGS in lib/crypto/c_src/sparc-sun-solaris2.11/Makefile.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/3888217259839634177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2012/08/build-couchdb-12-on-solaris-11-sparc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3888217259839634177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3888217259839634177'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2012/08/build-couchdb-12-on-solaris-11-sparc.html' title='Build CouchDB 1.2 on Solaris 11 (SPARC)'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-4026952736603017419</id><published>2012-06-27T03:52:00.000-07:00</published><updated>2012-06-27T03:55:43.821-07:00</updated><title type='text'>root my phone</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Compared to PC users, the smart phone users have far less freedom. I bought an android 4.0.3 phone recently. My phone was pre-installed many apps that I don&#39;t like and could not delete, in addition I could not install apps from Goolge Play because this phone is sold in China market. To solve these problems, I have to get root permission on the phone.&lt;br /&gt;
&lt;br /&gt;
After a weekend study, I realized that a major way is to flash the phone using some 3rd party ROMs. I don&#39;t like this way . With further study, I searched out&amp;nbsp; a &lt;a href=&quot;http://blog.zx2c4.com/749&quot;&gt;Linux security bug&lt;/a&gt; by chance. This bug also impacted Android. A hacker has &lt;a href=&quot;https://github.com/saurik/mempodroid&quot;&gt;exploited&lt;/a&gt; it for android. This is really good news to me. However, it&#39;s not easy to figure out the offsets for my phone: I know nothing about ARM assembly; run-as is statically linked, stripped and symbols are obfuscated, making it difficult to understand the binary; I&amp;nbsp; installed binutils-arm-linux-gnueabi on my linux desktop but arm-linux-gnueabi-objdump does not give me useful info. &lt;br /&gt;
&lt;br /&gt;
In the end, I found 2 resources helped me a lot:&lt;br /&gt;
- &lt;a href=&quot;https://github.com/android/platform_system_core/blob/master/run-as/run-as.c&quot;&gt;android run-as source code&lt;/a&gt;&lt;br /&gt;
- &lt;a href=&quot;http://www.hex-rays.com/products/ida/support/download.shtml&quot;&gt;IDA Disassembler 6.2 demo&lt;/a&gt; for Linux (I should thank this great tool)&lt;br /&gt;
These two resources helped me understand the assembly codes of run-as. In addition, analyzing &lt;a href=&quot;http://forum.xda-developers.com/attachment.php?attachmentid=1027801&amp;amp;d=1335552246&quot;&gt;run-as binary of Transformer Prime 4.0.3&lt;/a&gt; helped me how to find the offsets for my phone because the Transformer Prime&#39;s offsets are already &lt;a href=&quot;https://github.com/saurik/mempodroid&quot;&gt;known&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining is simple:&lt;br /&gt;
- Download and install &lt;a href=&quot;http://dl.google.com/android/android-sdk_r18-linux.tgz&quot;&gt;android sdk&lt;/a&gt;&lt;br /&gt;
- run &quot;android&quot; from cmd line, add platform-tools for using adb.&lt;br /&gt;
- setup udev (for linux), follow &lt;a href=&quot;http://developer.android.com/guide/developing/device.html&quot;&gt;this guide&lt;/a&gt;. After making changes,&amp;nbsp; /etc/init.d/udev restart &lt;br /&gt;
Enable debugging mode and disabling fastboot on the phone. Connect to my phone using &quot;adb shell&quot; from Linux:&lt;br /&gt;
- push &quot;mempodroid&quot; to /data/local/tmp on the phone.&lt;br /&gt;
- run the magic &quot;mempodroid&quot;using the offsets that I figured out, become root!&lt;br /&gt;
- remount /system of the phone in read-write mode:&lt;br /&gt;
&amp;nbsp; mount -o remount,rw /system&lt;br /&gt;
- deleted un-wanted apps in /system/app, /system/delapp, be careful when being root! (before doing this, I had removed as many apps as possible from app manager of the phone). For safety, I backed up them to sdcard using &quot;cat&quot; in adb shell.&lt;br /&gt;
- To make Google Play work, I copied the following apks to /system/app:&lt;br /&gt;
&amp;nbsp; GoogleLoginService.apk&lt;br /&gt;
&amp;nbsp; GoogleServicesFramework.apk&lt;br /&gt;
&amp;nbsp; OneTimeInitializer.apk&lt;br /&gt;
&amp;nbsp; Vending.apk&lt;br /&gt;
&amp;nbsp; These apks could be accquired from &lt;a href=&quot;http://wiki.cyanogenmod.com/wiki/Latest_Version&quot;&gt;cyanogenmod website&lt;/a&gt;. &lt;br /&gt;
- Type &quot;reboot&quot; from adb shell.&lt;br /&gt;
&lt;br /&gt;
It&#39;s much better now. I prefer &quot;temporary root&quot;, it&#39;s safer.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/4026952736603017419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2012/06/root-my-phone.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/4026952736603017419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/4026952736603017419'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2012/06/root-my-phone.html' title='root my phone'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-1269473679856889154</id><published>2011-12-01T18:22:00.001-08:00</published><updated>2011-12-01T22:16:24.307-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="desktop"/><category scheme="http://www.blogger.com/atom/ns#" term="fonts"/><category scheme="http://www.blogger.com/atom/ns#" term="Solaris 11"/><title type='text'>Optimize fonts and memory on Solaris 11 desktop</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
Solaris 11 was released on Nov. 9th, 2011, this is the result of 7 years of huge engineering efforts since Solaris 10. Although Solaris is mainly designed for servers nowadays, Solaris is also good for desktop usage: ZFS, timeslider, DTrace, etc. Solaris 11 comes with GNOME 2.30 which is a very stable version (I&#39;m disappointed with GNOME 3 shell or Ubuntu Unity) and Nimbus theme (created by Sun) which is my favorite theme.&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
I made some changes to the default settings of Solaris 11 desktop to suit my needs.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Fonts &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
The most important part for the user experience on the desktop might be fonts. Different people have difference preferences on fonts and the same font has different effects on various font-size and screen resolutions, therefore I need take some time to test different fonts and find the appropriate ones for my desktop. In the end, I chose the following fonts for my desktop screen (20.1&quot;, 1600x1200 LCD): &quot;Nimbus Sans&quot; for English font,&amp;nbsp; &quot;WenQuanYi Micro Hei&quot; for Chinese font. Below are the steps for setup:&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;u&gt;Change&amp;nbsp; Desktop Appearance&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
Right click the desktop -&amp;gt; Desktop Appearance... -&amp;gt; Fonts, set the &lt;i&gt;Application, Document, Desktop, Window title&lt;/i&gt; font to &quot;Nimbus Sans&quot;, size &quot;10&quot; and set the &lt;i&gt;Fixed width&lt;/i&gt; font to &quot;Liberation Mono&quot;.&amp;nbsp; (Note: do not use Chinese fonts in Desktop Appearance, because some Chinese fonts at some sizes make &quot;i&quot; looks &quot;l&quot;)&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;u&gt;Install Chinese fonts.&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
Solaris 11&#39;s default Chinese font is &quot;AR PL ShanHeiSun Uni&quot; (文鼎PL細上海宋Uni),&amp;nbsp; which is a free, long history, high-quality font on Unix/Linux. But I want to use a more modern font.&amp;nbsp; Solaris 11 software repository include &quot;WenQuanYi Zen Hei&quot; font ( To view which fonts are available, open Package Manager -&amp;gt; System -&amp;gt; Fonts) , but I personally feel it does not fit my screen.&amp;nbsp; &quot;WenQuanYi Micro Hei&quot; is a better option.To install it: &lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Download from &lt;a href=&quot;http://wenq.org/index.cgi?Download#MicroHei_Beta&quot;&gt;here&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Unpack the downloaded file&lt;/li&gt;
&lt;li&gt;mkdir -p ~/.fonts &lt;/li&gt;
&lt;li&gt;Copy the &quot;wqy-microhei.ttc&quot; file to ~/.fonts &lt;/li&gt;
&lt;li&gt;(optional) Run &quot;fc-cache&quot; in terminal. &lt;/li&gt;
&lt;li&gt;To verify: run &quot;fc-list | grep WenQuanYi&quot;, you should see that.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;u&gt;Change the system fonts configuration&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The &quot;Sans-serif&quot;, &quot;Serif&quot; and &quot;Monospace&quot; fonts are mapped to the default system fonts in /etc/fonts, to customize it, I did:&lt;/div&gt;
&lt;ol style=&quot;font-family: Verdana,sans-serif; text-align: left;&quot;&gt;
&lt;li&gt;mkdir -p ~/.fonts.conf.d/&lt;/li&gt;
&lt;li&gt;cp /etc/fonts/conf.d/60-latin.conf ~/.fonts.conf.d/&lt;/li&gt;
&lt;li&gt;cp /etc/fonts/conf.d/65-nonlatin.conf ~/.fonts.conf.d/&lt;/li&gt;
&lt;li&gt;edit ~/.fonts.conf.d/60-latin.conf &lt;br /&gt;move Nimbus fonts to the front in each section so that &quot;serif&quot; maps to &quot;Nimbus Roman No9 L&quot;, &quot;sans-serif&quot; maps to &quot;Nimbus Sans L&quot;, and &quot;monospace&quot; maps to &quot;Liberation Mono&quot;.&lt;/li&gt;
&lt;li&gt;edit ~/.fonts.conf.d/65-nonlatin.conf&lt;br /&gt;add &quot;WenQuanYi Micro Hei&quot; before &quot;WenQuanYi Zen Hei&quot; for both &quot;serif&quot; and &quot;sans-serif&quot;,&amp;nbsp; and add &quot;WenQuanYi Micro Hei Mono&quot; before &quot;AR PL ShanHeiSun Uni&quot; for &quot;monospace&quot;.&lt;/li&gt;
&lt;li&gt;To verify: run &quot;fc-match sans&quot;, &quot;fc-match monospace&quot; and &quot;fc-match serif&quot; in terminal.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Memory&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
My x86 workstation has very limited memory, so I need to make changes to limit the unnecessary memory use. Here are options that you can do to save the memory:&lt;/div&gt;
&lt;ul style=&quot;font-family: Verdana,sans-serif; text-align: left;&quot;&gt;
&lt;li&gt;Desktop Appearance -&amp;gt; Visual Effects, choose &quot;None&quot;&lt;/li&gt;
&lt;li&gt;System -&amp;gt; Preferences -&amp;gt; File Management, disable &quot;Preview&quot;&lt;/li&gt;
&lt;li&gt;System -&amp;gt; Preferences -&amp;gt; File Indexing, disable &quot;indexing&quot;&lt;/li&gt;
&lt;li&gt;System -&amp;gt; Preferences -&amp;gt; Startup Applications, disable anything you don&#39;t want&lt;/li&gt;
&lt;li&gt;Only keep the necessary Applets on your task bar&lt;/li&gt;
&lt;li&gt;Check your and root cron jobs (sudo crontab -l), disable unnecessary jobs with &quot;crontab -e&quot;&lt;/li&gt;
&lt;li&gt;Check the SMF services using &quot;svcs&quot; command, disable unnecessary services with &quot;svcadm disable&quot; command&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/1269473679856889154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2011/12/optimize-fonts-and-memory-on-solaris-11.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/1269473679856889154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/1269473679856889154'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2011/12/optimize-fonts-and-memory-on-solaris-11.html' title='Optimize fonts and memory on Solaris 11 desktop'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-5255855762566977728</id><published>2011-11-16T18:12:00.001-08:00</published><updated>2011-11-16T19:16:28.956-08:00</updated><title type='text'>Cloud Foundry</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;A little background&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;https://github.com/cloudfoundry&quot;&gt;Cloud Foundry project&lt;/a&gt; is an open-source platform-as-a-service (PaaS) project initiated by VMware. &lt;a href=&quot;http://cloudfoundry.com/&quot;&gt;CloudFoundry.com&lt;/a&gt; is a VMware hosted, managed and supported PaaS environment. &lt;a href=&quot;https://www.cloudfoundry.com/micro&quot;&gt;Micro Cloud Foundry&lt;/a&gt; is a complete version of Cloud Foundry that runs in a virtual machine on a developer’s Mac or PC.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Try Cloud Foundry&lt;/b&gt;&lt;br /&gt;
There are 2 ways: install it from &lt;a href=&quot;https://github.com/cloudfoundry/vcap&quot;&gt;github&lt;/a&gt; or use Micro Cloud Foundry virtual machine image provided by cloudfoudry.com. The second method is relatively simple and requires an CloudFoundry.com account. Because I already have an account, I used the second method.&lt;br /&gt;
The testing was not very smooth by following &lt;a href=&quot;http://support.cloudfoundry.com/entries/20316811-micro-cloud-foundry-installation-setup&quot;&gt;Micro Cloud Foundry Quick Start guide&lt;/a&gt;. The major problem was the network issue: the VM image uses the bridged network, however, in my env, it bound to the wrong network physical adapter (you should be careful about this especially when you have multiple network adapters or you have Virtualbox installed). The cloud foundry setup didn&#39;t pointed out this problem. This caused me to use vcap.me as the domain.&lt;br /&gt;
To fix above issue, I need use the virtual network editor to change the binding from &lt;i&gt;automatic&lt;/i&gt; to a dedicated network adapter. The VMware player doesn&#39;t install the virtual network editor by default, I had to follow &lt;a href=&quot;http://bigsnowball.com/content/fixing-vmware-player-bridged-network&quot;&gt;this guide&lt;/a&gt; to manually extract the installation file (&lt;i&gt;VMware-player-xxxx.exe /e folder-name&lt;/i&gt;) , find the &lt;i&gt;network.cab&lt;/i&gt; and extract the &lt;b&gt;&lt;i&gt;vmnetcfg.exe&lt;/i&gt;&lt;/b&gt; and copy it to VMWare Player folder. (C:\Program Files (x86)\VMware\VMware Player).&lt;br /&gt;
Another issue is VCAP ROUTER: 404: after setting up the micro cloud, vmc command failed with below message: &lt;i&gt;Error (JSON 404): VCAP ROUTER: 404 - DESTINATION NOT FOUND &lt;/i&gt;I tried reconfiguring the domain in micro cloud setup menu, the problem was gone.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Thoughts&lt;/b&gt;&lt;br /&gt;
As for cloud computing, provisioning VM instances or application instances is relatively easy, the resource management is a challenge. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/5255855762566977728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2011/11/cloud-foundry.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/5255855762566977728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/5255855762566977728'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2011/11/cloud-foundry.html' title='Cloud Foundry'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-2857504713595243689</id><published>2011-10-28T01:21:00.000-07:00</published><updated>2013-05-07T19:28:29.969-07:00</updated><title type='text'>Build FBReader on Solaris</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
Here are my steps.&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;b&gt;Environment:&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
Solaris 11 Express x64&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
Gnome desktop&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
gcc-3.4.3&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
PATH=&lt;b&gt;/usr/sfw/bin:/usr/gnu/bin:&lt;/b&gt;/usr/bin:/bin &lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;b&gt;Step 1: Build the dependencies first&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;a href=&quot;http://fribidi.org/download/fribidi-0.10.9.tar.gz&quot;&gt;FriBidi-0.10.9&lt;/a&gt; ,&amp;nbsp; &lt;a href=&quot;http://sourceforge.net/projects/vimgadgets/files/liblinebreak/2.1/liblinebreak-2.1.tar.gz/download&quot;&gt;liblinebreak-2.1&lt;/a&gt; ,&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
$./configure; make; sudo make install&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
These libraries will be installed in /usr/local/lib&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;b&gt;Step 2: Build &lt;a href=&quot;http://www.fbreader.org/fbreader-sources-0.12.10.tgz&quot;&gt;FBReader-0.12.10&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
Need some hacks here. &lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
1) &lt;u&gt;makefiles/arch/desktop.mk&lt;/u&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13 CFLAGS = -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W -DLIBICONV_PLUG &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; color: #38761d;&quot;&gt;-DDO_ICONV_CAST&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14 LDFLAGS = &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; color: #38761d;&quot;&gt;-L /usr/local/lib -R /usr/local/lib&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
2)&lt;u&gt; fbreader/src/formats/fb2/FB2Reader.h&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&amp;nbsp;It seems &quot;_P&quot; had been defined somewhere and cause enum declaration errors.&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;div style=&quot;background-color: #fff2cc; font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23 #include &amp;lt;&lt;zlxmlreader .h=&quot;&quot;&gt;ZLXMLReader.h&lt;/zlxmlreader&gt;&amp;gt;&lt;br /&gt;
&lt;zlxmlreader .h=&quot;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24 &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25 &lt;span style=&quot;color: #38761d;&quot;&gt;#undef _P&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26 &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 27 class FB2Reader : public ZLXMLReader {&lt;/zlxmlreader&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
3) &lt;u&gt;zlibrary/core/src/unix/library/ZLibrary.cpp&lt;/u&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
Thanks to Rod Evans&#39; great &lt;a href=&quot;http://mail.opensolaris.org/pipermail/tools-linking/2010-July/000831.html&quot;&gt;catch&lt;/a&gt;, I added an extra dlerror() to make sure it returns NULL before calling dlsym().&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 128&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void (*initLibrary)();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 129&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc; color: #38761d;&quot;&gt;dlerror();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 130&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(void**)&amp;amp;initLibrary = dlsym(handle, &quot;initLibrary&quot;);&lt;/span&gt;&lt;/blockquote&gt;
4) make; sudo make install&lt;/div&gt;
&lt;div style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;
5) /usr/bin/FBReader &amp;amp;&amp;nbsp; (or run it from GNOME menu: start -&amp;gt; Office -&amp;gt;E-book reader)&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Have fun.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/2857504713595243689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2011/10/build-fbreader-on-solaris.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/2857504713595243689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/2857504713595243689'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2011/10/build-fbreader-on-solaris.html' title='Build FBReader on Solaris'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-7541909624960351700</id><published>2011-03-03T02:55:00.000-08:00</published><updated>2011-03-06T19:50:27.653-08:00</updated><title type='text'>crazy CSS, thanks DTrace</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I &lt;b&gt;hate&lt;/b&gt; many enterprise applications because of very unpleasant user experiences. Here&#39;s a recent example.&lt;br /&gt;
When I opened an application in firefox browser, my computer nearly hanged. Using basic Solaris commands prstat, mpstat, etc, I found displaying this page caused huge number of (40K) context switches per second.&lt;br /&gt;
At first, I thought it might be because of some ugly javascripts. So I first checked the source of this web page, well it contains several big java script files (sum up over 1MB), then I disabled the javascript in browser, however, the problem remained. I also tried offline browsing, it didn&#39;t solve the problem, so this is not a networking issue.&lt;br /&gt;
&lt;br /&gt;
What&#39;s wrong?&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;~# truss -c -p 1224&amp;nbsp; (#1244 is firefox process ID)&lt;br /&gt;
^C &lt;br /&gt;
syscall&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; seconds&amp;nbsp;&amp;nbsp; calls&amp;nbsp; errors &lt;br /&gt;
read&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .016&amp;nbsp;&amp;nbsp;&amp;nbsp; 3097&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 777 &lt;br /&gt;
write&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .022&amp;nbsp;&amp;nbsp;&amp;nbsp; 2126&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 &lt;br /&gt;
open&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 &lt;br /&gt;
close&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4 &lt;br /&gt;
fstat&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 &lt;br /&gt;
access&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 &lt;br /&gt;
ioctl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .005&amp;nbsp;&amp;nbsp;&amp;nbsp; 1145 &lt;br /&gt;
fdsync&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .003&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 &lt;br /&gt;
fcntl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6 &lt;br /&gt;
lwp_park&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .236&amp;nbsp;&amp;nbsp; 28575&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 330 &lt;br /&gt;
lwp_unpark&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .177&amp;nbsp;&amp;nbsp; 28340 &lt;br /&gt;
sigaction&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 52 &lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;
It looks like lwp_park/lwp_unpark are evils. Use a Dtrace script to find who caused this.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #cfe2f3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;~# cat lwp_park.d &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;#!/usr/sbin/dtrace -qs &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;syscall::lwp_park:entry &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i class=&quot;moz-txt-slash&quot;&gt;&lt;span class=&quot;moz-txt-tag&quot;&gt;/&lt;/span&gt;pid==$target&lt;span class=&quot;moz-txt-tag&quot;&gt;/&lt;/span&gt;&lt;/i&gt;&lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;@[ustack()]=count(); &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;END &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;trunc(@, 10); &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;} &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;background-color: #cfe2f3; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;./lwp_park.d -p 1244&lt;/span&gt;&lt;span style=&quot;background-color: #cfe2f3; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;Then switch to the problemed web page in firefox, go back to that terminal running DTrace, type Ctrl-C.&lt;br /&gt;
The DTrace output the user stacks for causing both lwp_park() and lwp_unpark() which is interesting. After demangling C++ symbols, I got:&lt;br /&gt;
&lt;blockquote&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`__lwp_unpark+0x19 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libnspr4.so`PR_Unlock+0x102 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  TimerThread::RemoveTimer(nsTimerImpl*)+0x7e &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned nsTimerImpl::Cancel()+0x32 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  imgContainer::FrameUpdated(unsigned,nsIntRect&amp;amp;)+0xbd &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`void row_callback(png_struct_def*,unsigned  char*,unsigned long,int)+0x187 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`MOZ_PNG_proc_IDAT_data+0x190 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`MOZ_PNG_process_data+0x4ce &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  ReadDataOut(nsIInputStream*,void*,const  char*,unsigned,unsigned,unsigned*)+0x8c &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  nsStringInputStream::ReadSegments(unsigned(*)(nsIInputStream*,void*,const  char*,unsigned,unsigned,unsigned*),void*,unsigned,unsigned*)+0x47 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  nsPNGDecoder::WriteFrom(nsIInputStream*,unsigned,unsigned*)+0x3a &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned imgContainer::ReloadImages()+0x339 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  imgContainer::GetCurrentFrameRect(nsIntRect&amp;amp;)+0x1a1 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  imgRequest::NotifyProxyListener(imgRequestProxy*)+0x10f &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned  imgRequestProxy::Clone(imgIDecoderObserver*,imgIRequest**)+0xe7 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned nsImageLoader::Load(imgIRequest*)+0x52 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;libxul.so`already_AddRefed&lt;nsimageloader&gt;nsImageLoader::Create(nsIFrame*,imgIRequest*,int,nsImageLoader*)+0x57 &lt;/nsimageloader&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`void  nsPresContext::SetupBackgroundImageLoaders(nsIFrame*,const  nsStyleBackground*)+0x98 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`void  nsCSSRendering::PaintBackgroundWithSC(nsPresContext*,nsIRenderingContext&amp;amp;,nsIFrame*,const  nsRect&amp;amp;,const nsRect&amp;amp;,const nsStyleBackground&amp;amp;,const  nsStyleBorder&amp;amp;,unsigned,nsRect*)+0x93f &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`void  nsCSSRendering::PaintBackground(nsPresContext*,nsIRenderingContext&amp;amp;,nsIFrame*,const  nsRect&amp;amp;,const nsRect&amp;amp;,unsigned,nsRect*)+0xea &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24658 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`__lwp_park+0x19 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`cond_wait_queue+0x60 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`cond_wait_common+0x1eb &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`__cond_timedwait+0x66 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`cond_timedwait+0x27 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`pthread_cond_timedwait+0x24 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libnspr4.so`PR_WaitCondVar+0x24a &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned TimerThread::Run()+0x11c &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`unsigned nsThread::ProcessNextEvent(int,int*)+0x121 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`int NS_ProcessNextEvent_P(nsIThread*,int)+0x2d &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libxul.so`void nsThread::ThreadFunc(void*)+0xa7 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libnspr4.so`_pt_root+0xe7 &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`_thrp_setup+0x9b &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; libc.so.1`_lwp_start &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26335&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;The stack of lwp_unpark() is often more interesting, because lwp_park() is usually caused by waiting for a condition variable which does not directly tell you what the application is waiting for. While if there are many lwp_park(), then there are many lwp_unpark() accordingly, so I looked at lwp_unpark() stack. I&#39;m not a browser expert, from the function name, the firefox seemed to do rendering background based on CSS.&amp;nbsp; Then I checked the CSS file which size is 150KB, Damn, there&#39;re &lt;b&gt;571&lt;/b&gt; occurences like below:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #fce5cd; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{background: url(../xxx/yyy/zzz.png)}&amp;nbsp; &lt;/div&gt;&lt;br /&gt;
Then I wanted to check how many times&amp;nbsp; nsCSSRendering::PaintBackground() was called by using another DTrace script.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;From:&lt;br /&gt;
&lt;div style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;libxul.so`void  nsCSSRendering::PaintBackground(nsPresContext*,nsIRenderingContext&amp;amp;,nsIFrame*,const  nsRect&amp;amp;,const nsRect&amp;amp;,unsigned,nsRect*)+0xea&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;blockquote style=&quot;background-color: #cfe2f3;&quot;&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;#!/usr/sbin/dtrace -s &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;pid$target:libxul:__1cOnsCSSRenderingPPaintBackground6FpnNnsPresContext_rnTnsIRenderingContext_pnInsIFrame_rknGnsRect_9AIp7_v_:&lt;b&gt;ea &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;@ =count(); &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Ran this DTrace script, and switched to the problemed web page in firefox. this time DTrace output:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;~# ./pid.d -p 1244 &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;dtrace: script &#39;./pid.d&#39; matched 1 probe &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;^C &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 422 &lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;It indicated rendering this web page caused the firefox painted background &lt;b&gt;422&lt;/b&gt; times (via X window), crazy!!! On the other hand, it looks like firefox&#39;s libxul.so should be improved when it renders these images. It caused about 25,000 context switches. Is it because that rendering the images is in asynchronous way and the rendered data are in local memory or on fast network so that context switches occurred so fast?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Workaround&lt;/b&gt;: In firefox settings, Preference -&amp;gt; Contents -&amp;gt; Load images automatically -&amp;gt; Exceptions -&amp;gt; add this website to block list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/7541909624960351700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2011/03/crazy-css-thanks-dtrace.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/7541909624960351700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/7541909624960351700'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2011/03/crazy-css-thanks-dtrace.html' title='crazy CSS, thanks DTrace'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-2310228018991127325</id><published>2010-10-26T03:17:00.000-07:00</published><updated>2010-10-26T03:17:07.853-07:00</updated><title type='text'>JiuZhai_HuangLong</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;a href=&quot;http://www.jiuzhai.com/&quot;&gt;JiuZhai&lt;/a&gt; and &lt;a href=&quot;http://www.huanglong.com/&quot;&gt;HuangLong&lt;/a&gt; are my wife&#39;s dream vacation places for years. This October we finally embarked on the journey. The cost of 3-days trip was very high (even more expensive than some overseas travel), but the view is very beutiful and unique. More photos taken by me can be found &lt;a href=&quot;http://www.flickr.com/photos/xinfengliu/sets/72157625244558198/&quot;&gt;here&lt;/a&gt;, &lt;a href=&quot;http://www.flickr.com/photos/xinfengliu/sets/72157625244386426/&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1153/5116627155_61f3d85f85_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1153/5116627155_61f3d85f85_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1214/5116657307_56ae04f902_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1214/5116657307_56ae04f902_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1102/5117202050_5b17124bdb_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1102/5117202050_5b17124bdb_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm5.static.flickr.com/4151/5117260772_fc77728ede_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm5.static.flickr.com/4151/5117260772_fc77728ede_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1318/5116657139_6f30eb40ea_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1318/5116657139_6f30eb40ea_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1359/5117230360_55bb0b0ffd_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1359/5117230360_55bb0b0ffd_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1388/5116660973_c738799578_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1388/5116660973_c738799578_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1059/5116597343_9e19735079_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1059/5116597343_9e19735079_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/2310228018991127325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/10/jiuzhaihuanglong.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/2310228018991127325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/2310228018991127325'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/10/jiuzhaihuanglong.html' title='JiuZhai_HuangLong'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://farm2.static.flickr.com/1153/5116627155_61f3d85f85_t.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-8487074127987638450</id><published>2010-09-02T03:26:00.000-07:00</published><updated>2010-09-02T23:04:07.752-07:00</updated><title type='text'>Sun set in China</title><content type='html'>Sun, my favorite brand.&lt;br /&gt;
Sun, my favorite logo.&lt;br /&gt;
Sun, the best engineering culture I have met with.&lt;br /&gt;
Sun, the most important career experience for me.&lt;br /&gt;
Sun, set in China on August 31st, 2010. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm5.static.flickr.com/4150/4950464987_e3e3592c89.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;241&quot; src=&quot;http://farm5.static.flickr.com/4150/4950464987_e3e3592c89.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/8487074127987638450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/09/sun-set-in-china.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/8487074127987638450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/8487074127987638450'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/09/sun-set-in-china.html' title='Sun set in China'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://farm5.static.flickr.com/4150/4950464987_e3e3592c89_t.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-1647396906384096905</id><published>2010-07-18T07:30:00.001-07:00</published><updated>2010-07-18T07:31:13.134-07:00</updated><title type='text'>MeeGo!</title><content type='html'>I don&#39;t want to use my laptop provided by the company any more: 1) it&#39;s 4 years old. 2) overheating problem. I decided to buy a device with my own money. I don&#39;t want to invest much because any computer becomes out of dated very soon. The requirement are: light, fast to start, energy efficient. iPad is not my choice because I need do some coding occasionally.&lt;br /&gt;
&lt;br /&gt;
Finally I chose a netbook ViewSonic VNB 102p, it is based on Intel N450 Atom platform, the price is reasonable (less than RMB2000). I evaluated several OSes and installed MeeGo and Ubuntu Remix 10.04, these are designed for netbooks. Amazingly, all devices work out of box on these 2 OSes.&lt;br /&gt;
&lt;br /&gt;
When I started to use this new netbook, I found I spent more time on MeeGo than Ubuntu. It might be because everything is fine on Ubuntu but I need some time to make some applications work on Meego. And Meego looks more simple, faster to start. I installed and customized thunderbird (for mail), openoffice 3.2.1 and skype (for voice chat), compiled Shrew (for VPN) and Shotwell 0.6.1 (for managing photos and online albums). Now I have used it for one month and this netbook can meet my demands for daily use.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/1647396906384096905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/07/meego.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/1647396906384096905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/1647396906384096905'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/07/meego.html' title='MeeGo!'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-6830810552379488556</id><published>2010-06-17T20:17:00.000-07:00</published><updated>2010-06-17T20:22:19.937-07:00</updated><title type='text'>Why flying east takes shorter time</title><content type='html'>I&#39;m not a frequent traveler. Some years ago I found flying from west of U.S to east U.S. took 1 hour less time than return trip, I didn&#39;t find answer at that time. Recently I decided to investigate this by the help of google search.&lt;br /&gt;
&lt;br /&gt;
The answer is simple: &lt;a href=&quot;http://www.aerospaceweb.org/question/dynamics/q0027.shtml&quot;&gt;WIND&lt;/a&gt; . But wait, why do most people in the world find flying east takes shorter time, does the wind over Earth surface always flies east? Then I studied some flights schedule around the equator such as Singapore to Tokyo and some flights in South America, there&#39;s no significant difference in flying time between goes and come-backs.&amp;nbsp;After I read some articles, below factors should be considered:&lt;br /&gt;
&lt;br /&gt;
- &lt;a href=&quot;http://www.aerospaceweb.org/question/atmosphere/q0117.shtml&quot;&gt;Wind and Earth Rotation&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Prevailing_winds&quot;&gt;Prevailing Winds&lt;/a&gt; .&amp;nbsp; You know the directions of the winds in different areas of the world.&lt;br /&gt;
&lt;br /&gt;
- The locations of most cities with flights. Open the world map, you can find the much more cities are located between lattitude 30 and 60, in this area, the direction of wind is from the west to the east.&lt;br /&gt;
&lt;br /&gt;
- You should consider long distance flights (&amp;gt;3 hours), otherwise the airplane may not spend most of time at cruise speed, and many other factors (such as reserving time for air traffic control) can affect the flying time.&lt;br /&gt;
&lt;br /&gt;
- &lt;a href=&quot;http://en.wikipedia.org/wiki/Coriolis_effect&quot;&gt;Coriolis&lt;/a&gt; effect. Yes, it affects the direction of the wind and it also &lt;a href=&quot;http://www.uwsp.edu/geo/faculty/heywood/GEOG101/pressure/index.htm&quot;&gt;affects the trails of airplanes&lt;/a&gt;, i.e. when the airplane flies from low lattitude to high lattitude, the plane will be deflected to the east. However, Coriolis itself nearly does not affect the differences of flying time between goes and come-backs. For example, if you fly northwest from Singapore to North Eurpoe, the real flying distance may be longer than you imagine from the map, the return trip is also longer.&lt;br /&gt;
&lt;br /&gt;
Am I right? I&#39;m not 100% sure. I&#39;m just trying to explain the reason :)</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/6830810552379488556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/06/why-flying-east-takes-shorter-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6830810552379488556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6830810552379488556'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/06/why-flying-east-takes-shorter-time.html' title='Why flying east takes shorter time'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-7632253421270620257</id><published>2010-05-13T23:31:00.000-07:00</published><updated>2010-05-13T23:31:24.576-07:00</updated><title type='text'>10 years later, Beijing</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1263/4605385603_a9e689c1d5_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1263/4605385603_a9e689c1d5_m.jpg&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://farm2.static.flickr.com/1051/4605385563_162c58c767_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm2.static.flickr.com/1051/4605385563_162c58c767_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;It has been nearly 10 years since I moved away from Beijing. In end of April 2010,I took a vacation with my family in Beijing. A lot of changes took place in 10 years: more people, more subways, soaring house prices... We visited some famous places, the Square, the Great Wall, Beijing Zoo, etc. Nice feeling.I love vacations more and more...</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/7632253421270620257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/05/10-years-later-beijing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/7632253421270620257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/7632253421270620257'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/05/10-years-later-beijing.html' title='10 years later, Beijing'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://farm2.static.flickr.com/1263/4605385603_a9e689c1d5_t.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-2429835377176733693</id><published>2010-04-18T03:31:00.000-07:00</published><updated>2010-04-18T03:37:48.438-07:00</updated><title type='text'>Strugling with the partition table</title><content type='html'>I hate to use MS Windows: 1) insecure 2) dog slow after patching for years. Recently I decided to try Solaris Express or the new OpenSolaris. The first step is to leave some space for Solaris partition, so I deleted a Windows partition. &lt;br /&gt;
&lt;br /&gt;
Now the partition table looks like:&lt;br /&gt;
&lt;br /&gt;
| Free (for solaris) | Ubuntu | Windows | extened partition including several ntfs and linux swap|&lt;br /&gt;
&lt;br /&gt;
Unfortunately, after I installed the solaris, both the existing Windows and Ubuntu failed to boot. For Windows, the error message is: &quot;&lt;span style=&quot;color: purple;&quot;&gt;&lt;windows root=&quot;&quot;&gt;Windows\System32\ntoskrnl.exe&lt;/windows&gt;&lt;/span&gt; is missing&quot;, for Ubuntu, it jumped to grub command&amp;nbsp; directly.&lt;br /&gt;
&lt;br /&gt;
I guess the reason was probably the partition number changed. I logged into Solaris, run &lt;span style=&quot;color: blue;&quot;&gt;format&lt;/span&gt; -&amp;gt; &lt;span style=&quot;color: blue;&quot;&gt;fdisk&lt;/span&gt; command, the result is below:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Partition&amp;nbsp;&amp;nbsp; Status&amp;nbsp;&amp;nbsp;&amp;nbsp; Type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Start&amp;nbsp;&amp;nbsp; End&amp;nbsp;&amp;nbsp; Length&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =========&amp;nbsp;&amp;nbsp; ======&amp;nbsp;&amp;nbsp;&amp;nbsp; ============&amp;nbsp; =====&amp;nbsp;&amp;nbsp; ===&amp;nbsp;&amp;nbsp; ======&amp;nbsp;&amp;nbsp; ===&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Linux native&amp;nbsp;&amp;nbsp; 2551&amp;nbsp; 5099&amp;nbsp;&amp;nbsp;&amp;nbsp; 2549&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFS: NTFS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5100&amp;nbsp; 7011&amp;nbsp;&amp;nbsp;&amp;nbsp; 1912&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXT LBA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7012&amp;nbsp; 12160&amp;nbsp;&amp;nbsp;&amp;nbsp; 5149&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 42&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Active&amp;nbsp;&amp;nbsp;&amp;nbsp; Solaris2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp; 2550&amp;nbsp;&amp;nbsp;&amp;nbsp; 2550&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&lt;br /&gt;
&lt;br /&gt;
then use &lt;span style=&quot;color: blue;&quot;&gt;ntfscat&lt;/span&gt; to show the content of &lt;span style=&quot;color: purple;&quot;&gt;boot.ini &lt;/span&gt;of Windows partition:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;bash-4.0# ntfscat /dev/dsk/c1d0p2 boot.ini&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
[boot loader]&lt;br /&gt;
timeout=5&lt;br /&gt;
default=multi(0)disk(0)rdisk(0)partition(&lt;span style=&quot;color: red;&quot;&gt;1&lt;/span&gt;)\WINDOWS&lt;br /&gt;
[operating systems]&lt;br /&gt;
multi(0)disk(0)rdisk(0)partition(&lt;span style=&quot;color: red;&quot;&gt;1&lt;/span&gt;)\WINDOWS=&quot;Microsoft Windows XP Home Edition&quot; /noexecute=optin /fastdetect&lt;br /&gt;
C:\Ubuntu81.img=&quot;Ubuntu 8.10&quot;&lt;br /&gt;
&lt;br /&gt;
You can see the partition number &quot;1&quot; is not correct since the Windows partition number has changed to &quot;2&quot;. So to fix it: make a new boot.ini (also need &lt;span style=&quot;color: blue;&quot;&gt;unix2dos&lt;/span&gt; command to add &quot;/r&quot; for Windows), then overide it on Windows: &lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;ntfscp /dev/dsk/c1d0p2 ./newboot.ini boot.ini&lt;/span&gt;&lt;br /&gt;
Also, change the &lt;span style=&quot;color: purple;&quot;&gt;/rpool/boot/grub/menu.lst&lt;/span&gt; to correct the partition numbers to:&lt;br /&gt;
...&lt;br /&gt;
title Windows&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootnoverify (hd0,1)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chainloader +1&lt;br /&gt;
title Ubuntu8.1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootnoverify (hd0,0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chainloader +1&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Reboot the system, I can start Windows normally.&lt;br /&gt;
&lt;br /&gt;
Next, for Ubuntu problem, I need to get the content of Ubuntu grub menu.lst. Solaris currently does not have built-in supports for linux ext2/ext3 file system. I need to install some packages by following &lt;a href=&quot;http://hub.opensolaris.org/bin/view/Project+ext3/Quick+howto%20&quot;&gt;the guide&lt;/a&gt;, then, mount the Ubuntu partition:&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;mount -F ext2fs /dev/dsk/c1d0p1 /mnt&lt;/span&gt;&lt;br /&gt;
and got the content of Ubuntu grub menu.lst:&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
title&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ubuntu 8.10, kernel 2.6.27-14-generic&lt;br /&gt;
uuid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2786d26c-beb2-43e6-93a8-1cb3be921f23&lt;br /&gt;
kernel&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /boot/vmlinuz-2.6.27-14-generic root=UUID=2786d26c-beb2-43e6-93a8-1cb3be921f23 ro quiet splash&lt;br /&gt;
initrd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /boot/initrd.img-2.6.27-14-generic&lt;br /&gt;
quiet&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reboot the system, select to boot Ubuntu in Solaris&#39;s grub menu, I was prompted to enter grub command. I tried to manually input: root (hd0,0) and the content of &quot;Kernel....&quot;, &quot;initrd....&quot;, then boot command, however, the system failed to boot up in the process. &lt;br /&gt;
&lt;br /&gt;
So there must be somthing wrong with the Ubuntu&#39;s grub (My Ubuntu&#39;s grub was installed in Ubuntu&#39;s partition not the MBR), it seems I need to re-install the grub:&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;grub&amp;gt; root (hd0,0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;grub&amp;gt; install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 p&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;grub&amp;gt; boot &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: blue;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
O.K. The problem is resolved.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Lessons:&lt;/b&gt;&lt;br /&gt;
Don&#39;t delete a partition then create a new partition, it would possibly cause the partition numbers to change, making all things suck.</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/2429835377176733693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/04/strugling-with-partition-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/2429835377176733693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/2429835377176733693'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/04/strugling-with-partition-table.html' title='Strugling with the partition table'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-8677093192134321906</id><published>2010-04-03T21:47:00.000-07:00</published><updated>2010-04-05T19:35:00.872-07:00</updated><title type='text'>Shanghai Flower Port</title><content type='html'>This spring comes so late. At China traditional QingMing holiday, my family went to Shanghai Flower Port. The park is famous for tulips and other flowers. It&#39;s located at faraway and seaside suburb of Shanghai, about 70km from downtown. The ticket price is RMB100, and free for little children. In this park, I can feel much fresher air and see beatuiful flowers.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm5.static.flickr.com/4027/4486352109_688ea3566b.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;http://farm5.static.flickr.com/4027/4486352109_688ea3566b.jpg&quot; width=&quot;214&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://farm3.static.flickr.com/2720/4486349099_dbb66ceb19.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;214&quot; src=&quot;http://farm3.static.flickr.com/2720/4486349099_dbb66ceb19.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
For more photos, see &lt;a href=&quot;http://www.flickr.com/photos/xinfengliu/sets/72157623636594113/&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/8677093192134321906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/04/shanghai-flower-port.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/8677093192134321906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/8677093192134321906'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/04/shanghai-flower-port.html' title='Shanghai Flower Port'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://farm5.static.flickr.com/4027/4486352109_688ea3566b_t.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-390083460271981610</id><published>2010-03-17T00:56:00.000-07:00</published><updated>2010-03-17T00:56:51.864-07:00</updated><title type='text'>Send SOS to twitter in one button</title><content type='html'>Nowadays location based applications become more and more popular. Maybe the simplest location based app is sending emergency message with your location. For example, if you go to a place with potential risk, when the accident happens, you might not have enough time to send SMS or make a call to tell where you are exactly.&lt;br /&gt;
My little project &lt;b&gt;ttlite&lt;/b&gt; is for this: you can preset your SOS message and turn on GPS on your phone, in case the accident happens, you just push one button to send SOS with your location to twitter. You have known about twitter&#39;s great power in spreading messages instantly, right?&lt;br /&gt;
It is here: &lt;a href=&quot;http://code.google.com/p/ttlite/&quot;&gt;http://code.google.com/p/ttlite/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/390083460271981610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/03/send-sos-to-twitter-in-one-button.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/390083460271981610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/390083460271981610'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/03/send-sos-to-twitter-in-one-button.html' title='Send SOS to twitter in one button'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-5019238021409658235</id><published>2010-02-13T05:10:00.000-08:00</published><updated>2010-02-13T05:10:28.685-08:00</updated><title type='text'>This winter in Shanghai</title><content type='html'>Last night it was very cold, this morning I found the wall behind the curtain was wet because of the cendensed moisture in the warm room.&lt;br /&gt;
It&#39;s sunny today, I went to a park nearby with my family.Suddenly we found ice slush, it&#39;s the first time I saw it in Shanghai. Very interesting. The photos are here:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://farm5.static.flickr.com/4034/4352875479_3b427a2db5_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm5.static.flickr.com/4034/4352875479_3b427a2db5_m.jpg&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://farm5.static.flickr.com/4054/4352875571_12d397e7bd_m.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://farm5.static.flickr.com/4054/4352875571_12d397e7bd_m.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/5019238021409658235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/this-winter-in-shanghai.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/5019238021409658235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/5019238021409658235'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/this-winter-in-shanghai.html' title='This winter in Shanghai'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://farm5.static.flickr.com/4034/4352875479_3b427a2db5_t.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-6810445084435542732</id><published>2010-02-09T01:49:00.000-08:00</published><updated>2010-02-09T01:49:53.910-08:00</updated><title type='text'>JavaFX colorlines game (on JavaFX 1.2)</title><content type='html'>&lt;div style=&quot;font-family: inherit;&quot;&gt;One of good things at Sun is that there are always new technologies to play with, even if it&#39;s not related to my daily job. In November, 2008, I did a simple &lt;a href=&quot;http://developers.sun.com.cn/blog/lxf/entry/javafx_color_lines_game&quot;&gt;implementation&lt;/a&gt; of &lt;a href=&quot;http://en.wikipedia.org/wiki/Color_Lines&quot;&gt;colorlines game&lt;/a&gt; with JavaFX, of course it runs on JavaFX 1.0.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;Over one year passed, I know there&#39;s a lot of changes from JavaFX 1.0 to JavaFX 1.2. So today I decided to upgrade it. Fortunately, I don&#39;t need change one line of codes, it passed&amp;nbsp; compilation with JavaFX1.2 on Netbeans 6.8.&amp;nbsp; However, it had problem during runtime on Windows XP: running as applet is O.K., but running as web start did not show anything. Then I changed to ubuntu linux and opensolaris, everything worked fine. I checked the source codes and Java debug console, but could not find any clue, It&#39;s so weird.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;Anyway, JavaFX 1.2 showed faster than JavaFX 1.0. I put the codes to &lt;a href=&quot;http://code.google.com/p/javafxcolorlinesgame/&quot;&gt;Google Code&lt;/a&gt;. If anybody can point out the problem I will&amp;nbsp; appreciate that&amp;nbsp; very much.&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; font-family: inherit; text-align: center;&quot;&gt;&lt;a href=&quot;http://dl.dropbox.com/u/3871143/JavaFXColorLinesGame.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;http://dl.dropbox.com/u/3871143/JavaFXColorLinesGame.png&quot; width=&quot;256&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/6810445084435542732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/javafx-colorlines-game-on-javafx-12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6810445084435542732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6810445084435542732'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/javafx-colorlines-game-on-javafx-12.html' title='JavaFX colorlines game (on JavaFX 1.2)'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-6642808320216248848</id><published>2010-02-04T23:57:00.000-08:00</published><updated>2010-02-04T23:59:46.560-08:00</updated><title type='text'>The best tribute I&#39;ve ever read about Sun Microsystems</title><content type='html'>This was written by &lt;a href=&quot;http://twitter.com/jimparkinson&quot;&gt;@jimparkinson&lt;/a&gt; on his &lt;a href=&quot;http://blogs.sun.com/jpblog/&quot;&gt;blog&lt;/a&gt; : &lt;br /&gt;
&lt;div style=&quot;color: red;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://blogs.sun.com/jpblog/entry/tomorrow_the_sun_will_rise&quot;&gt;Today The Sun will Rise&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/6642808320216248848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/best-tribute-ive-ever-read-about-sun.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6642808320216248848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/6642808320216248848'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/best-tribute-ive-ever-read-about-sun.html' title='The best tribute I&#39;ve ever read about Sun Microsystems'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5527241191615022462.post-3913100718836827071</id><published>2010-02-04T01:19:00.000-08:00</published><updated>2010-02-04T01:21:23.168-08:00</updated><title type='text'>About this blog (why I am here)</title><content type='html'>I had several blogs, &lt;a href=&quot;http://developers.sun.com.cn/blog/lxf/&quot;&gt;SDN China&lt;/a&gt;, &lt;a href=&quot;http://lxf2008.spaces.live.com/&quot;&gt;msn live spaces&lt;/a&gt;, &lt;a href=&quot;http://lxf.javaeye.com/&quot;&gt;javaeye&lt;/a&gt;, and &lt;a href=&quot;http://blogs.sun.com/lxf/&quot;&gt;Sun blog&lt;/a&gt;. Due to various reasons (company rules, privacy protection, censorship, etc), I emptied or discontinued them.&lt;br /&gt;
Currently I decide to use blogspot.com as my blog site because it&#39;s free (free of charge and free to speak, no censorship), although blogspot.com is blocked by some countries, which means the users need to work around the firewall to read/write blogs on blogspot.com.</content><link rel='replies' type='application/atom+xml' href='http://xinfengliu.blogspot.com/feeds/3913100718836827071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/about-this-blog-why-i-am-here.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3913100718836827071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5527241191615022462/posts/default/3913100718836827071'/><link rel='alternate' type='text/html' href='http://xinfengliu.blogspot.com/2010/02/about-this-blog-why-i-am-here.html' title='About this blog (why I am here)'/><author><name>Xinfeng Liu</name><uri>http://www.blogger.com/profile/03020769296645745856</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>