H
HN HRCB top | past | comments | ask | show | jobs | articles | domains | dashboard | seldon | network | factions | velocity | about hrcb
+0.17 Read Locks Are Not Your Friends (eventual-consistency.vercel.app)
25 points by emschwartz 3 days ago | 21 comments on HN | Mild positive Editorial · v3.7 · 2026-02-26
Summary Technical Knowledge Access Acknowledges
This technical blog post discusses concurrent programming performance optimization in Rust, with minimal direct engagement with human rights frameworks. The content demonstrates a mild positive disposition toward Article 19 (free expression of technical knowledge) and Article 27 (participation in scientific advancement) through open publication and empirical sharing, but exhibits negative signals regarding Article 26 (education access) due to specialized jargon and accessibility barriers. Overall, the content is substantively neutral regarding human rights, addressing technical rather than rights-centered concerns.
Article Heatmap
Preamble: ND — Preamble Preamble: No Data — Preamble P Article 1: ND — Freedom, Equality, Brotherhood Article 1: No Data — Freedom, Equality, Brotherhood 1 Article 2: ND — Non-Discrimination Article 2: No Data — Non-Discrimination 2 Article 3: ND — Life, Liberty, Security Article 3: No Data — Life, Liberty, Security 3 Article 4: ND — No Slavery Article 4: No Data — No Slavery 4 Article 5: ND — No Torture Article 5: No Data — No Torture 5 Article 6: ND — Legal Personhood Article 6: No Data — Legal Personhood 6 Article 7: ND — Equality Before Law Article 7: No Data — Equality Before Law 7 Article 8: ND — Right to Remedy Article 8: No Data — Right to Remedy 8 Article 9: ND — No Arbitrary Detention Article 9: No Data — No Arbitrary Detention 9 Article 10: ND — Fair Hearing Article 10: No Data — Fair Hearing 10 Article 11: ND — Presumption of Innocence Article 11: No Data — Presumption of Innocence 11 Article 12: ND — Privacy Article 12: No Data — Privacy 12 Article 13: ND — Freedom of Movement Article 13: No Data — Freedom of Movement 13 Article 14: ND — Asylum Article 14: No Data — Asylum 14 Article 15: ND — Nationality Article 15: No Data — Nationality 15 Article 16: ND — Marriage & Family Article 16: No Data — Marriage & Family 16 Article 17: ND — Property Article 17: No Data — Property 17 Article 18: ND — Freedom of Thought Article 18: No Data — Freedom of Thought 18 Article 19: +0.24 — Freedom of Expression 19 Article 20: ND — Assembly & Association Article 20: No Data — Assembly & Association 20 Article 21: ND — Political Participation Article 21: No Data — Political Participation 21 Article 22: ND — Social Security Article 22: No Data — Social Security 22 Article 23: ND — Work & Equal Pay Article 23: No Data — Work & Equal Pay 23 Article 24: ND — Rest & Leisure Article 24: No Data — Rest & Leisure 24 Article 25: ND — Standard of Living Article 25: No Data — Standard of Living 25 Article 26: -0.36 — Education 26 Article 27: +0.64 — Cultural Participation 27 Article 28: ND — Social & International Order Article 28: No Data — Social & International Order 28 Article 29: +0.15 — Duties to Community 29 Article 30: ND — No Destruction of Rights Article 30: No Data — No Destruction of Rights 30
Negative Neutral Positive No Data
Aggregates
Weighted Mean +0.17 Unweighted Mean +0.17
Max +0.64 Article 27 Min -0.36 Article 26
Signal 4 No Data 27
Confidence 8% Volatility 0.36 (High)
Negative 1 Channels E: 0.6 S: 0.4
SETL -0.18 Structural-dominant
FW Ratio 61% 11 facts · 7 inferences
Evidence: High: 0 Medium: 4 Low: 0 No Data: 27
Theme Radar
Foundation Security Legal Privacy & Movement Personal Expression Economic & Social Cultural Order & Duties Foundation: 0.00 (0 articles) Security: 0.00 (0 articles) Legal: 0.00 (0 articles) Privacy & Movement: 0.00 (0 articles) Personal: 0.00 (0 articles) Expression: 0.24 (1 articles) Economic & Social: 0.00 (0 articles) Cultural: 0.14 (2 articles) Order & Duties: 0.15 (1 articles)
HN Discussion 10 top-level · 9 replies
whizzter 2026-02-25 12:09 UTC link
I'd be super interested in how this compares between cpu architectures, is there an optimization in Apple silicon that makes this bad while it'd fly on Intel/AMD cpus?
_dky 2026-02-25 12:18 UTC link
If implementation is task based and task always runs on same virtual CPU (slots equaling CPUs or parallelism), wonder if something like below might help.

