really the big sin of java and .net's GC is they keep wanting to pretend they don't exist. a GC should always be explicit. let me know you are going to stop the world so i can immediately go fail the health check and stop routing jobs to me while i clean up my gigabyte stack of shit

@icedquinn Not sure I agree. The whole point of the GC not being explicit is to reduce human error, and it does a good job at that. Java performance compared to many other interpreted languages is exceptional (not so much .net).

You also do have the ability to "suggest" the invocation of garbage collection should you need to add some explicit control to speed things up. but it rarely makes much of a difference.

@freemo they stop the world without telling the process, which is the sin. nim used an incremental gc (until they rewrote it all to use refcounting :blobcatshrug2:) so we could collect between game frames. the hoard of c# games doesn't scavenge time when its opportune and just framedrops at random ass times.

there's a lot of deployments where its actually fine for the GC to stop the world, it just needs to tell the load balancer about it ahead of time

@icedquinn

> they stop the world without telling the process

No not really. The GC doesnt freeze your program, it is smart enough to work within the idle time most of the time. You'd be hard pressed to get the GC to glitch your program or slow things down compared to manually doing it. If you do it manually and do a really good job in almost all situations I you will likely get improvements so minimal you could barely measure it.

@freemo not talking about the total clock time to collect. ref counting does constantly pay that cost. talking about the response time.

with a GC there i always a threat of sudden syncopation

@icedquinn If you are worried about momentary latency at moments when latency is super critical then use the Java Real-time specification, JSR1

@freemo it's really not that hard to communicate with a GC in the form of

"hey, this is a good stop point. do you want to stop?" and if yes, signal the service down and go to sleep until its done repacking the 8gb heap.

java/c# don't let you do that, though.
@icedquinn @freemo

So many Enterprise software and server solutions still use Java for their critical infrastructure today.

I worked for an S3-compatible company that uses Cassandra for the DB and all the other components were made in Java....GC definitely caused issues. The GC disadvantages must not outway the benefits of Java
@verita84 @freemo the enterprise people are where i read about monstrously sized stacks and heaps with nontrivial processing times.

you can route around some of it at the mq layer, like telling rabbit to only dispense one message per acknowledgement. then when the app server inevitably takes its shit, only two requests in flight are stalled. or one job, in a pull system.

you get stuff like shenandoah which is a very complex collector. but you won't get an interrupt "GC IS ABOUT TO HAPPEN! PANIC!" or an option to pre-emptively warn the system. there is typically a command to attempt a collection right now, but its not probative. if the gc was doing to do it it takes that as an invitation to do it now, rather than let you prep for it.

afaik enterprise code just invests in more gcs that strive to be better at being invisible, rather than cooperative ones.
@icedquinn @freemo @verita84 lmao reminds me of that story about Instagram, where they simply disabled GC completely and restarted the process if it ran out of memory. Best GC tactic ever!
@newt walter bright also uses the "never-free" strategy in his compilers. blows everyone else out of the water for performance.

as a bonus your supervisor process can catch child death and signal the worker is down, although with some criu abuse you can probably get that service restarted extremely quick.
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.