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

Re: [Xen-API] [PATCH] CA-45104: renice gzip so that it is nice to the other dom0 processes


  • To: Marcus Granado <marcus.granado@xxxxxxxxxx>
  • From: Lucas de Souza Santos <lucasdss@xxxxxxxxx>
  • Date: Fri, 24 Sep 2010 19:57:43 -0300
  • Cc: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 24 Sep 2010 15:58:27 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=x6QF9OF2VIWE61/4cuJB1CkuQ8bKqB3r4bxcI+Y67eF32tNNrp4IOMmcH2/kbqtSWO y4VhrEw9oGNR1GLjR5dkne9vKUe9k/x/YAJ2pXfizH7ciZbN8pVUNliqbBUlEoSiD70o Pd6Mttkpug9/pnwq+Bh5OTCmBTVyRXq7j12iY=
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

Hi Marcus,

Did you take a look at http://www.zlib.net/pigz/ ?
I did the same idea of your patch here, but I exchanged gzip for pigz because it showed a good performance improvement. 

Regards,

Lucas de Souza Santos (ldss)


On Fri, Sep 17, 2010 at 7:16 AM, Marcus Granado <marcus.granado@xxxxxxxxxx> wrote:
 stdext/gzip.ml |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)


# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1284397485 -3600
# Node ID 2095ed131b6343e0a08406246705e793aecd5ee7
# Parent  164f63521e8262f541059a13a7f1d4d5f5ed7f2b
CA-45104: renice gzip so that it is nice to the other dom0 processes

Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>

diff -r 164f63521e82 -r 2095ed131b63 stdext/gzip.ml
--- a/stdext/gzip.ml
+++ b/stdext/gzip.ml
@@ -28,6 +28,20 @@
  | Active  (** we provide a function which writes into the compressor and a fd output *)
  | Passive (** we provide an fd input and a function which reads from the compressor *)

+(* renice/ionice the pid with lowest priority so that it doesn't *)
+(* use up all cpu resources in dom0 *)
+let lower_priority pid =
+  let pid=Printf.sprintf "%d" (Forkhelpers.getpid pid) in
+  (* renice 19 -p pid *)
+  let renice="/usr/bin/renice" in
+  let renice_args = ["19";"-p";pid] in
+  let _=Forkhelpers.execute_command_get_output renice renice_args in
+  (* ionice -c 3 [idle] -p pid *)
+  let ionice="/usr/bin/ionice" in
+  let ionice_args = ["-c";"3";"-p";pid] in
+  let _=Forkhelpers.execute_command_get_output ionice ionice_args in
+  ()
+
 (** Runs a zcat process which is either:
    i) a compressor; or (ii) a decompressor
    and which has either
@@ -57,8 +71,11 @@
              zcat_out in                                 (* close this before waitpid *)
        let pid = Forkhelpers.safe_close_and_exec stdin stdout None [] gzip args in
        close close_now;
-        finally
-          (fun () -> f close_later)
+   finally
+     (fun () ->
+       lower_priority pid;  (* lowest priority to gzip *)
+       f close_later
+     )
          (fun () ->
             let failwith_error s =
               let mode = if mode = Compress then "Compression" else "Decompression" in

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

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