Building a distributed message processing system in Go using NSQ
Slides at bit.ly/nsqslides Some content from nsq.io
Greg Bray (@GBrayUT on Twitter)
Edge Platform Operations @WalmartLabs
Goal: Process logs in a complex environment
Logs and other messages are produced by:
Need a way to aggregate and process logs efficiently, with flexibility to meet fluid requirements
Destinations:
Some destinations need filtering or prioritization of data streams.
Some data streams have other requirements like encryption, low latency, etc...
Slides at bit.ly/nsqslides
Topics, Channels, and Consumers
Good example of a high performance system written in Go. See internals at https://nsq.io/overview/internals.html
Lookupd: nsqd registers topics and channels
Lookupd: Consumers query for nodes/topics
Redundancy… eliminate Single Point of Failure
Messages usually stored in memory (but overflow to disk)
Example layout. More at https://nsq.io/deployment/topology_patterns.html
Example of stats output. Also using TLS with client certificates to secure access.
Utilities include in NSQ codebase:
More details including command line arguments at https://nsq.io/components/utilities.html
ARGS='--cacert ~/ca.crt --key ~/nsqd.key --cert ~/nsqd.crt -lookupd-http-address lookupd01:4161 -lookupd-http-address lookupd02:4161'
nsq_to_nsq $ARGS -destination-nsqd-tcp-address=localhost:4150 -topic topicA -destination-topic topicA-Aggregated
Other utilities we’ve built in Go
Each of the above is a simple go program, usually a few hundred lines each. They run on two “log transport” servers in each data center to aggregate logs from all local servers.
Haven’t yet found a breaking point for NSQD (other than running out of disk space)
Any questions?
If this sounds like an interesting problem, you should come help us solve it!
Hiring Dev and DevOps that are familiar with Go and interested in “Industrial Grade” Internet / Websites.
Some other interesting systems we work on (all in Go):
Slides at bit.ly/nsqslides