News for hackers. Stuff that matters.
Re:Two years of production Go at CloudFlare by jbarham on Monday November 11, 2013 @06:01PM (#6714719)
Nice writeup. Especially interesting to see that CloudFlare is using Go for its DNS service. I run a DNS hosting service (https://www.SlickDNS.com) and currently use tinydns from the djbdns suite in my name servers, but I'm writing a drop-in replacement in Go. The goal is to make it much higher performance by using multiple goroutines (tinydns is a single process).
Re:Two years of production Go at CloudFlare by tptacek on Monday November 11, 2013 @06:17PM (#6714784)
Have you done any analysis to see if tinydns was actually a bottleneck? The work of an authoritative DNS server is extraordinarily simple, and tinydns capitalizes on that.
Re:Two years of production Go at CloudFlare by jbarham on Monday November 11, 2013 @06:32PM (#6714858)
Under normal load tinydns' performance is more than adequate, but under DDoS attack the fact that it's a single process is a definite limitation when it's running on a multi-core machine.

By default tinydns opens its database file for every request which can lead to I/O errors under very heavy load. I've patched it (http://tinydns.org/one-second.patch) to only open the database every second, but with my Go rewrite I can easily keep the database in memory and reload it when the disk file changes.

Re:Two years of production Go at CloudFlare by seunosewa on Wednesday November 13, 2013 @07:31AM (#6724757)
Could you run one instance of TinyDNS on each core?
Re:Two years of production Go at CloudFlare by halayli on Monday November 11, 2013 @07:10PM (#6714996)
You can also write it in C and use lthread. It will be faster than what Go has to offer.

https://github.com/halayli/lthread

Re:Two years of production Go at CloudFlare by tptacek on Monday November 11, 2013 @08:02PM (#6715199)
It will probably not be significantly faster than Golang for this workload.
Re:Two years of production Go at CloudFlare by halayli on Monday November 11, 2013 @08:32PM (#6715297)
It can be. You have total control of memory layout. You can gain a lot of performance by considering locality of reference, slab allocators, and parsing DNS packets in general will most probably be much faster.
Re:Two years of production Go at CloudFlare by tptacek on Monday November 11, 2013 @08:41PM (#6715321)
Golang also allows control over memory layout.
Re:Two years of production Go at CloudFlare by halayli on Monday November 11, 2013 @10:09PM (#6715614)
of course it does, but it does it in a way that aims to provide an overall good performance for all apps. But it doesn't mean that's the best performance you can get.
Re:Two years of production Go at CloudFlare by halayli on Monday November 11, 2013 @10:32PM (#6715687)
C doesn't control memory. brk() does. There are various malloc libraries out there to improve the way malloc manages memory.

But ideally you don't want to allocate memory at all. You want to have memory preallocated and preferably accessing a page that's still in cache. You can control memory pages in C because it doesn't manage that for you.

Re:Two years of production Go at CloudFlare by tonyplee on Tuesday November 12, 2013 @01:02AM (#6716133)
+1
Re:Two years of production Go at CloudFlare by tptacek on Monday November 11, 2013 @10:22PM (#6715656)
What "way" would that be? Golang's approach to data layout is very similar to C's.
Re:Two years of production Go at CloudFlare by acdha on Tuesday November 12, 2013 @08:35AM (#6717675)
> It will be faster than what Go has to offer.

You meant “could theoretically be” – you're gambling that you'll have development resources and expertise to make optimizations which aren't possible in Go, that those optimizations will actually matter to the critical path, and that you're more likely to reach the point of being able to make those optimizations than the Go team will be able to optimize further.

In the absence of something showing a strong, unavoidable disadvantage for Go, that's a lot to take on faith.