Live data from Hacker News

How Rust Lets Us Monitor 30k API calls/min

blog.bearer.sh

61–70 of 81 posts

Re: How Rust Lets Us Monitor 30k API calls/min

#61
post #57

Earlier quoted context omitted.

All I'm saying is that without some example of the payloads they're managing, and the logic they're performing, it's hard to say "this is inefficient". And, as I mentioned, if their CPU and memory are both very low, it's likely they're hitting a network (or, yes, OS) limit. I've seen places hit ulimit limits...I've also seen places hit port assignment issues, where they're calling out to a downstream that can handle…

They might not be doing anything wrong, per se. But if your expectations are that 500/s is alot (or even 4000/s for log ingesting), then your architecture will reflect that. Here's what they're doing: > Now, when the Bearer Agent in a user's application sends log data to Bearer, it goes into the Envoy proxy. Envoy looks at the request and communicates with Redis to check things like rate limits, authorization details…

"I can tell you right off the bat probably what's the problem"

Emphasis added. I don't disagree with you that they may be doing something inefficient; I'm just saying, I don't -know- what they're doing, so I'm disinclined to judge it.

I do know that, again, in Rust, whatever bottleneck they're hitting is neither CPU nor memory, despite the seemingly low throughput, which does imply that what you're proposing isn't the bottleneck in that implementation.

Re: How Rust Lets Us Monitor 30k API calls/min

#62
post #45

Earlier quoted context omitted.

Can you share information about your experience? I'm currently working on a F# project, enjoying the functional approach, while having a lot of libraries available on the .Net platform. The |> operator is one I use all over the code, but Rust doesn't support custom operators. Is that annoying, or not at all? Is your code less functional and more imperative style due to Rust?

> Is your code less functional and more imperative style due to Rust? I would imagine so. Rust doesn't support tail call optimization, and variables are immutable only by default.

LLVM should optimize tailcalls and sibcalls. But tail call optimization has unexpected interactions with the extended RAII that Rust uses because stuff has to be dropped at the end of its lifetime, so the code that's running in "tail" position is sometimes not what you expect.

Re: How Rust Lets Us Monitor 30k API calls/min

#64
post #63

Earlier quoted context omitted.

I worked there, it's totally false.

_When_ did you work there?

My last day was sometime in February, if I recall correctly. I was fulltime until September, contracting part time after.

I'm aware of at least two ongoing projects they're writing in Rust, which I obviously won't comment on in detail publicly.

Re: How Rust Lets Us Monitor 30k API calls/min

#65
post #63

Earlier quoted context omitted.

_When_ did you work there?

My last day was sometime in February, if I recall correctly. I was fulltime until September, contracting part time after. I'm aware of at least two ongoing projects they're writing in Rust, which I obviously won't comment on in detail publicly.

Then you just weren't paying attention. There's a list of approved languages for new development and Rust isn't on it. There's a list of languages that are forbidden, for which you need high-level approval to use for new work, and Rust is on that one, next to C++.

Re: How Rust Lets Us Monitor 30k API calls/min

#66
post #65

Earlier quoted context omitted.

My last day was sometime in February, if I recall correctly. I was fulltime until September, contracting part time after. I'm aware of at least two ongoing projects they're writing in Rust, which I obviously won't comment on in detail publicly.

Then you just weren't paying attention. There's a list of approved languages for new development and Rust isn't on it. There's a list of languages that are forbidden, for which you need high-level approval to use for new work, and Rust is on that one, next to C++.

Rust support is categorized as Tier 2 at Dropbox. Do you work at Dropbox? You can go look for the language approval list, which documents this.

Tier 2 means it requires approval. That is massively different from "forbidden". There is, for example, a Tier 3 list - Java is on there, some other languages, they're discouraged a lot more strongly than Rust though you'll still find them in some parts of the codebase (primarily acquired code from what I recall). Approval is only required for business/ product dev - non product teams can very easily write rust, at least one is currently doing so.

Tier 2 means it has internal library support, such as the communication library. That means there is, at all times, active rust development - and of course this is true, the most critical parts of Dropbox are written in Rust, and they rely on those libraries.

You can also very easily find out about the existing projects being written in Rust. Go ask the rust-lang channel. Last I saw, maybe 6 months ago, Rust was being used for another major component of the product - obviously I'm not commenting publicly on that further.

Re: How Rust Lets Us Monitor 30k API calls/min

#67
post #46
post #44

Earlier quoted context omitted.

> totally unknown in real industry Microsoft, Apple, Amazon, Oxide, Mozilla, Dropbox and CloudFlare would like a word...

Engineering by press release? A fun fact for you: Rust is forbidden at Dropbox for new development.

This is patently false. https://dropbox.tech/infrastructure/rewriting-the-heart-of-o...

Re: How Rust Lets Us Monitor 30k API calls/min

#68
post #13

They didn't mention Java as a possible solution, even though its GC's are far better than anything else out there. I have nothing against Rust but if I was at a startup I would save my innovation points for where they're mandatory

One step beyond good Java GCs is to write fully zero-GC Java code. The advantage of it is complete control over your performance which means your software is going to be consistently fast. The disadvantage is that it is relatively difficult to obtain. If you want to see an example of fully zero-GC Java, you can check out QuestDB on Github [1] - Disclaimer I work for QuestDB. [1] https://github.com/questdb/questdb

> One step beyond good Java GCs is to write fully zero-GC Java code. The advantage of it is complete control over your performance which means your software is going to be consistently fast. The disadvantage is that it is relatively difficult to obtain.

I don't know that it's actually possible in the general case, as Java's support for value types remains wholly insufficient. IIRC the ixy folks never managed to remove all allocations from the java version.

Re: How Rust Lets Us Monitor 30k API calls/min

#69
post #4

Earlier quoted context omitted.

One of the interesting effects of using rust is saving money! I also migrate a F#/.NET ecommerce backend and can run in less RAM/CPU that make my bills lower.

Can you share information about your experience? I'm currently working on a F# project, enjoying the functional approach, while having a lot of libraries available on the .Net platform. The |> operator is one I use all over the code, but Rust doesn't support custom operators. Is that annoying, or not at all? Is your code less functional and more imperative style due to Rust?

The |> operator I miss, but rust have a near similar feel with iterators:

    let a= [1, 2];
    a.iter().filter(|x|..).map(|x|...)
I think I'm more functional in a lot of areas where in F# can't (or don't know how). One reason?:

https://doc.rust-lang.org/std/convert/trait.Into.html

This is THE feature I wish other langs copy. Combined with serde:

https://github.com/serde-rs/serde

Is possible to cut a lot of boilerplate related to data transformation (that is the main task in my case).

Re: How Rust Lets Us Monitor 30k API calls/min

#70
post #4

Earlier quoted context omitted.

One of the interesting effects of using rust is saving money! I also migrate a F#/.NET ecommerce backend and can run in less RAM/CPU that make my bills lower.

Does Rust offer much of the same language features as F#?

Near. Exist some fancy features that are not present, but the practical side is covered...
Post reply on HN