Maintained by: NLnet Labs

Stats Shared Memory

W.C.A. Wijngaards
Thu Feb 23 13:09:44 CET 2017


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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://unbound.nlnetlabs.nl/pipermail/unbound-users/attachments/20170223/d00e4c7b/attachment.sig>