kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: Fix rootfs name resolving when specified with image
@ 2011-12-15 12:15 Sasha Levin
  2011-12-15 12:15 ` [PATCH 2/2] kvm tools: Submit multiple virtio-blk requests in parallel Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2011-12-15 12:15 UTC (permalink / raw)
  To: penberg; +Cc: mingo, gorcunov, asias.hejun, kvm, Sasha Levin

Fix the case when using a rootfs combined with a virtio-blk disk.

Also, simplify custon rootfs name lookup.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/builtin-run.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index 0879ab9..e6751aa 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -87,6 +87,7 @@ static const char *script;
 static const char *guest_name;
 static const char *sandbox;
 static const char *hugetlbfs_path;
+static const char *custom_rootfs_name = "default";
 static struct virtio_net_params *net_params;
 static bool single_step;
 static bool readonly_image[MAX_DISK_IMAGES];
@@ -151,6 +152,7 @@ static int img_name_parser(const struct option *opt, const char *arg, int unset)
 			die("Unable to initialize virtio 9p");
 		kvm_setup_resolv(arg);
 		using_rootfs = custom_rootfs = 1;
+		custom_rootfs_name = arg;
 		return 0;
 	}
 
@@ -738,18 +740,13 @@ void kvm_run_help(void)
 static int kvm_custom_stage2(void)
 {
 	char tmp[PATH_MAX], dst[PATH_MAX], *src;
-	const char *rootfs;
+	const char *rootfs = custom_rootfs_name;
 	int r;
 
 	src = realpath("guest/init_stage2", NULL);
 	if (src == NULL)
 		return -ENOMEM;
 
-	if (image_filename[0] == NULL)
-		rootfs = "default";
-	else
-		rootfs = image_filename[0];
-
 	snprintf(tmp, PATH_MAX, "%s%s/virt/init_stage2", kvm__get_dir(), rootfs);
 	remove(tmp);
 
@@ -762,12 +759,9 @@ static int kvm_custom_stage2(void)
 
 static int kvm_run_set_sandbox(void)
 {
-	const char *guestfs_name = "default";
+	const char *guestfs_name = custom_rootfs_name;
 	char path[PATH_MAX], script[PATH_MAX], *tmp;
 
-	if (image_filename[0])
-		guestfs_name = image_filename[0];
-
 	snprintf(path, PATH_MAX, "%s%s/virt/sandbox.sh", kvm__get_dir(), guestfs_name);
 
 	remove(path);
@@ -976,8 +970,8 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
 	if (!using_rootfs && !image_filename[0]) {
 		char tmp[PATH_MAX];
 
-		kvm_setup_create_new("default");
-		kvm_setup_resolv("default");
+		kvm_setup_create_new(custom_rootfs_name);
+		kvm_setup_resolv(custom_rootfs_name);
 
 		snprintf(tmp, PATH_MAX, "%s%s", kvm__get_dir(), "default");
 		if (virtio_9p__register(kvm, tmp, "/dev/root") < 0)
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] kvm tools: Submit multiple virtio-blk requests in parallel
  2011-12-15 12:15 [PATCH 1/2] kvm tools: Fix rootfs name resolving when specified with image Sasha Levin
@ 2011-12-15 12:15 ` Sasha Levin
  2011-12-16 14:57   ` Asias He
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2011-12-15 12:15 UTC (permalink / raw)
  To: penberg; +Cc: mingo, gorcunov, asias.hejun, kvm, Sasha Levin

When using AIO, submit all requests which exists in the vring in a single
io_submit instead of one io_submit for each descriptor.

Benchmarks:

Short version: 15%+ increase in IOPS, small increase in BW.

Read IOPS:
Before:
  vda: ios=291792/0, merge=0/0, ticks=35229/0, in_queue=31025, util=61.30%

After:
  vda: ios=333114/0, merge=0/0, ticks=47983/0, in_queue=46630, util=62.22%

Write IOPS:
Before:
  vda: ios=0/271716, merge=0/0, ticks=0/33367, in_queue=26531, util=59.96%

After:
  vda: ios=0/327485, merge=0/0, ticks=0/23789, in_queue=22475, util=55.74%

Read BW:
Before:
   READ: io=7526.0MB, aggrb=1246.3MB/s, minb=1275.1MB/s, maxb=1275.1MB/s, mint=6040msec, maxt=6040msec
After:
   READ: io=7526.0MB, aggrb=1315.5MB/s, minb=1346.7MB/s, maxb=1346.7MB/s, mint=5723msec, maxt=5723msec

Write BW:
Before:
  WRITE: io=7526.0MB, aggrb=1110.2MB/s, minb=1136.9MB/s, maxb=1136.9MB/s, mint=6779msec, maxt=6779msec

After:
  WRITE: io=7526.0MB, aggrb=1113.5MB/s, minb=1140.3MB/s, maxb=1140.3MB/s, mint=6759msec, maxt=6759msec

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/disk/core.c              |    2 -
 tools/kvm/disk/raw.c               |   38 +++++++++++++++++++++++++++++------
 tools/kvm/include/kvm/disk-image.h |    8 +++++-
 tools/kvm/util/read-write.c        |    8 +-----
 tools/kvm/virtio/blk.c             |    3 ++
 5 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/tools/kvm/disk/core.c b/tools/kvm/disk/core.c
index 4915efd..b18014e 100644
--- a/tools/kvm/disk/core.c
+++ b/tools/kvm/disk/core.c
@@ -5,8 +5,6 @@
 #include <sys/eventfd.h>
 #include <sys/poll.h>
 
-#define AIO_MAX 32
-
 int debug_iodelay;
 
 #ifdef CONFIG_HAS_AIO
diff --git a/tools/kvm/disk/raw.c b/tools/kvm/disk/raw.c
index caa023c..1162fb7 100644
--- a/tools/kvm/disk/raw.c
+++ b/tools/kvm/disk/raw.c
@@ -10,9 +10,9 @@ ssize_t raw_image__read_sector(struct disk_image *disk, u64 sector, const struct
 	u64 offset = sector << SECTOR_SHIFT;
 
 #ifdef CONFIG_HAS_AIO
-	struct iocb iocb;
+	struct iocb *iocb = &disk->iocb[disk->count++];
 
-	return aio_preadv(disk->ctx, &iocb, disk->fd, iov, iovcount, offset,
+	return aio_preadv(disk->ctx, iocb, disk->fd, iov, iovcount, offset,
 				disk->evt, param);
 #else
 	return preadv_in_full(disk->fd, iov, iovcount, offset);
@@ -25,9 +25,9 @@ ssize_t raw_image__write_sector(struct disk_image *disk, u64 sector, const struc
 	u64 offset = sector << SECTOR_SHIFT;
 
 #ifdef CONFIG_HAS_AIO
-	struct iocb iocb;
+	struct iocb *iocb = &disk->iocb[disk->count++];
 
-	return aio_pwritev(disk->ctx, &iocb, disk->fd, iov, iovcount, offset,
+	return aio_pwritev(disk->ctx, iocb, disk->fd, iov, iovcount, offset,
 				disk->evt, param);
 #else
 	return pwritev_in_full(disk->fd, iov, iovcount, offset);
@@ -79,19 +79,33 @@ int raw_image__close(struct disk_image *disk)
 
 	close(disk->evt);
 
-#ifdef CONFIG_HAS_VIRTIO
+#ifdef CONFIG_HAS_AIO
 	io_destroy(disk->ctx);
 #endif
 
 	return ret;
 }
 
+static int raw_image__aio_submit(struct disk_image *disk)
+{
+	int ret;
+
+	ret = io_submit(disk->ctx, disk->count, disk->iocb_ptrs);
+	if (ret > 0)
+		disk->count = 0;
+
+	return ret;
+}
+
 /*
  * multiple buffer based disk image operations
  */
 static struct disk_image_operations raw_image_regular_ops = {
 	.read_sector	= raw_image__read_sector,
 	.write_sector	= raw_image__write_sector,
+#ifdef CONFIG_HAS_AIO
+	.submit		= raw_image__aio_submit,
+#endif
 };
 
 struct disk_image_operations ro_ops = {
@@ -120,8 +134,13 @@ struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonly)
 
 			disk = disk_image__new(fd, st->st_size, &ro_ops_nowrite, DISK_IMAGE_REGULAR);
 #ifdef CONFIG_HAS_AIO
-			if (disk)
+			if (disk) {
+				int i;
+
 				disk->async = 1;
+				for (i = 0; i < AIO_MAX; i++)
+					disk->iocb_ptrs[i] = &disk->iocb[i];
+			}
 #endif
 		}
 
@@ -132,8 +151,13 @@ struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonly)
 		 */
 		disk = disk_image__new(fd, st->st_size, &raw_image_regular_ops, DISK_IMAGE_REGULAR);
 #ifdef CONFIG_HAS_AIO
-		if (disk)
+		if (disk) {
+			int i;
+
 			disk->async = 1;
+			for (i = 0; i < AIO_MAX; i++)
+				disk->iocb_ptrs[i] = &disk->iocb[i];
+		}
 #endif
 		return disk;
 	}
diff --git a/tools/kvm/include/kvm/disk-image.h b/tools/kvm/include/kvm/disk-image.h
index 56c08da..6eba950 100644
--- a/tools/kvm/include/kvm/disk-image.h
+++ b/tools/kvm/include/kvm/disk-image.h
@@ -20,14 +20,14 @@
 
 #define SECTOR_SHIFT		9
 #define SECTOR_SIZE		(1UL << SECTOR_SHIFT)
+#define AIO_MAX			256
+#define MAX_DISK_IMAGES         4
 
 enum {
 	DISK_IMAGE_REGULAR,
 	DISK_IMAGE_MMAP,
 };
 
-#define MAX_DISK_IMAGES         4
-
 struct disk_image;
 
 struct disk_image_operations {
@@ -37,6 +37,7 @@ struct disk_image_operations {
 				int iovcount, void *param);
 	int (*flush)(struct disk_image *disk);
 	int (*close)(struct disk_image *disk);
+	int (*submit)(struct disk_image *disk);
 };
 
 struct disk_image {
@@ -50,6 +51,9 @@ struct disk_image {
 	int				evt;
 #ifdef CONFIG_HAS_AIO
 	io_context_t			ctx;
+	struct iocb			iocb[AIO_MAX];
+	struct iocb			*iocb_ptrs[AIO_MAX];
+	u32				count;
 #endif
 };
 
diff --git a/tools/kvm/util/read-write.c b/tools/kvm/util/read-write.c
index 55473ba..4ccd554 100644
--- a/tools/kvm/util/read-write.c
+++ b/tools/kvm/util/read-write.c
@@ -321,24 +321,20 @@ ssize_t pwritev_in_full(int fd, const struct iovec *iov, int iovcnt, off_t offse
 int aio_pwritev(io_context_t ctx, struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt,
 		off_t offset, int ev, void *param)
 {
-	struct iocb *ios[1] = { iocb };
-
 	io_prep_pwritev(iocb, fd, iov, iovcnt, offset);
 	io_set_eventfd(iocb, ev);
 	iocb->data = param;
 
-	return io_submit(ctx, 1, ios);
+	return 0;
 }
 
 int aio_preadv(io_context_t ctx, struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt,
 		off_t offset, int ev, void *param)
 {
-	struct iocb *ios[1] = { iocb };
-
 	io_prep_preadv(iocb, fd, iov, iovcnt, offset);
 	io_set_eventfd(iocb, ev);
 	iocb->data = param;
 
-	return io_submit(ctx, 1, ios);
+	return 0;
 }
 #endif
\ No newline at end of file
diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index d1a0197..153b11b 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -128,6 +128,9 @@ static void virtio_blk_do_io(struct kvm *kvm, struct virt_queue *vq, struct blk_
 
 		virtio_blk_do_io_request(kvm, req);
 	}
+
+	if (bdev->disk->ops->submit)
+		bdev->disk->ops->submit(bdev->disk);
 }
 
 static void set_config(struct kvm *kvm, void *dev, u8 data, u32 offset)
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] kvm tools: Submit multiple virtio-blk requests in parallel
  2011-12-15 12:15 ` [PATCH 2/2] kvm tools: Submit multiple virtio-blk requests in parallel Sasha Levin
