You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Walt Karas <wk...@verizonmedia.com.INVALID> on 2021/02/08 23:46:17 UTC
Proposed performance improvement of tagged debug output
https://github.com/apache/trafficserver/pull/7452
This PR changes TS API. It introduces this new type:
typedef struct TSFDbgCtl_s {
char volatile on; // Flag
char const *tag;
} TSFDbgCtl;
And this function:
tsapi TSFDbgCtl const *TSFDbgCtlCreate(char const *tag);
And this new printf-like macro:
#define TSFDbg(ctlp, ...)
Where the first parameter is a pointer returned by TSFDbgCtlCreate(), the
second a printf format string, and the rest the parameters referenced the
format string.
In my performance test, enabling the new type of debug output resulted in a
10% reduction in requests per second handled, versus a 95% reduction due to
enabling the old type of debug output. (See
https://gist.github.com/ywkaras/4b0386341a4a6ce0afacaf46dcce79d6 )
If we decide to proceed with this, I think we have two options:
1. Proceed with the approach where enabling low-overhead debug output
will only work for Debug()/TSFDbg calls that use a DbgCtl/TSDbgCtl instance
rather than a simple tag string. This would include adding doc changes and
Au testing.
2. Switch to an approach similar to what I used for testing. Where
Debug() calls and is_debug_tag_set() will (each) generate a hidden instance
of DbgCtl. I think I can also make TSDebug() generate a hidden pointer to
TSFDbgCt.
Re: [E] Proposed performance improvement of tagged debug output
Posted by Susan Hinrichs <sh...@verizonmedia.com.INVALID>.
Sounds encouraging. I would suggest going with option 2. Otherwise,
very few people will bother learning the new, higher performance
interface.
On Mon, Feb 8, 2021 at 5:46 PM Walt Karas
<wk...@verizonmedia.com.invalid> wrote:
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache_trafficserver_pull_7452&d=DwIBaQ&c=sWW_bEwW_mLyN3Kx2v57Q8e-CRbmiT9yOhqES_g_wVY&r=GAqM_xZpxNbVqsR-aGvQBjOG3d33Y2-i4ynL-JkEouY&m=T3uKuRdXuJZJ3DyMoQBcYkbjgx3A0sYIMfodLs6GqEo&s=bHquMyBVeX-FU8jZM7jR_NnfBCUBghgDxLgfL9ZvzVU&e=
>
> This PR changes TS API. It introduces this new type:
>
> typedef struct TSFDbgCtl_s {
> char volatile on; // Flag
> char const *tag;
> } TSFDbgCtl;
>
> And this function:
>
> tsapi TSFDbgCtl const *TSFDbgCtlCreate(char const *tag);
>
> And this new printf-like macro:
>
> #define TSFDbg(ctlp, ...)
>
> Where the first parameter is a pointer returned by TSFDbgCtlCreate(), the
> second a printf format string, and the rest the parameters referenced the
> format string.
>
> In my performance test, enabling the new type of debug output resulted in a
> 10% reduction in requests per second handled, versus a 95% reduction due to
> enabling the old type of debug output. (See
> https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.github.com_ywkaras_4b0386341a4a6ce0afacaf46dcce79d6&d=DwIBaQ&c=sWW_bEwW_mLyN3Kx2v57Q8e-CRbmiT9yOhqES_g_wVY&r=GAqM_xZpxNbVqsR-aGvQBjOG3d33Y2-i4ynL-JkEouY&m=T3uKuRdXuJZJ3DyMoQBcYkbjgx3A0sYIMfodLs6GqEo&s=UqdDEzH8fQFsDoVAxnY0X6060A6Go_eBpyvilYn90LI&e= )
>
> If we decide to proceed with this, I think we have two options:
>
>
> 1. Proceed with the approach where enabling low-overhead debug output
> will only work for Debug()/TSFDbg calls that use a DbgCtl/TSDbgCtl instance
> rather than a simple tag string. This would include adding doc changes and
> Au testing.
> 2. Switch to an approach similar to what I used for testing. Where
> Debug() calls and is_debug_tag_set() will (each) generate a hidden instance
> of DbgCtl. I think I can also make TSDebug() generate a hidden pointer to
> TSFDbgCt.