MINOR: applet: assign the same nice value to a new appctx as its owner task
authorWilly Tarreau <w@1wt.eu>
Thu, 31 May 2018 12:44:25 +0000 (14:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 Jun 2018 09:18:21 +0000 (11:18 +0200)
When an applet is created, let's assign it the same nice value as the task
of the stream which owns it. It ensures that fairness is properly propagated
to applets, and that the CLI can regain a low latency behaviour again. Huge
differences have been seen under extreme loads, with the CLI being called
every 200 microseconds instead of 11 milliseconds.

include/proto/stream_interface.h

index ee1fa12..3ecfa01 100644 (file)
@@ -302,8 +302,10 @@ static inline struct appctx *si_alloc_appctx(struct stream_interface *si, struct
 
        si_release_endpoint(si);
        appctx = appctx_new(applet, tid_bit);
-       if (appctx)
+       if (appctx) {
                si_attach_appctx(si, appctx);
+               appctx->t->nice = si_strm(si)->task->nice;
+       }
 
        return appctx;
 }