@ 2011-12-16 14:57   ` Asias He
  2011-12-18 19:42     ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Asias He @ 2011-12-16 14:57 UTC (permalink / raw)
  To: Sasha Levin; +Cc: penberg, mingo, gorcunov, kvm

On 12/15/2011 08:15 PM, Sasha Levin wrote:
> When using AIO, submit all requests which exists in the vring in a single
> io_submit instead of one io_submit for each descriptor.
> 
> Benchmarks:
> 
> Short version: 15%+ increase in IOPS, small increase in BW.
> 
> Read IOPS:
> Before:
>   vda: ios=291792/0, merge=0/0, ticks=35229/0, in_queue=31025, util=61.30%

I guess you are reading the wrong IOPS number, the 'ios' is the number
of ios performed by all groups, not the IOPS result. Find the 'iops' ;-)

So, Here is the number without/with this patch.

(seq-read, seq-write, rand-read, rand-write)

Before:
  read : io=98304KB, bw=63015KB/s, iops=15753, runt=  1560msec
  write: io=98304KB, bw=56823KB/s, iops=14205, runt=  1730msec
  read : io=98304KB, bw=62139KB/s, iops=15534, runt=  1582msec
  write: io=98304KB, bw=53836KB/s, iops=13458, runt=  1826msec

After:
  read : io=98304KB, bw=63096KB/s, iops=15774, runt=  1558msec
  write: io=98304KB, bw=55823KB/s, iops=13955, runt=  1761msec
  read : io=98304KB, bw=59148KB/s, iops=14787, runt=  1662msec
  write: io=98304KB, bw=55072KB/s, iops=13768, runt=  1785msec

Submit more io requests in one time is not supposed to increase the iops
or bw so dramatically.

I even tried to submit all read/write ops in one io_submit which still
ends up with very little iops or bw improvement.

> 
> After:
>   vda: ios=333114/0, merge=0/0, ticks=47983/0, in_queue=46630, util=62.22%
> 
> Write IOPS:
> Before:
>   vda: ios=0/271716, merge=0/0, ticks=0/33367, in_queue=26531, util=59.96%
> 
> After:
>   vda: ios=0/327485, merge=0/0, ticks=0/23789, in_queue=22475, util=55.74%
> 
> Read BW:
> Before:
>    READ: io=7526.0MB, aggrb=1246.3MB/s, minb=1275.1MB/s, maxb=1275.1MB/s, mint=6040msec, maxt=6040msec
> After:
>    READ: io=7526.0MB, aggrb=1315.5MB/s, minb=1346.7MB/s, maxb=1346.7MB/s, mint=5723msec, maxt=5723msec
> 
> Write BW:
> Before:
>   WRITE: io=7526.0MB, aggrb=1110.2MB/s, minb=1136.9MB/s, maxb=1136.9MB/s, mint=6779msec, maxt=6779msec
> 
> After:
>   WRITE: io=7526.0MB, aggrb=1113.5MB/s, minb=1140.3MB/s, maxb=1140.3MB/s, mint=6759msec, maxt=6759msec
> 
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>  tools/kvm/disk/core.c              |    2 -
>  tools/kvm/disk/raw.c               |   38 +++++++++++++++++++++++++++++------
>  tools/kvm/include/kvm/disk-image.h |    8 +++++-
>  tools/kvm/util/read-write.c        |    8 +-----
>  tools/kvm/virtio/blk.c             |    3 ++
>  5 files changed, 42 insertions(+), 17 deletions(-)
> 
> diff --git a/tools/kvm/disk/core.c b/tools/kvm/disk/core.c
> index 4915efd..b18014e 100644
> --- a/tools/kvm/disk/core.c
> +++ b/tools/kvm/disk/core.c
> @@ -5,8 +5,6 @@
>  #include <sys/eventfd.h>
>  #include <sys/poll.h>
>  
> -#define AIO_MAX 32
> -
>  int debug_iodelay;
>  
>  #ifdef CONFIG_HAS_AIO
> diff --git a/tools/kvm/disk/raw.c b/tools/kvm/disk/raw.c
> index caa023c..1162fb7 100644
> --- a/tools/kvm/disk/raw.c
> +++ b/tools/kvm/disk/raw.c
> @@ -10,9 +10,9 @@ ssize_t raw_image__read_sector(struct disk_image *disk, u64 sector, const struct
>  	u64 offset = sector << SECTOR_SHIFT;
>  
>  #ifdef CONFIG_HAS_AIO
> -	struct iocb iocb;
> +	struct iocb *iocb = &disk->iocb[disk->count++];
>  
> -	return aio_preadv(disk->ctx, &iocb, disk->fd, iov, iovcount, offset,
> +	return aio_preadv(disk->ctx, iocb, disk->fd, iov, iovcount, offset,
>  				disk->evt, param);
>  #else
>  	return preadv_in_full(disk->fd, iov, iovcount, offset);
> @@ -25,9 +25,9 @@ ssize_t raw_image__write_sector(struct disk_image *disk, u64 sector, const struc
>  	u64 offset = sector << SECTOR_SHIFT;
>  
>  #ifdef CONFIG_HAS_AIO
> -	struct iocb iocb;
> +	struct iocb *iocb = &disk->iocb[disk->count++];
>  
> -	return aio_pwritev(disk->ctx, &iocb, disk->fd, iov, iovcount, offset,
> +	return aio_pwritev(disk->ctx, iocb, disk->fd, iov, iovcount, offset,
>  				disk->evt, param);
>  #else
>  	return pwritev_in_full(disk->fd, iov, iovcount, offset);
> @@ -79,19 +79,33 @@ int raw_image__close(struct disk_image *disk)
>  
>  	close(disk->evt);
>  
> -#ifdef CONFIG_HAS_VIRTIO
> +#ifdef CONFIG_HAS_AIO
>  	io_destroy(disk->ctx);
>  #endif
>  
>  	return ret;
>  }
>  
> +static int raw_image__aio_submit(struct disk_image *disk)
> +{
> +	int ret;
> +
> +	ret = io_submit(disk->ctx, disk->count, disk->iocb_ptrs);
> +	if (ret > 0)
> +		disk->count = 0;
> +
> +	return ret;
> +}
> +
>  /*
>   * multiple buffer based disk image operations
>   */
>  static struct disk_image_operations raw_image_regular_ops = {
>  	.read_sector	= raw_image__read_sector,
>  	.write_sector	= raw_image__write_sector,
> +#ifdef CONFIG_HAS_AIO
> +	.submit		= raw_image__aio_submit,
> +#endif
>  };
>  
>  struct disk_image_operations ro_ops = {
> @@ -120,8 +134,13 @@ struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonly)
>  
>  			disk = disk_image__new(fd, st->st_size, &ro_ops_nowrite, DISK_IMAGE_REGULAR);
>  #ifdef CONFIG_HAS_AIO
> -			if (disk)
> +			if (disk) {
> +				int i;
> +
>  				disk->async = 1;
> +				for (i = 0; i < AIO_MAX; i++)
> +					disk->iocb_ptrs[i] = &disk->iocb[i];
> +			}
>  #endif
>  		}
>  
> @@ -132,8 +151,13 @@ struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonly)
>  		 */
>  		disk = disk_image__new(fd, st->st_size, &raw_image_regular_ops, DISK_IMAGE_REGULAR);
>  #ifdef CONFIG_HAS_AIO
> -		if (disk)
> +		if (disk) {
> +			int i;
> +
>  			disk->async = 1;
> +			for (i = 0; i < AIO_MAX; i++)
> +				disk->iocb_ptrs[i] = &disk->iocb[i];
> +		}
>  #endif
>  		return disk;
>  	}
> diff --git a/tools/kvm/include/kvm/disk-image.h b/tools/kvm/include/kvm/disk-image.h
> index 56c08da..6eba950 100644
> --- a/tools/kvm/include/kvm/disk-image.h
> +++ b/tools/kvm/include/kvm/disk-image.h
> @@ -20,14 +20,14 @@
>  
>  #define SECTOR_SHIFT		9
>  #define SECTOR_SIZE		(1UL << SECTOR_SHIFT)
> +#define AIO_MAX			256
> +#define MAX_DISK_IMAGES         4
>  
>  enum {
>  	DISK_IMAGE_REGULAR,
>  	DISK_IMAGE_MMAP,
>  };
>  
> -#define MAX_DISK_IMAGES         4
> -
>  struct disk_image;
>  
>  struct disk_image_operations {
> @@ -37,6 +37,7 @@ struct disk_image_operations {
>  				int iovcount, void *param);
>  	int (*flush)(struct disk_image *disk);
>  	int (*close)(struct disk_image *disk);
> +	int (*submit)(struct disk_image *disk);
>  };
>  
>  struct disk_image {
> @@ -50,6 +51,9 @@ struct disk_image {
>  	int				evt;
>  #ifdef CONFIG_HAS_AIO
>  	io_context_t			ctx;
> +	struct iocb			iocb[AIO_MAX];
> +	struct iocb			*iocb_ptrs[AIO_MAX];
> +	u32				count;
>  #endif
>  };
>  
> diff --git a/tools/kvm/util/read-write.c b/tools/kvm/util/read-write.c
> index 55473ba..4ccd554 100644
> --- a/tools/kvm/util/read-write.c
> +++ b/tools/kvm/util/read-write.c
> @@ -321,24 +321,20 @@ ssize_t pwritev_in_full(int fd, const struct iovec *iov, int iovcnt, off_t offse
>  int aio_pwritev(io_context_t ctx, struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt,
>  		off_t offset, int ev, void *param)
>  {
> -	struct iocb *ios[1] = { iocb };
> -
>  	io_prep_pwritev(iocb, fd, iov, iovcnt, offset);
>  	io_set_eventfd(iocb, ev);
>  	iocb->data = param;
>  
> -	return io_submit(ctx, 1, ios);
> +	return 0;
>  }
>  
>  int aio_preadv(io_context_t ctx, struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt,
>  		off_t offset, int ev, void *param)
>  {
> -	struct iocb *ios[1] = { iocb };
> -
>  	io_prep_preadv(iocb, fd, iov, iovcnt, offset);
>  	io_set_eventfd(iocb, ev);
>  	iocb->data = param;
>  
> -	return io_submit(ctx, 1, ios);
> +	return 0;
>  }
>  #endif
> \ No newline at end of file
> diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
> index d1a0197..153b11b 100644
> --- a/tools/kvm/virtio/blk.c
> +++ b/tools/kvm/virtio/blk.c
> @@ -128,6 +128,9 @@ static void virtio_blk_do_io(struct kvm *kvm, struct virt_queue *vq, struct blk_
>  
>  		virtio_blk_do_io_request(kvm, req);
>  	}
> +
> +	if (bdev->disk->ops->submit)
> +		bdev->disk->ops->submit(bdev->disk);
>  }
>  
>  static void set_config(struct kvm *kvm, void *dev, u8 data, u32 offset)


-- 
Asias He

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] kvm tools: Submit multiple virtio-blk requests in parallel
  2011-12-16 14:57   ` Asias He