RW lock could be implemented using an array of length equal to slots and proper padding to ensure each slot is in its own face line (avoid invalidating CPU cache when different slot is read/written).

For read lock: Each task acquires the lock for their slot.

For write lock: Acquire lock from left most slot to right. Writes can starve readers when they block on in-flight reader at a different slot when moving from left to right.

I do not know how Rust RW locks are implemented.

amluto 2026-02-25 12:29 UTC link
The code examples are confusing. The show the code that takes the locks, but they don’t show any of the data structures involved. The rwlock variant clones the Arc (makes sense), but the mutex variant does not (is it hidden inside inner.get)?

In any case, optimizing this well would require a lot more knowledge of what’s going on under the hood. What are the keys? Can the entire map be split into several maps? Can a reader hold the rwlock across multiple lookups? Is a data structure using something like RCU an option?

Retr0id 2026-02-25 12:31 UTC link
claudes love to talk about The Hardware Reality
ot 2026-02-25 12:39 UTC link
This is drawing broad conclusions from a specific RW mutex implementation. Other implementations adopt techniques to make the readers scale linearly in the read-mostly case by using per-core state (the drawback is that write locks need to scan it).

One example is folly::SharedMutex, which is very battle-tested: https://uvdn7.github.io/shared-mutex/

There are more sophisticated techniques such as RCU or hazard pointers that make synchronization overhead almost negligible for readers, but they generally require to design the algorithms around them and are not drop-in replacements for a simple mutex, so a good RW mutex implementation is a reasonable default.

api 2026-02-25 12:50 UTC link
Take a look at crates like arc_swap if you have a read often write rarely lock case. You can easily implement the RCU pattern. Just be sure to read about how to use RCU properly.

Well done this pattern gives you nearly free reads and cheap writes, sometimes cheaper than a lock.

For frequent writes a good RWLock is often better since RCU can degrade rapidly and badly under write contention.

sevensor 2026-02-25 13:04 UTC link
Does this apply also to std::shared_mutex in C++? This is a timely article if so; I’m in the middle of doing some C++ multithreading that relies on a shared_mutex. I have some measuring to do.
alecco 2026-02-25 14:29 UTC link
It always amazes me the amount these folks are willing to work and struggle just to avoid reading basic database literature.

Also Fedor Pikus has some nice cppcon talks from years ago on all this. Very low level.

armon 2026-02-25 17:16 UTC link
Lock contention is a real issue for any multi-threaded system, and while a RW mutex is useful when you have a longer executing critical section, for something very short lived there is still a cache coordination cost. In many of the HashiCorp applications, we work around this by using an immutable radix tree design instead [1].

Instead of a RW mutex, you have a single writer lock. Any writer acquires the lock, makes changes, and generates a new root pointer to the tree (any update operation generates a new root, because the tree is immutable). Then we do an atomic swap from the old root to the new root. Any readers do an atomic read of the current point in time root, and perform their read operations lock free. This is safe because the tree is immutable, so readers don't need to be concerned with another thread modifying the tree concurrently, any modifications will create a new tree. This is a pattern we've standardized with a library we call MemDB [2].

This has the advantage of making reads multi-core scalable with much lower lock contention. Given we typically use Raft for distributed consensus, you only have a single writer anyways (e.g. the FSM commit thread is the only writer).

