Better HN
topnewbestaskshowjobs
Log inSign up

dfa11

14 karma · joined Apr 11, 2026 (7mo ago) · 22 submissions

https://dfa1.github.io/
Submissions

comment 3w ago · link · parent

I maintain rocksdb-ffm, a RocksDB binding for Java 25+ built on the Foreign Function & Memory API (no JNI, zero-copy via MemorySegment, just wrapping the C API in c.h).

I've now wrapped everything c.h offers, including every compression method and most of options. What's left is stuff the C API doesn't expose, such library version and build info (C macros aren't queryable via FFM), some event listener callbacks (useful for observability: JFR, Micrometer, OpenTelemetry), env, wide columns and secondary cache, secondary indexes and most likely more stuff I don't know yet.

rocksdbjni gets around this by linking C++ directly but my library can't call C++ in a stable way (name mangling, std::string layouts that vary by libc++), so the idea is to maintain a small patch on top of the C API: in the build that adds extern "C" functions next to db/c.cc. The idea is to "incubate" the patches in the library and, at the same time, to open a pull-request upstream for each of them (i.e. https://github.com/meta/rocksdb/pull/15141).

My questions:

1. Is a separate patch file the right mechanism? Do you see other solutions?

2. Is "everything is upstreamed too" realistic? What did you learn contributing to RocksDB or similar projects?

comment 2mo ago · link · parent

Dictionary Compression for Microservices notes

comment 6mo ago · link · parent

> Underengineering (I just invented this term): Too little engineering and too few patterns for a complex problem.

actually this is well-known: like a PoC that goes to production...

comment 6mo ago · link · parent

yeah 100% agree! In some critical area, I'm forced to drop all the "good things" and pack 2 shorts into 1 int to build a tuple(short,short)...

comment 6mo ago · link · parent

True: this compiles and the test passes today on JDK 27-jep401ea3:

  record Person(String name, Age age, Iban iban) {}

  // {"name": "SuperMario", "age": null, "iban": null}
  Person result = mapper.readValue(json, Person.class);

  assertThat(result.age()).isNull();   // passes — value class field, null
  assertThat(result.iban()).isNull();  // passes — value class field, null

  Jackson bypasses the constructor for null JSON tokens (getNullValue() short-circuits), so the
  validation in new Age(...) never runs. Both Age and Iban are value classes; both fields are null.
What do you think? Of course, there are limitations as Person cannot be flattened anymore but I guess Valhalla will ship more JEPs later?

comment 6mo ago · link · parent

Valhalla removes the historical performance tax on tiny domain objects. This article argues that value classes finally make domain‑safe primitives practical in real systems — strong invariants, flat layout, no wrapper overhead.

I’d love feedback from folks who’ve experimented with Valhalla or have opinions on modelling domain types in Java.

7.

Java: Rethink Domain Primitives with Valhalla(dfa1.github.io ↗)

31 points · by dfa11 · 6mo ago · 11 comments

8.

Show HN: Java RocksDB Without JNI(github.com ↗)

3 points · by dfa11 · 7mo ago · discuss

comment 7mo ago · link · parent

this is really interesting +1 star

PS is there a plan to include hermetic builds, from local sources / git submodules?