1. mattrobenolt

    Trying out this Go thing…

    Posted on May 23, 2013 by mattrobenolt

    Last Thursday, May 16th, we shipped our first Go project into production.

    Disqus has a history of using one tool for the job and hammering through everything. Until now, that tool has been Python. This mentality has been extremely beneficial for us since we are a small team. Everyone is able to jump in to any piece of our stack with minimal effort.

    So what was the problem?

    Our realtime was having issues. It was slightly short of… realtime. The original realtime backend was written as a pretty lightweight Python + gevent service that handled a few basic tasks. Realtime consists of four components: a queue, a nozzle, a transformer, and a publisher. Everything was Python, except for the queue, which was something implemented on top of Redis.

    The rate of messages has since increased, and our backends were having a bit of an issue scaling to our needs. We had 4 servers, each at maximum capacity, and our end-to-end latency was at best a few seconds. At worst, minutes. At peak, we process 10k+ messages per second.

    Realtime is a pretty critical component to Disqus, so we decided to try something a bit different.

    Why Go?

    Go was initially very attractive to us. The language felt very natural coming from Python backgrounds, and the performance approaches C levels. The goroutine model and channels are very easy to work and immensely powerful to manage concurrency.

    In roughly a week’s time, I went from initial commit to shipping replacement backends while only having a cursory level of Go knowledge. To me, that’s highly impressive. Our realtime end-to-end latency is on average, less than 10ms, and currently consuming roughly 10-20% available CPU on one machine at peak.

    Overall, this should yield a much more responsive experience for our users, and gives us a lot of room to grow in the future. I look forward to trying out more Go and seeing where it can fit into our stack.

    THE FUTURE

    Would I use Go again? Absolutely! We were very happy with our results and can only imagine it getting better the more we learn. I highly recommend anyone giving it a chance and checking out what it has to offer for you.

    I look forward to trying out Go for more projects and start contributing back libraries.

    Does this sound fun to you? Looking for a job writing Go? Come work with us at Disqus!

  2. We welcome relevant, respectful comments. Please read our Community Guidelines before commenting.

    blog comments powered by Disqus