We apply this pattern to Vault, Consul, and Nomad all of which are able to scale to many dozens of cores, with largely a linear speedup in read performance.

[1] https://github.com/hashicorp/go-immutable-radix [2] https://github.com/hashicorp/go-memdb

squirrellous 2026-02-26 01:11 UTC link
I’ve seen so many people fall into this trap. Have to wonder if it’s the API design of rwlock that’s wrong because it leads to misuse.
hansvm 2026-02-25 12:19 UTC link
I've observed the same behavior on AMD and Intel at $WORK. Our solution (ideal for us, reads happening roughly 1B times more often than writes) was to pessimize writes in favour of reads and add some per-thread state to prevent cache line sharing.

We also tossed in an A/B system, so reads aren't delayed even while writes are happening; they just get stale data (also fine for our purposes).

stuaxo 2026-02-25 12:37 UTC link
"The performance Death Spiral" was the point I realised I was being LLMd and bailed out.
gpderetta 2026-02-25 12:48 UTC link
the behaviour is quite typical for any MESI style cache coherence system (i.e. most if not all of them).

A specific microarchitecture might alleviate this a bit with lower latency cross-core communication, but the solution (using a single naive RW lock to protect the cache) is inherently non-scalable.

PaulHoule 2026-02-25 12:52 UTC link
I think it’s not unusual that reader-writer locks, even if well implemented, get in places where there are so many readers stacked up that writers never get to get a turn or 1 writer winds up holding up N readers which is not so scalable as you increase N.
mike_hearn 2026-02-25 12:56 UTC link
Right, and if you're on the JVM you have access to things like ConcurrentHashMap which is lock free.
PunchyHamster 2026-02-25 12:57 UTC link
Read lock requires communication between cores. It just can't scale with CPU count
Jyaif 2026-02-25 13:05 UTC link
And a Rust equivalent of folly::SharedMutex: https://docs.rs/crossbeam-utils/latest/crossbeam_utils/sync/...
gpderetta 2026-02-25 13:19 UTC link
mostly yes.
amluto 2026-02-25 16:05 UTC link
Wow, folly::SharedMutex is quite an example of design tradeoffs. I wonder what application the authors wanted it for where using a global array was better than a per-mutex array.
Editorial Channel
What the content says
+0.40
Article 27 Cultural Participation
Medium Advocacy Practice
Editorial
+0.40
SETL
-0.22

Content celebrates technical achievement and optimization in the context of building 'high-performance' software (Redstone tensor cache). The narrative frames engineering excellence and efficient systems as positive contributions to human capability, consistent with Article 27's protection of participation in cultural and scientific advancement.

+0.20
Article 19 Freedom of Expression
Medium Advocacy
Editorial
+0.20
SETL
-0.17

Content advocates for open sharing of technical knowledge and empirical findings without restriction. The author publicly shares performance benchmarks, challenges conventional wisdom, and encourages replication and verification—all core expressions of free thought and expression in technical discourse.

+0.15
Article 29 Duties to Community
Medium Advocacy
Editorial
+0.15
SETL
ND

The post implicitly advocates for responsible use of technical knowledge. The author emphasizes that 'obvious optimizations can backfire' and stresses the need for empirical verification through profiling, discouraging blind application of conventional wisdom and promoting thoughtful, evidence-based decision-making. This aligns with Article 29's call for duties toward the community and responsible exercise of rights.

-0.25
Article 26 Education
Medium Practice
Editorial
-0.25
SETL
-0.16

Content is presented in highly technical language (Rust syntax, atomic operations, cache-line mechanics) that presupposes specialized knowledge in systems programming. This limits accessibility for persons without software engineering background, creating a structural barrier to education and participation in technical discourse.

ND
Preamble Preamble
null

Content does not engage with the Preamble's principles regarding human dignity, equal rights, or social progress.

ND
Article 1 Freedom, Equality, Brotherhood
null

Content does not address equality and dignity in any substantive way.

ND
Article 2 Non-Discrimination
null

Content does not discuss discrimination or protected characteristics.

