Hacker News new | ask | show | jobs
by the_duke 2771 days ago
So, FoundationDB is a pretty low level distributed key-value store with transactions.

Most applications will need something higher level, like a SQL or document db frontend which could be built on top.

I'm curios what people have started using FoundationDB for. Any interesting stories to share?

3 comments

We have moved to FDB for our messaging platform. We had several options:

a) Rewrite SQL code. In our case we are using Node.JS and all SQL libraries are very very slow. Even replacing one with another is enormous work. b) Rewrite to a new language. It was also an option since querying Postgres can take 1ms, but parsing response can easily take 100ms+. That trashed our event loop and causes awful latency. c) Rewrite to high performance NoSQL database.

We picked a last one. In context of a Node.js we were able to write really thin layer on top of FDB that works super-fast and in a way we needed.

In my previous startup we eventually ditched all SQL from our codebase too since SQL databases is just too slow for low latency messaging apps. There are no simple way to shard data, there are always random locks around your database (which blocks connections). Locks are really hard to debug sometimes. How to scale single SQL server? All of this is doable, but in FDB it was basically free.

We migrated to FDB and got almost x100 improvement in latency/performance. And unlike SQL-code that was very carefully crafted we can do nasty things. Like - "hey, let's just pull this key every 100ms and check for a new value" or "hey, let's do it on 10s of instances at the same time?". In this situations Postgres started to consume all available CPU. You can easily creep out SQL with a single instance of your app. We haven't managed this to do with FDB for 1/2 of the cost. We are often in situation when someone commit something with a bug and, for example, started to pull data every millisecond in N^2 streams where N is number of online users. In this situations we just can't see any impact at all on our platform. Just spikes in monitoring.

FDB is wonderful thing - it allows you to forget about optimizing performance of your queries, forget about managing backups and replication. It just works!

100ms+!

Ouch. Is that just large amounts of data? Are you guys using pg.native?

No, this is just say a list of messages, not that much of data. We tried to move to pg-native, but it didn't help. Problem was in Sequelize. But in my internal tests even Sequelize was the fastest library on the market.
Looks like you’re blaming Postgres for Something that sounds like Sequelize’s fault. You should try prototyping parts of your application in a language that is better supported. Last I used Sequelize I was disappointed at how poorly it fared compared to other libraries like Django ORM or SQLAlchemy.
> like a SQL

Most people don't mind SQL. RDBMS are good enough. People don't want to learn a new thing that's why it's still here and that's why FDB will have a hard time to compete with CockroachDB or TiDB or Spanner.

> document DB frontend which could be built on top

A document database is a low hanging fruit in FDB (except if you want 1-to-1 mapping with MongoDB). But my advice is to stay away from MongoDB API.

What FDB is offering is much more powerful. Think the ease of use of MongoDB with the power of dynamodb + other niceties likes 'watches' (pgsql-like notify), transactions of course and your favorite language to do the queries. Also, FDB works in standalone mode that is you can start using FDB on day one and grow your business with it. All you need is a good layer.

> Any interesting stories to share?

I have been dabbling with key-value stores for 5 years now. So I am definitely biased. Simply said, key-value stores open perspectives you can not imagine, FDB, in particular, is a great great idea and it looks like based on the forums interactions that it's a good (if not fabulous) piece of software.

Read on the forums for more (success) stories on forum https://forums.foundationdb.org/ tl;dr: mostly timeseries, but (also there is long thread about a distributed task queue using FDB but I am not sure it's in production, yet)