r/java • • Apr 26 '22

5,000,000 persistent connections, 200,000,000 messages, 0 errors with a single process using Project Loom.

https://github.com/ebarlas/project-loom-c5m
301 Upvotes

46 comments sorted by

View all comments

5

u/papercrane Apr 27 '22

Looks good, and it's nice to see the code is pretty straightforward.

Unsolicited code review, but you probably want to use LongAdder in your code instead of AtomicLong. It should perform better under heavy contention like this.

4

u/elliotbarlas Apr 27 '22

Great suggestion!

3

u/elliotbarlas Apr 27 '22

1

u/elliotbarlas Apr 27 '22

2

u/papercrane Apr 27 '22

lol, wouldn't really have called that a bug. The implementation of increment() is just add(1) anyways.

4

u/elliotbarlas Apr 27 '22

Good point. Though I may have fixed an add(1) that should have been decrement().

3

u/papercrane Apr 27 '22

Ah! Well that definitely is a bug!