abh / geodns

DNS server with per-client targeted responses
Apache License 2.0
1.39k stars 193 forks source link

picker makes garbage #46

Open abh opened 10 years ago

abh commented 10 years ago

From doing some memory profiling it looks like picker.go makes a fair amount of garbage when it copies the list of records so it can manipulate it to not get duplicate results.

(cc @miekg for suggestions).

miekg commented 10 years ago

[ Quoting notifications@github.com in "[geodns] picker makes garbage (#46)..." ]

From doing some memory profiling it looks like picker.go makes a fair amount of garbage when it copies the list of records so it can manipulate it to not get duplicate results.

(cc @miekg for suggestions).

I think this inherit to the setup you choose. The copy is done for every request, so it might make sense to implement a little cache that looks up these records for each IP and edns0-subnet pair (ugghh).

Another way is to use a pre-alloced piece of memory that you can reuse instead of claiming something new each time. There was a blog about this somewhere, some time ago (that use Golang as a language), but can't remember the name/site.

grtz Miek