|
|
|
|
|
|
|
|
|
|
xen-api
Re: [Xen-API] [PATCH] CA-45104: renice gzip so that it is nice to the ot
Hi Marcus,
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
|
|
|
|
|