WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] a question about popen() performance on domU

To: "xuehai zhang" <hai@xxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: RE: [Xen-devel] a question about popen() performance on domU
From: "Petersson, Mats" <mats.petersson@xxxxxxx>
Date: Thu, 24 Nov 2005 11:07:51 +0100
Cc: Tim Freeman <tfreeman@xxxxxxxxxxx>, Kate Keahey <keahey@xxxxxxxxxxx>
Delivery-date: Thu, 24 Nov 2005 10:08:36 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcXwbGQKagUtYfysRQOV+ndP/cKNJwAbydWw
Thread-topic: [Xen-devel] a question about popen() performance on domU
I did have a look at popen, and essentially, it does the following [ the
real code is MUCH more complicated, doing lots of open/dup/close on
pipes and stuff]:
if (!fork())
 exec("/bin/sh", "sh", "-c", cmd, NULL); 

The fork creates another process, which then executes the /bin/sh, which
again causes another fork/exec to take place in the effort of executing
the actual command given. 

So the major component of popen would be fork() and execl(), both of
which cause, amongst other things, a lot of page-table work and
task-switching. 

Note that popen is implemented in glibc [I took the 2.3.6 source code
from www.gnu.org for my look at this], so there's no difference in the
implementation of popen itself - the difference lies in how the Linux
kernel handles fork() and exec(), but maybe more importantly, how
task-switches and page-tables are handled in Linux native and Xen-Linux.
Because Xen keeps track of the page-tables on top of Linux's handling of
page-tables, you get some extra work here. So, it should really be
slower on Xen than on native Linux. 

[In fact, the question came up not so long ago, why Xen was SLOWER than
native Linux on popen (and some others) in a particular benchmark, and
the result of that investigation was that it's down to, mainly,
task-switching takes longer in Xen.]

The reason it is not would probably have something to do with the
differences in hardware on Linux vs. Xen platforms, perhaps the fact
that your file-system is a virtual block-device and thus lives inside a
file that is perhaps better cached or otherwise handled in a different
way on the Xen-system. 

Now, I'm not saying that there isn't a possibility that something is
managed differently in Xen that makes this run faster - I just don't
really see how that would be likely, since everything that happens in
the system is going to be MORE complicated by the extra layer of Xen
involved. 

If anyone else has some thoughts on this subject, it would be
interesting to hear.

--
Mats


> -----Original Message-----
> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of 
> xuehai zhang
> Sent: 23 November 2005 20:26
> To: xen-devel@xxxxxxxxxxxxxxxxxxx
> Cc: Tim Freeman; Kate Keahey
> Subject: [Xen-devel] a question about popen() performance on domU
> 
> Dear all,
> When I compared the performance of some application on both a 
> Xen domU and a standard linux machine (where domU runs on a 
> similar physical mahine), I notice the application runs 
> faster on the domU than on the physical machine. 
> Instrumenting the application code shows the application 
> spends more time on popen() calls on domU than on the 
> physical machine. I wonder if  xenlinux does some special 
> modification of the popen code to improve its performance 
> than the original Linux popen code?
> Thanks in advance for your help.
> Xuehai
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
> 
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel