Giter Club home page Giter Club logo

Comments (3)

abh avatar abh commented on August 15, 2024

On Mar 8, 2013, at 23:46, Miek Gieben [email protected] wrote:

The selector in findLabel generates garbage. It would be beter to completely remove this from this (often called) function.

Using the new data structure we've talked about should fix that.

It's interesting (but makes sense) that "creating garbage" is a significant overhead. The things you pointed out also explains, I think, how the 32-bit servers ran out of memory so quickly when the query rate went way up.

Ask

from geodns.

abh avatar abh commented on August 15, 2024

Since you made this ticket I've dug myself deeper in, rather than working towards getting rid of it. Can you outline what you had in my for getting rid of it? Currently the code making the list of "targets" is in "GetTargets()" in targeting.go and serve.go passes that list to findLabels that then just iterates over it.

from geodns.

miekg avatar miekg commented on August 15, 2024

[ Quoting [email protected] in "Re: [geodns] findLabel and the sele..." ]

Since you made this ticket I've dug myself deeper in, rather than working towards getting rid of it. Can you outline what you had in my for getting rid of it? Currently the code making the list of "targets" is in "GetTargets()" in targeting.go and serve.go passes that list to findLabels that then just iterates over it.

Thought I mentioned it, because of the string var 'name', which probably
isn't a real big issue. The following patch captures what I had in mind
to change it. Note: untested! Only thing going for it, is that it
compiles.

grtz Miek
@@ -125,23 +125,30 @@ func (z _Zone) SoaRR() dns.RR {
// first available qType at each targeting level. Return a Label
// and the qtype that was "found"
func (z *Zone) findLabels(s string, targets []string, qts qTypes) (_Label, uint16) {

  • return z.findLabelsN(s, targets, qts, 0)
    +}

- for _, target := range targets {

  •   var name string
    
    +func (z _Zone) findLabelsN(s string, targets []string, qts qTypes, x int) (_Label, uint16) {
  • if x > 7 {
  •   return z.Labels[s], 0
    
  • }
  • name := make([]byte, 256)
  • for _, target := range targets {
    switch target {
    case "@":
  •       name = s
    
  •       copy(name, s)
    default:
        if len(s) > 0 {
    
  •           name = s + "." + target
    
  •           copy(name, s)
    
  •           name[len(s)+1] = '.'
    
  •           copy(name[:len(s)+2], target)
        } else {
    
  •           name = target
    
  •           copy(name, target)
        }
    }
    
  •   if label, ok := z.Labels[name]; ok {
    
  •   if label, ok := z.Labels[string(name)]; ok {
    
        for _, qtype := range qts {
    

@@ -153,9 +160,7 @@ func (z _Zone) findLabels(s string, targets []string, qts qTypes) (_Label, uint1
return z.Labels[s], qtype
case dns.TypeMF:
if label.Records[dns.TypeMF] != nil {

  •                   name = label.firstRR(dns.TypeMF).(*dns.MF).Mf
    
  •                   // TODO: need to avoid loops here somehow
    
  •                   return z.findLabels(name, targets, qts)
    
  •                   return z.findLabelsN(label.firstRR(dns.TypeMF).(*dns.MF).Mf, targets, qts, x+1)
                }
            default:
                // return the label if it has the right record
    

from geodns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.