News for hackers. Stuff that matters.
Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by dfee on Tuesday September 15, 2020 @03:19PM (#24485556)
As a consumer, why would I want something like this written in Go vs. Rust?

Is it just that Rust is really good with developer relations? Because it feels like to me that all new foundational technology is safer and faster in a language like Rust, and things written in Go should be higher up the food chain.

Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by psanford on Tuesday September 15, 2020 @04:31PM (#24486369)
This is not a standalone DB. Its a key-value store implemented as a library. You would want this if you were a Go developer working on an application that needed a built in key-value store.

If you were a Rust developer you'd want something similar written in Rust.

Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by hashamali on Tuesday September 15, 2020 @03:46PM (#24485901)
They mention in the article that it's mostly due to familiarity with Go:

> CockroachDB is primarily a Go code base, and the Cockroach Labs engineers have developed broad expertise in Go.

Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by marcrosoft on Tuesday September 15, 2020 @04:29PM (#24486349)
Because you already have a huge Go code base and you want an embedded kv db for your project?
Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by ecnahc515 on Tuesday September 15, 2020 @05:42PM (#24487054)
In addition to what others mentioned, even if Cockroach is written in Go, they could have used Rust, but the trade-off is that they would need to use cgo which introduces extra complexity for building, debugging, and has performance trade-offs that a pure-Go based solution doesn't necessarily have.
Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by strken on Wednesday September 16, 2020 @08:48AM (#24492134)
Reading this, I wonder how hard it would be to write or generate assembly bindings for libraries like rocksdb and sqlite, and whether you'd be able to do any better than cgo.
Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by petermattis on Wednesday September 16, 2020 @03:02PM (#24496181)
Cgo exists because goroutine stacks are small and grow on demand. C/C++ expect large fixed size stacks. While you can technically call into C++ without going through cgo (see https://github.com/petermattis/fastcgo), you can't avoid the stack problem. Cgo solves it by switch from the goroutine stack to the stack of the thread underlying the goroutine.
Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by blaisio on Tuesday September 15, 2020 @06:50PM (#24487636)
It has to be written in Go because Cockroachdb is written in Go.
Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by dfee on Tuesday September 15, 2020 @06:26PM (#24487455)
I really don’t understand the downvotes. I’m not experienced with either language - and this has nothing to do with a flame war.

The question, unstated and unopinionated AND intellectually honest was: does language impact community adoption - and if so, what are the drivers behind it.

If I were going to write a foundational technology, I probably wouldn’t write it in NodeJS, not that it couldn’t be done, but because I’d be concerned mainstream adoption might suffer. For example, I’d expect a hypothetical JsSql (a SQL engine written in JavaScript - assuming this doesn’t already exist) would achieve lower general adoption than writing it in C++.

Get it?

Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by brokencode on Tuesday September 15, 2020 @07:38PM (#24487955)
I don’t think Cockroach cares about adoption. This is not meant to be a generally useful product in itself outside of their database. So the language was chosen mainly based on their familiarity with Go and its ability to integrate with their existing codebase.

I think their omission of major features such as transactions is more likely to limit adoption than the language choice, so language choice is kind of irrelevant from that perspective.

Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by strken on Wednesday September 16, 2020 @09:05AM (#24492292)
The integration with their existing codebase might benefit from an explanation. In Go, calls to C libraries are done using a compiler feature called cgo, and there's a performance penalty that the cockroachdb team measured at 171ns per call, plus you sometimes have to copy additional data around for memory safety[0]. So far as I know, there's no way to avoid this penalty that doesn't involve building a tool that does the same thing as cgo.

In this case, given that they already have a database written in Go, writing the backing kv store library in Go has a clear performance benefit of 171ns every operation. This is above and beyond just familiarity and easy integration, although those are also important.

[0] https://www.cockroachlabs.com/blog/the-cost-and-complexity-o...

Re:Pebble: A RocksDB Inspired Key-Value Store Written in Go by pkaye on Tuesday September 15, 2020 @07:35PM (#24487929)
Their main product is in Go so they are most familiar with it.