Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [tarantool-patches] [PATCH v2 2/2] lua: add fiber.top() listing fiber cpu consumption
Date: Fri, 1 Nov 2019 17:09:38 +0300	[thread overview]
Message-ID: <E47F2D78-D502-483A-8102-33D2001286B7@tarantool.org> (raw)
In-Reply-To: <14d5809e-ee70-cb13-9bb7-3bcb7b356589@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

Thanks for reviewing this!

> 29 окт. 2019 г., в 2:00, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> написал(а):
> 
> Hi! Thanks for the fixes!
> 
> I think it is worth mentioning in the doc request,
> that fiber.top may affect performance when enabled, so
> users should not enable it when possible.

I added the warning to the doc request.

> 
>> diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
>> index e3fe77e21..4c646b278 100644
>> --- a/src/lib/core/fiber.c
>> +++ b/src/lib/core/fiber.c
>> @@ -87,31 +87,32 @@ static int (*fiber_invoke)(fiber_func f, va_list ap);
>> })
>> 
>> #if ENABLE_FIBER_TOP
>> +static bool fiber_top_enabled = false;
> 
> I just realized that we might want to make it
> thread local (__thread). We have fibers in other
> threads, and I don't think we want to turn on fiber
> top for them accidentally.
> 
> On the other hand sometimes access to a thread local
> variable might be an expensive thing in my experience.
> So probably we might want not to care about other
> threads starting to collect top together with the main.
> Just so as to keep performance unaffected when top is
> disabled.
> 
> I would bench thread local fiber_top_enabled vs
> global fiber_top_enabled, both with disabled top.
> If they are the same, then lets make it thread local.
> 

I’ve tested your proposal. The difference is ±2%.
I can post the results if you want me to.
So, let it be `static __thread bool fiber_top_enabled`.

> Note, this has nothing to do with fiber_top_init(),
> which you call for the main thread only. Check for
> fiber_top_enabled happens regardless of whether the
> top was initialized, in all threads.
> 
> Other than that the patch LGTM. I think you need to
> get a second review from Georgy or Alexander Tu.
> 

I’ve resent v3 with the fixes mentioned above and one additional feature
requested by Mons (added «time» entry listing cpu time consumed by each
fiber both to fiber.info <http://fiber.info/>() and fiber.top <http://fiber.top/>())

--
Serge Petrenko
sergepetrenko@tarantool.org




[-- Attachment #2: Type: text/html, Size: 3997 bytes --]

  reply	other threads:[~2019-11-01 14:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1570546695.git.sergepetrenko@tarantool.org>
     [not found] ` <eb924da60bc66cbd93d7920f53d6c332d15ffab8.1570546695.git.sergepetrenko@tarantool.org>
2019-10-22 21:18   ` Vladislav Shpilevoy
2019-10-25 15:13     ` Serge Petrenko
2019-10-25 16:19       ` Serge Petrenko
2019-10-26 18:00       ` Vladislav Shpilevoy
2019-10-28 16:16         ` Serge Petrenko
2019-10-28 23:00           ` Vladislav Shpilevoy
2019-11-01 14:09             ` Serge Petrenko [this message]
     [not found] ` <52e7822bbcd802528d448c15ce9e9fbe4479c73a.1570546695.git.sergepetrenko@tarantool.org>
2019-10-22 21:20   ` [Tarantool-patches] [tarantool-patches] [PATCH v2 1/2] test: modify swim_run_test to break event loop Vladislav Shpilevoy
2019-10-25 15:15     ` Serge Petrenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E47F2D78-D502-483A-8102-33D2001286B7@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [tarantool-patches] [PATCH v2 2/2] lua: add fiber.top() listing fiber cpu consumption' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox