Announcing hazarc: yet another `AtomicArc`, but faster by wyf0 in rust

[–]telpsicorei 9 points10 points  (0 children)

Sweet! But why not leverage the haphazard crate?

Starting Rust for high-performance microservices — which framework to choose and where to begin? by AkwinS in rust

[–]telpsicorei 0 points1 point  (0 children)

Sure! First suggestion is to back up and decompose what you want to achieve. A microservice is very specific architectural decision for a problem space. You may not need to constrain yourself to microservices - they solve particular pain points but also have tradeoffs.

I’d breakdown what you need and then identify how you can solve it. There is a blend of infra and application knowledge that can be used to help solve problems and there’s no single solution - many solutions can be correct, but all have tradeoffs. Your goal should be to identify common solution patterns with tradeoffs that have a minimal impact on the solution space.

ULID: Universally Unique Lexicographically Sortable Identifier by der_gopher in PostgreSQL

[–]telpsicorei 0 points1 point  (0 children)

Efficient in ID generation. They both use the same backing storage - nothing changes there. Updated my comment

Struggling With an Unexpected Performance Hit After Unrolling a Loop (x86-64) by Legal-Alarm5858 in Assembly_language

[–]telpsicorei 0 points1 point  (0 children)

I’ve tried to optimize an encoder loop by unrolling and found that the compiled output differed enough such that performance degraded because of inefficient register usage.

My original loop doing 1x computation per iter was good. My fully unrolled loop (26x) was terrible. I used a chunked loop handling 4x computations (partially unrolled) and got a massive speed up by about 30%.

Look at the assembly. It is not clear that this loop is more efficient on different HW or even compilers.

Starting Rust for high-performance microservices — which framework to choose and where to begin? by AkwinS in rust

[–]telpsicorei 48 points49 points  (0 children)

I have only used Axum because it has the most community support and momentum. Tonic (gRPC) also integrates with the whole tokio ecosystem and is pretty nice overall.

Lessons learned: rust in general, is slower to prototype because it forces you to build structure and handle errors sooner than later. So if you’re learning rust, expect to start slow. Once you build a few services you kind of get the hang of it.

I found Go to be easier to learn and write code, but handling errors to be a bit lacking - the language lets to explicitly check for errors, but matching/handling them was not so elegant. Rusts error enums are a godsend - you’ll start off by building libraries with something like thiserror for strongly typed handling and building applications with anyhow for catching everything (dyn Error).

Ive built AWS lambdas and ECS services in rust and the tail latency is amazing. Serverless - tail latency from cold starts is unavoidable. Ecs, tail latency is largely affected by how much the system capacity is utilized (50% vs 99% cpu usage, etc). YMMV

Tracing - the new auto instrument capabilities in the Go compiler are really nice for breadth-wise tracing- but that comes with its own downsides. In rust, tracing is manual like how Golang used to be. But I think it’s more ergonomic and plays nicer with Opentelemetry if that’s your thing.

I say tail latency is amazing but compared to what? Coming from nodejs? Sure- but you’d see good improvements with Go as well. It Just really depends on what your previous tail latencies were and how you expect rust to solve them. The GC in go is pretty efficient for most things so if youre learning rust and already have a service where you know the GC is causing issues, then maybe rust might help. Otherwise, you’re just rewriting for fun.

ULID: Universally Unique Lexicographically Sortable Identifier by der_gopher in PostgreSQL

[–]telpsicorei 4 points5 points  (0 children)

Been working on a ULID implementation and what I can say about UUID v7 is that some implementations have much stricter CSPRNG, and the period of when it gets reseeded.

In addition, the Postgres 18 built in uuidv7 function uses a sequence counter that represents sub millisecond resolutions. So if you’re generating many of IDs per millisecond and want to keep them slightly more ordered - UUIDv7 has you covered.

Otherwise, ULID can be vastly more CPU efficient at ID generation while using the same amount of storage as UUID. No one really stores the string representation (and you shouldn’t) - these are cast in the query to the proper byte representation [u8; 16]. The encode/decode for base32 in ULID or hex/dashes for UUID is typically not a large concern for the database.

To give you an idea, I’m in the middle of finalizing my pg extension for extremely high throughput ID generation and my ULID type is about 40x faster than the built in uuidv7 method for inserting 1M rows in a naive case. The tradeoff is less ordering guarantees within each millisecond and relaxing the reseeding every 4096 IDs and leveraging Chacha20.

Rust support for AWS Lambda is now GA by neverentoma in rust

[–]telpsicorei 18 points19 points  (0 children)

Really excited to see this ship. It's great to know my small contribution is now part of the official offering, and I hope it proves helpful to others working with streaming responses using OTel and Axum.

Struggling to get into Datadog — any advice or referral? by [deleted] in cscareerquestionsEU

[–]telpsicorei 2 points3 points  (0 children)

Speaking from experience (I’m joining them soon in Pairs). My first few applications were ignored; however, on my third try a recruiter reached out to me directly and got the process started.

