[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.