Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Sep 2017 16:20:01 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Ernie Luzar <luzar722@gmail.com>
Cc:        RW <rwmaillists@googlemail.com>, freebsd-questions@freebsd.org
Subject:   Re: Help scripting dns lookup using awk
Message-ID:  <20170916162001.4ad176b3.freebsd@edvax.de>
In-Reply-To: <59BC6036.8040709@gmail.com>
References:  <59BB24E4.6060908@gmail.com> <20170915143019.2e02d386@gumby.homeunix.com> <59BC6036.8040709@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Fri, 15 Sep 2017 19:20:22 -0400, Ernie Luzar wrote:
> RW via freebsd-questions wrote:
> > On Thu, 14 Sep 2017 20:55:00 -0400
> > Ernie Luzar wrote:
> > 
> >> The following sh script works, but runs very slow.
> > 
> > Almost certainly the reason it's slow is that you are doing sequential
> > synchronous lookups. Switching  to another language isn't going help
> > much. To speed it up you either need to switch to a language with a
> > DNS library that supports asynchronous lookups or fire-off parallel
> > child processes. The latter is easier.
> > 
> 
> How would I go about coding a sh script to fire-off parallel child 
> processes?

There are several methods. One would be to "pre-sort" per TLD
or per IP. You can do this with awk or a sort | grep contruct.
Then you iterate over the result files and send the batch lookup
processes into background with the & appended. When everything
is done, re-combine the result files as needed.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20170916162001.4ad176b3.freebsd>