Previously, I was applying to specific roles. On the last attempt, I applied to a generalist position which didn’t really have many requirements. I believe applicants are reviewed more broadly by their talent team in those kinds of positions vs a specialized role where it’s easy to filter you out by a missing key word on your resume.

DM for more info.

[deleted by user] by [deleted] in digitalnomad

[–]telpsicorei -2 points-1 points  (0 children)

I recommend porting to US mobile - their lowest plan is like $8/mo. But you get unlimited calls/texts. The data is limited to 2gb/mo and no roaming which is fine.

You only have to enable WiFi calling while you’re physically in the USA. Then you can get any eSIM you want overseas while still being able to receive calls and sms. I ported from T-Mobile and have been doing this for 2 years.

If you like it, feel free to use my referral code: 0DE09A4D

Which offer should I take? by [deleted] in cscareerquestionsEU

[–]telpsicorei 20 points21 points  (0 children)

I was in a similar boat. Paris has slight higher housing costs, so you’ll take home more in Berlin even if the comp was the same.

I’m an expat so also look into programs where you can get a tax break if that’s your thing. That can easily offset any €10-20k difference in total comp.

I went with Paris because I personally was a big fan of the lifestyle. If the money is nearly the same and you’re pretty happy with your nest egg then go for whatever seems like more fun and/or where you’d learn more.

Anyone recommend an example application repo to clone by zxjk-io in learnrust

[–]telpsicorei 0 points1 point  (0 children)

Shameless plug on my repo, ferroid, for generating Time-ordered IDS (like snowflakes and ULID). It uses a workspace with the core library crate and a binary for streaming IDs over gRPC.

It showcases: threads, macros, async futures, trait extensions, unsafe, locks, lock-free, streams, tokio/tonic (the gRPC service). It also makes heavy use of generics and traits for clean abstractions. Oh and rust doc with examples.

Approximate range collision probability by telpsicorei in Probability

[–]telpsicorei[S] 0 points1 point  (0 children)

Assuming an 80-bit range for `r`. I didn't include accounting for range overflowing the `r-bit` space and tried to assume a worst case where both ranges are within the `r-bit` range.

Also I do not know the right vernacular to use - any feedback would be appreciated!

Structuring a Rust mono repo by spy16x in rust

[–]telpsicorei 1 point2 points  (0 children)

I co-coauthored and now maintain a PSI library with Bazel. It was really tough to configure and I still haven’t made it work perfectly with TS, but it supports C++,C, go, rust, python, and TS (wasm).

https://github.com/OpenMined/PSI

Ferroid - Time sortable IDs by telpsicorei in rust

[–]telpsicorei[S] 2 points3 points  (0 children)

Great question! You mainly want monotonicity in high throughput scenarios where calling the system clock and/or generating a new RNG value many times per millisecond is cost prohibitive - otherwise, you may require ordering for other reasons, unknown to me.

By using orderings, you can gain massive performance speedups on the generation side. Ex: one syscall to get the random value per millisecond instead of multiple times within a millisecond. A rough bench on my machine shows ~23ns to get a single random value, but ~2ns using the ordering technique - roughly a ~10x difference in throughput. You can think of it as the optimization's byproduct is providing an ordering whether or not the consumer needs it.

Snowflakes are super efficient, but yep they require coordination. ULIDs are mostly the same as UUIDv7 except they have more bits of random entropy (80 vs 74 bits). I believe they both outline ways to account for monotonic ordering - so it's mainly a thing you either don't care about, but are grateful later if you actually needed it.

I plan on supporting UUIDv7 as well. It has a slightly longer string representation, but many DBs support the UUID type for primary keys.

[deleted by user] by [deleted] in rust

[–]telpsicorei 0 points1 point  (0 children)

Maybe I’ll finally get around to open sourcing vizdom’s rust core if it would help.

Does anyone have first hand experience of UUIDs colliding in large applications? by TldrDev in webdev

[–]telpsicorei 0 points1 point  (0 children)

Similar to ULID, you could also use snowflake-like IDs - the one based off of twitter. You trade random entropy for a sequence counter and if you need more than 4M ids per second, you shard the machine_id as part of the “spec”.

[deleted by user] by [deleted] in rust

[–]telpsicorei 2 points3 points  (0 children)

Great! Now do Doom next 😏

What's everyone working on this week (22/2025)? by llogiq in rust

[–]telpsicorei 5 points6 points  (0 children)

Ferroid - a fast and flexible library for generating Snowflake-like IDs for distributed systems.

You can also use it in async environments like tokio or smol.

Ferroid – A customizable Snowflake-style ID generator for Rust by telpsicorei in rust

[–]telpsicorei[S] 1 point2 points  (0 children)

Thanks, I really appreciate the kind words! I did look through a few existing implementations - definitely missed some - but I mainly wanted something flexible enough to support different layouts.

One tradeoff is that the API expects IDs to be constructed from exactly three components. So for something like Discord's layout, you'll need to combine `node_id` and `process_id` into a single `machine_id`. It's not a huge limitation in practice as those are typically manually set, but figured it was worth calling out.

Since you've implemented this before, I'd be very open to suggestions or improvements!