ND
Article 3 Life, Liberty, Security
null

Content does not address right to life, liberty, or security.

ND
Article 4 No Slavery
null

Content does not mention slavery or forced servitude.

ND
Article 5 No Torture
null

Content does not address torture or cruel treatment.

ND
Article 6 Legal Personhood
null

Content does not discuss right to recognition as a person before the law.

ND
Article 7 Equality Before Law
null

Content does not address equality before the law or protection from discrimination.

ND
Article 8 Right to Remedy
null

Content does not discuss remedies for rights violations.

ND
Article 9 No Arbitrary Detention
null

Content does not address arbitrary arrest or detention.

ND
Article 10 Fair Hearing
null

Content does not address right to fair and public hearing.

ND
Article 11 Presumption of Innocence
null

Content does not discuss criminal prosecution or innocence.

ND
Article 12 Privacy
null

Content does not address privacy, family, or home.

ND
Article 13 Freedom of Movement
null

Content does not discuss freedom of movement.

ND
Article 14 Asylum
null

Content does not address asylum or nationality.

ND
Article 15 Nationality
null

Content does not discuss nationality or state membership.

ND
Article 16 Marriage & Family
null

Content does not address marriage or family rights.

ND
Article 17 Property
null

Content does not discuss property rights.

ND
Article 18 Freedom of Thought
null

Content does not address conscience, religion, or belief.

ND
Article 20 Assembly & Association
null

Content does not address freedom of assembly or association.

ND
Article 21 Political Participation
null

Content does not address political participation or elections.

ND
Article 22 Social Security
null

Content does not address social security or welfare.

ND
Article 23 Work & Equal Pay
null

Content does not address labor rights, employment, or fair wages.

ND
Article 24 Rest & Leisure
null

Content does not address rest, leisure, or working hours.

ND
Article 25 Standard of Living
null

Content does not address health, food, housing, or medical care.

ND
Article 28 Social & International Order
null

Content does not address social order or framework for rights realization.

ND
Article 30 No Destruction of Rights
null

Content does not address limitation of rights or prevention of rights exercise.

Structural Channel
What the site does
Domain Context Profile
Element Modifier Affects Note
Privacy
No privacy policy or data collection disclosures observable on-domain.
Terms of Service
No terms of service or usage agreement visible.
Accessibility -0.15
Article 26
Fixed-width monospace font (JetBrains Mono) and low-contrast dark theme (gruvbox) may impede readability for users with visual impairments; no alt text observed for code blocks or technical diagrams.
Mission
No explicit mission statement or values disclosure on-domain.
Editorial Code
No editorial standards or corrections policy observable.
Ownership
Author credited as individual contributor; no corporate ownership or conflict-of-interest disclosures visible.
Access Model +0.20
Article 27
Content is freely accessible without authentication or paywalls, supporting unrestricted access to technical knowledge.
Ad/Tracking
No ads or tracking scripts observable on-domain; Vercel hosting may include minimal telemetry.
+0.50
Article 27 Cultural Participation
Medium Advocacy Practice
Structural
+0.50
Context Modifier
+0.20
SETL
-0.22

The blog infrastructure is freely accessible without paywalls, registration barriers, or licensing fees. Code examples and benchmarks are published openly, enabling others to benefit from and build upon the technical knowledge. No access restrictions limit participation in this scientific discourse.

+0.30
Article 19 Freedom of Expression
Medium Advocacy
Structural
+0.30
Context Modifier
0.00
SETL
-0.17

Content is freely accessible without authentication, registration, or paywalls. The blog structure permits unrestricted reading and sharing of technical insights, supporting unfettered dissemination of ideas.

-0.15
Article 26 Education
Medium Practice
Structural
-0.15
Context Modifier
-0.15
SETL
-0.16

The site's visual design employs low-contrast dark theme (gruvbox colors) with fixed-width monospace font, potentially hindering readability for users with visual impairments. No accessible alternatives (alt text, high-contrast mode, dyslexia-friendly fonts) are observable.

ND
Preamble Preamble
null