@ 2011-12-18 19:42     ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2011-12-18 19:42 UTC (permalink / raw)
  To: Asias He; +Cc: penberg, mingo, gorcunov, kvm

On Fri, 2011-12-16 at 22:57 +0800, Asias He wrote:
> On 12/15/2011 08:15 PM, Sasha Levin wrote:
> > When using AIO, submit all requests which exists in the vring in a
> single
> > io_submit instead of one io_submit for each descriptor.
> > 
> > Benchmarks:
> > 
> > Short version: 15%+ increase in IOPS, small increase in BW.
> > 
> > Read IOPS:
> > Before:
> >   vda: ios=291792/0, merge=0/0, ticks=35229/0, in_queue=31025,
> util=61.30%
> 
> I guess you are reading the wrong IOPS number, the 'ios' is the number
> of ios performed by all groups, not the IOPS result. Find the
> 'iops' ;-)
> 
> So, Here is the number without/with this patch.
> 
> (seq-read, seq-write, rand-read, rand-write)
> 
> Before:
>   read : io=98304KB, bw=63015KB/s, iops=15753, runt=  1560msec
>   write: io=98304KB, bw=56823KB/s, iops=14205, runt=  1730msec
>   read : io=98304KB, bw=62139KB/s, iops=15534, runt=  1582msec
>   write: io=98304KB, bw=53836KB/s, iops=13458, runt=  1826msec
> 
> After:
>   read : io=98304KB, bw=63096KB/s, iops=15774, runt=  1558msec
>   write: io=98304KB, bw=55823KB/s, iops=13955, runt=  1761msec
>   read : io=98304KB, bw=59148KB/s, iops=14787, runt=  1662msec
>   write: io=98304KB, bw=55072KB/s, iops=13768, runt=  1785msec
> 
> Submit more io requests in one time is not supposed to increase the
> iops
> or bw so dramatically.
> 
> I even tried to submit all read/write ops in one io_submit which still
> ends up with very little iops or bw improvement. 

Did you test it vs /dev/shm?

These are the results I see from the same test:
Before:
	read : io=1157.7MB, bw=118110KB/s, iops=29527 , runt= 10037msec
	write: io=1083.6MB, bw=110867KB/s, iops=27716 , runt= 10008msec
After:
	read : io=1304.4MB, bw=133337KB/s, iops=33334 , runt= 10017msec
	write: io=1292.4MB, bw=132087KB/s, iops=33021 , runt= 10019msec

-- 

Sasha.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-18 17:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15 12:15 [PATCH 1/2] kvm tools: Fix rootfs name resolving when specified with image Sasha Levin
2011-12-15 12:15 ` [PATCH 2/2] kvm tools: Submit multiple virtio-blk requests in parallel Sasha Levin
2011-12-16 14:57   ` Asias He
2011-12-18 19:42     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).