Live data from Hacker News

Rewriting a high performance vector database in Rust

pinecone.io

41–50 of 157 posts

Re: Rewriting a high performance vector database in Rust

#41
I have no problem with people rewriting their projects in whatever language they see fit.

What stood out for me in the article is him saying that it's difficult getting developers with experience in both Python and C++.

So, I wonder, if his in-house devs could pick up Rust that they previously couldn't write, why does he think he can not hire a good programmer and charge him to learn the stack the company uses. Why must they employ someone that already writes Python or C++.

Is Rust such a straight-forward language that people new to the language can write a very performant programme

Re: Rewriting a high performance vector database in Rust

#42
post #39

Earlier quoted context omitted.

This might be a difference of semantics- there is a difference between garbage collection as a concept being slow and python's GIL approach. My understanding is that the GIL would almost always make the top 3 reason of why python is slow in practice - it works for a very specific single threaded execution model but can't really take advantage of modern processors.

I think GIL is not the reason for slowness, it just specifies single threaded interpreter execution model. You can always spin up more interpreters to take advantage of multiple cores. The reason for slowness - is the weak dynamic type system of Python. Every single instruction need to be type checked at runtime and thus making everything slow. Compare to C#/Java which have GC but both are amazingly fast, because the…

I'd argue Python is strongly, dynamically typed, and that "weak" and "dynamic" are on different axes.

Re: Rewriting a high performance vector database in Rust

#44

Earlier quoted context omitted.

This is just plain false. C++ in the 1990s had nothing like serde for example.

Where are the production grade and pure rust tls library ? Key-value store ? Ldap client ? SSH client ?

> production grade and pure rust tls library

You mean rustls? https://github.com/rustls/rustls

Re: Rewriting a high performance vector database in Rust

#45
> If you’re using a higher level language, you’re not going to have access to how the memory is laid out. A simple change, like removing indirection in our list, was an order of magnitude improvement in our latencies since there’s memory prefetching in the compiler and the CPU can anticipate which vectors are going to be loaded next in order to improve the memory footprint.

This is a common experience and I'm still surprised by the choice I constantly see to use a managed-memory languages to build a database - one of a very small set of special cases where having full control over the memory layout might just be a reasonable thing to want. In this universe (absent doing something completely absurd) it's not algorithmic complexity but managing data locality in the cache hierarchy (e.g. reading things from L3 vs main memory vs disk) that makes things orders of magnitude faster, especially if you're in the realm of doing things like SIMD operations to speed things up.

Perhaps there's some level of suck we're willing to tolerate for all the other benefits you get, but I've been noticing a pattern of "align things just so at the higher level and hope they mostly turn out the way you want at the lower level" (e.g. also with the Apache java-y databases like hadoop / hbase / cassandra which I guess were mostly supposed to derive their total throughput from massive scale rather than per-node performance) which is a bit funny.

But also it seems like part of Rust's promise was "low level but make it high level" which seems to be succeeding (zero-cost abstractions and whatnot), so I imagine this will get better over time - having not attempted a project like this myself, I'm not sure what the limitations you'd run up against are in terms of laying things out in memory in a favorable way - I imagine the kind of massive manually managed arena allocations and ad-hoc pointers going everywhere that one normally does doesn't really fly.

Re: Rewriting a high performance vector database in Rust

#46

Quoted post unavailable.

I care.

Programming languages give us different frameworks and guardrails to express computational tasks similarly to how written and spoken languages give us a different set of concepts with which to express ideas. New languages mean a potentially different way of thinking about a problem. Some ideas which are difficult to express in one language are trivial in another.

Discovering these differences is one of the joys of language learning. Language learning requires practice, and rewriting a known work (or translating it you might say) is a great way to deepen your understanding and test which ideas are easier or harder.

Re: Rewriting a high performance vector database in Rust

#47

I have no problem with people rewriting their projects in whatever language they see fit. What stood out for me in the article is him saying that it's difficult getting developers with experience in both Python and C++. So, I wonder, if his in-house devs could pick up Rust that they previously couldn't write, why does he think he can not hire a good programmer and charge him to learn the stack the company uses. Why m…

I agree, rust has a difficult learning curve. I’ve often heard at least a year is required to really feel confident.

Re: Rewriting a high performance vector database in Rust

#49
post #39

Earlier quoted context omitted.

I think GIL is not the reason for slowness, it just specifies single threaded interpreter execution model. You can always spin up more interpreters to take advantage of multiple cores. The reason for slowness - is the weak dynamic type system of Python. Every single instruction need to be type checked at runtime and thus making everything slow. Compare to C#/Java which have GC but both are amazingly fast, because the…

I'd argue Python is strongly, dynamically typed, and that "weak" and "dynamic" are on different axes.

[deleted]

Re: Rewriting a high performance vector database in Rust

#50

Earlier quoted context omitted.

This is just plain false. C++ in the 1990s had nothing like serde for example.

Where are the production grade and pure rust tls library ? Key-value store ? Ldap client ? SSH client ?

Aren't the most commonly used libraries for all of those written in C, not C++?

Regardless, I'm surprised you haven't heard of rustls - https://github.com/rustls/rustls

Post reply on HN