TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Gnatsd: a high performance NATS messaging server written in Go

33 pointsby krobertsonover 11 years ago

3 comments

DrJosiahover 11 years ago
This is probably a bit off topic, but I notice that they implemented their own hashmap with pluggable hash functions. Awesome in theory (and practice), though I notice that the performance of their custom hash table is poorer than Go&#x27;s built-in hash map (Go&#x27;s hashmap takes 1&#x2F;2, 3&#x2F;4, and 9&#x2F;10th the time of their hashmap for small, medium, and large keys, respectively - though this could be related to the updated aes hash in Go, and that my processor supports it).<p>While looking through the implementations, the Gnatsd hashmap implementation is a simple table with buckets, where as the Go hashmap also uses a table with buckets, though each &quot;bucket&quot; has 8 slots by default (and does subsequent chaining). Go&#x27;s chunking of buckets helps caches work better, reduces random reads, and helps to minimize overhead (fewer pointers if you have fixed-size data). Read the first 83 lines of <a href="http://golang.org/src/pkg/runtime/hashmap.c" rel="nofollow">http:&#x2F;&#x2F;golang.org&#x2F;src&#x2F;pkg&#x2F;runtime&#x2F;hashmap.c</a> to see what good structure design and experimentation gets you.<p>Does someone have an example where a &#x27;go test --bench=&quot;.&quot; -gcflags=&quot;-B&quot;&#x27; call in the gnatsd&#x2F;hashmap path actually comes out ahead for the Gnatsd hashmap using a recent Go?
评论 #6575487 未加载
clumsysmurfover 11 years ago
At first glance, NATS looks similar in goal to MQTT. Can anyone describe the differences?
评论 #6574801 未加载
评论 #6574575 未加载
orenmazorover 11 years ago
at first I definitely thought this was related to the old gnu bug tracker.