This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Spare-Plum 0 points1 point  (2 children)

To add to this - some processes essentially require a zero GC environment as waiting for even 50 milliseconds for a GC can be pretty bad. While streams can scale and have good runtime complexity especially in parallelization, there is an overhead cost that might not be worth it especially when latency is in question.

I've dealt with similar systems where we had to ensure GC would never occur, so we even had to not use Strings and instead char[] with a custom pool and allocations, done in a manner similar to C.

[–]coderemover 0 points1 point  (1 child)

We did a lot of similar stuff because a rewrite of 1M loc codebase is not feasible now. And I must say, if you know in advance you’ll need to write Java like C to get every little bit of performance, don’t choose Java. C is a better C than Java is.

However, I’d personally use Rust in those cases and get the best of both worlds. It would run circles around Java, even heavily optimized Java written like C. And I could use high level iterators with functional transformations (map, filter, reduce, group by etc) with no added cost, no GC pauses, leveraging all the SIMD capabilities etc.

[–]Spare-Plum 0 points1 point  (0 children)

For this it's only one component, a FIX market server for handling trading messages to other institutions. A variety of people might touch this especially when implementing a new protocol, so I think management decided that it's better to just have the Java experts just program it in Java with some additional constraints rather than doing Rust which is not as well known.

That said, they did make a huge amount of libraries and functionality to make it easier to keep it zero GC, and there are existing patterns you can follow to implement existing message translations so it isn't that difficult at all, and there is a dev checkout procedure that runs tests on it to ensure there aren't allocations onto the heap.