Hacker Newsnew | past | comments | ask | show | jobs | submit | cbroglie's commentslogin

I'm trying to understand the use case for a persistent embedded DB for Go. SQLite is embedded all over the place, often in clients.

But presuming Go is a server language, and you are running stateless web nodes, why do you need persistence?


It's awesome because it's just a go package - no external dependency... Your application still ships as a single binary.


Note that using a sqlite wrapper like https://github.com/mattn/go-sqlite3, you also don't have any external dependencies and your application still ships as a single binary. However, there are other advantages of a Go-native storage library (e.g., doesn't require cgo, better integration with tools like pprof, etc.)


Stateless nodes is just one possible type of architecture - nothing in the language itself forces you to adopt it.


Of course. But I'm asking b/c I can't think of a situation where I would want to have stateful web nodes.


Management interface for monitoring, irc/chat host, pretty much anything interactive to a persistent backend.

Go can be used for far more than just web nodes.. it can be used for any number of network or stand-alone applications.


My use case would be small local tools that need to keep some state. Essentially anywhere a SQLite would be useful. I don't think this was designed to serve as a database to back anything more 'serious'.


We use it to store and serve 100s of GB of data with a custom query interface on top.


What's the replication strategy then?


It's not the data authority. It feeds in data from Kafka and structures it in an optimized way for querying. If a node dies then it can copy from another node and restart from an offset in Kafka. Kafka essentially works as a distributed write-ahead log (WAL).


Why and for what do you use that architecture?


Site usage analytics has a lot to do with state in a way. How about a visit counter? Something lightweight that would persist page count/ip address/lastdate values with an ip address key.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: