Re: MERGEQUERIES consumes 100% CPU ?

Mark Johnson <[email protected]>
Newsgroups gmane.network.djbdns
Message-ID <[email protected]>
On Tue, May 19, 2009 at 8:25 AM, Andreas Schulze
<[email protected]> wrote:
> nobody may help ?

Sorry for not shooting you a reply.  Known problem.

http://marc.info/?l=djbdns&m=124047690620137&w=2
http://marc.info/?l=djbdns&m=124057562229449&w=2
http://marc.info/?l=djbdns&m=124065894002106&w=2

I'm sure Jeff will speak up when he gets a chance.  I believe he's
working on a solution with a better algorithm / data structure.

In the meantime, if anybody wants to take a stab at a solution, I
think these are the suspected bottlenecks:

static int try_merge(struct dns_transmit *d)
{
  int i;
  for (i = 0; i < MAXUDP; i++) {
    if (!inprogress[i]) continue;
    if (!merge_equal(d, inprogress[i])) continue;
    d->master = inprogress[i];
    inprogress[i]->slaves[inprogress[i]->nslaves++] = d;
    return 1;
  }
  return 0;
}

static void register_inprogress(struct dns_transmit *d)
{
  int i;
  for (i = 0; i < MAXUDP; i++) {
    if (!inprogress[i]) {
      inprogress[i] = d;
      return;
    }
  }
  strerr_die1x(100, "BUG: out of inprogress slots");
}

static void unregister_inprogress(struct dns_transmit *d)
{
  int i;
  for (i = 0; i < MAXUDP; i++) {
    if (inprogress[i] == d)
      inprogress[i] = 0;
  }
}

Though that really needs to be confirmed by profiling.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.