Comments (3)
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.
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.
[ 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 {
-
+func (z _Zone) findLabelsN(s string, targets []string, qts qTypes, x int) (_Label, uint16) {
var name string
- 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)
- when will geodns support ispDB with geoip2, any plan for that? HOT 4
- A Record Ttl and NS Ttl
- No geo provider configured HOT 2
- Can you support a database version based on mysql or redis?
- DNSSEC HOT 1
- 404 on opening websocket.
- This is great work.
- Matching by ip-addresses/networks
- Match by IP Prefix/24 or /32 HOT 3
- How to correctly distinguish normal subrecords from country codes when subrecords are the same as country codes HOT 6
- Wildcard support
- Bug) Incorrect GSLB result for Cloudflare DNS ( 1.1.1.1 ) HOT 2
- Need help for an example config file
- Inconsistent delegations and NXDOMAIN SOA answers
- Request for DNSSEC Support
- how does healthcheck work?
- Issue with GeoDNS APT Repository Access and Installation on Ubuntu 22.04 HOT 1
- Geo dns not work
- Don't resolve record directly HOT 3
- Long text does not work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geodns.