No structural features support or hinder Preamble principles; site is a technical blog.

ND
Article 1 Freedom, Equality, Brotherhood
null

No structural signals related to equal treatment or non-discrimination.

ND
Article 2 Non-Discrimination
null

No observable signals regarding non-discrimination practices.

ND
Article 3 Life, Liberty, Security
null

No structural signals related to personal security or safety.

ND
Article 4 No Slavery
null

No structural signals observable.

ND
Article 5 No Torture
null

No structural signals observable.

ND
Article 6 Legal Personhood
null

No structural signals observable.

ND
Article 7 Equality Before Law
null

No structural signals observable.

ND
Article 8 Right to Remedy
null

No structural signals observable.

ND
Article 9 No Arbitrary Detention
null

No structural signals observable.

ND
Article 10 Fair Hearing
null

No structural signals observable.

ND
Article 11 Presumption of Innocence
null

No structural signals observable.

ND
Article 12 Privacy
null

No structural signals observable.

ND
Article 13 Freedom of Movement
null

No structural signals observable.

ND
Article 14 Asylum
null

No structural signals observable.

ND
Article 15 Nationality
null

No structural signals observable.

ND
Article 16 Marriage & Family
null

No structural signals observable.

ND
Article 17 Property
null

No structural signals observable.

ND
Article 18 Freedom of Thought
null

No structural signals observable.

ND
Article 20 Assembly & Association
null

No structural signals observable.

ND
Article 21 Political Participation
null

No structural signals observable.

ND
Article 22 Social Security
null

No structural signals observable.

ND
Article 23 Work & Equal Pay
null

No structural signals observable.

ND
Article 24 Rest & Leisure
null

No structural signals observable.

ND
Article 25 Standard of Living
null

No structural signals observable.

ND
Article 28 Social & International Order
null

No structural signals observable.

ND
Article 29 Duties to Community
Medium Advocacy

No observable structural practices or policies related to responsibilities.

ND
Article 30 No Destruction of Rights
null

No structural signals observable.

Supplementary Signals
Epistemic Quality
0.76 medium claims
Sources
0.8
Evidence
0.8
Uncertainty
0.7
Purpose
0.8
Propaganda Flags
0 techniques detected
Solution Orientation
0.70 solution oriented
Reader Agency
0.8
Emotional Tone
measured
Valence
+0.1
Arousal
0.4
Dominance
0.5
Stakeholder Voice
0.35 2 perspectives
Speaks: individuals
About: corporation
Temporal Framing
present immediate
Geographic Scope
global
Complexity
technical high jargon domain specific
Transparency
0.50
✗ Author
Event Timeline 20 events
2026-02-26 02:33 eval_success Evaluated: Mild positive (0.17) - -
2026-02-26 02:30 dlq_replay DLQ message 214 replayed: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:54 dlq Dead-lettered after 1 attempts: Read Locks Are Not Your Friends - -
2026-02-26 01:13 eval_retry Anthropic API error 400 - -
2026-02-26 01:13 eval_failure Evaluation failed: Error: Anthropic API error 400: {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade o - -
2026-02-26 01:13 eval_failure Evaluation failed: Error: Anthropic API error 400: {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade o - -
2026-02-26 01:13 eval_failure Evaluation failed: Error: Anthropic API error 400: {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade o - -
2026-02-26 01:13 eval_retry Anthropic API error 400 - -
2026-02-26 01:13 eval_retry Anthropic API error 400 - -
2026-02-26 01:11 eval_failure Evaluation failed: Error: Anthropic API error 400: {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade o - -
2026-02-26 01:11 eval_retry Anthropic API error 400 - -
2026-02-26 01:11 eval_failure Evaluation failed: Error: Anthropic API error 400: {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade o - -
2026-02-26 01:11 eval_retry Anthropic API error 400 - -
About HRCB | By Right | HN Guidelines | HN FAQ | Source | UDHR | RSS
build 59cf82e+tpso · deployed 2026-02-26 02:38 UTC · evaluated 2026-02-26 04:18:40 UTC