On Mon, Apr 05, 2004 at 02:30:56PM +0100, Christoph Hellwig wrote:
> > The VM shows better results than the host. What gives? Perhaps
> > it is because of the combination of the host and guest's buffer
> > cache? I'd like to know about more percise benchmarking methods
> > for VMs.
> How are the virtual disks for the VM implemented? If you're doing
> direct I/O these numbers are indeed strange. If not OTOH that's
> expected because even synchronous I/O in the guest is actually
> async which makes it a lot faster.
The virtual block device driver in coLinux, named cobd, is synchronous
with the host OS highest level read()/write() functions, which
means e.g. for a READ block I/O request in the guest,
filp->f_op->read() is called on an open 'struct file' in the host.
If the call blocks, the entire guest VM blocks on it.
So, according to this, any type of I/O in the guest means synchronous
I/O in the host unless the data is already in the guest's buffer cache.
It's not really the implementation I am planning to stick to, but
it sure was very easy to implement.
BTW, the block device on the host side can be a file or any
device that exposes read()/write() interfaces to userspace. In
this benchmarking case it is a 3GB file that hosts an image of
an ext3 filesystem.