Stats Shared Memory

Luiz Fernando Softov fernando at softov.com.br
Sat Mar 25 02:13:11 UTC 2017


Sorry for the delay, I had personal problems for some days.

Thank you for include my patch. This will be very usefull.

I had read the modifications you have made. This is great. :)

For me, I don't need to reset the memory.

Because the SHM isn't like stats, even stats_noreset. There is no known in
unbound (daemon), that someone is reading the memory (I think).

And, SHM will be always the current stats info (total + worker[]). So, if
someone reset stats, using 'unbound-control stats', SHM will be reseted to.


We just need this 2, for SHM in read 'client side'
Both are in /daemon/stats.h

struct server_stats
struct stats_info

Maybe, when compiling this file can go to system include files.
In FreeBSD, the .h file goes to /usr/local/include/

Then
/usr/local/include/unbound_stats.h

Or something like this.

SHM, is to be used in the same machine, with the same struct.

So, when I change unbound, I need to recompile my daemon.
It's the price. And I pay smiling.

Best regards, Softov

2017-02-23 8:09 GMT-04:00 W.C.A. Wijngaards via Unbound-users <
unbound-users at unbound.net>:

> Hi Luiz,
>
> Thank you for your patch.  I have included it (but not in 1.6.1, but it
> is in the code repository for 1.6.2).
>
> Modified the patch a bit to clean it up and I added unbound-control
> stats_shm, that makes unbound-control print out the normal stats output
> from it, but using shm to get the information.
>
> I also added shm-enable and shm-key to unbound.conf.  Disabled by default.
>
> Not sure when to reset the memory, so I didn't.  I guess unbound-control
> could reset the memory after printing out the results (unless 'noreset')?
>
> The .h file is harder, unbound.h that gets installed is the obvious
> choide, but not sure how to deal with version changes, and different
> statistics output...
>
> Best regards, Wouter
>
> On 14/02/17 10:57, Luiz Fernando Softov via Unbound-users wrote:
> > ​Hi,
> > I don't know if it's relevant, but in January i have sent a message to
> > the mailing list
> > about this.
> >
> > http://unbound.net/pipermail/unbound-users/2017-January/004626.html
> >
> >> Yes, I would like to get the diff file for that patch.  Lower CPU usage
> >> is nice, and SHM is an interesting construction.  Can you send me the
> >> diff; or link to the github pull/push thingy that contains the diff (or
> >> the newest diff if you updated it recently)?
> > . . .
> > I put my changes here. https://github.com/softov/unbound
> >
> > This branch is 1 commit ahead, 12 commits behind NLnetLabs:master.
> >
> > But, if you need, I can make the update.
> >
> >>​ ​Depending on how invasive this is, I can put it in the mainline code
> >>​ ​(optional) or it can be a patch that is available to other users in
> the
> >>​ ​contrib directory.
> >
> > As I said before.
> >
> > This make 2 SHM instances and I am using the timer to stats-interval to
> > fill the memory.
> >
> > I have​ some​ ​daemons, reading this stats​ ​with shmget​ ​each second.
> > It's been a few​ ​weeks​ since I launched​ ​the last​ ​release​ ​with​ ​
> > this changes for my clients.
> >
> > I have ~2400 clients running my SO, called FreeBRS - Free BrByte Routing
> > System.
> > Which is a release based on FreeBSD.
> > For those clients, the average of requests are between 50 and 1500 per
> > second.
> >
> > I all clientes, the CPU consume is 0%, while using my own daemon,
> >  who use ssl in a tcp connection like unbound-control.
> > The CPU increase ~3% in my daemon and ~2,5% in unbound.
> > -- -- -- -- -- -- -- -- -- -- -- --
> >
> >> Although there may be an rc3 because of pkg-config vs autoconf problems,
> >> I don't want to introduce features in rc3; so it'd be there for the
> >> subsequent release.
> >
> > I thing there is more to do about, like.
> > 1 - setting variables in conf (I don't know how)
> > * shm-key: number
> > * shm-enabled: yes or no
> > Maybe
> > * shm-interval: number, if 0 or null shm will be filled in the timer
> >  of stat-interval, like i have made, > 0 will be created a reserved timer
> >  and I don't know how to interact with the base or how much I can change
> >  because, you know using threads, this can create problems
> >
> > 2 - reset shared memory - zerofill values
> > 3 - A header file.h to be referenced in the binary who is reading this
> info
> > like a file with the struct and etc.
> >
> > For now, I only need the conf options, and I don't know how to make
> those.
> >
> > It will be my pleasure to help you in some way.
> > The Unbound have been helping the community a lot.
> > Here in Brazil, its used by about 80% of the ISPs.
> >
> > Thanks for the reply.
> > Best regards, Softov
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20170324/49906fc0/attachment.htm>


More information about the Unbound-users mailing list