Hacker Newsnew | past | comments | ask | show | jobs | submit | mattclarkdotnet's commentslogin

Sorry if this is obvious to Java experts, but much as parallel GC is fine for batch workloads, is there a case for explicit GC control for web workloads? For example a single request to a web server will create a bunch of objects, but then when it completes 200ms later they can all be destroyed, so why even run GC during the request thread execution?

There are a few ways of looking at this:

- Purely on the JVM, you probably want ZGC (or Shenandoah) because latency is more important than throughput.

- On Erlang / the BEAM VM, each thread gets its own private heap, so GC is a per thread operation. If the request doesn't spill over the heap then GC would never need to run during a request handler and all memory could be reclaimed when the handler finishes.

- There can still be cases where a request handler allocates memory that is no solely owned by it. E.g. if it causes a new database connection to be allocated in a connection pool, that connection is not owned by the request handler and should not be deallocated when the handler finishes.

- The general idea you're getting at is often called "memory regions": you can point to a scope in the code and say "all the memory can be freed when this scope exits". In this case the scope is the request handler. It's the same idea behind arena or slab memory allocation. There are languages that can encode this, and do safe automatic memory management without GC. Rust is an obvious example, but I don't find it very ergonomic. I think the OxCaml [1] and Scala 3 [2] approaches are better.

[1]: https://oxcaml.org/documentation/stack-allocation/reference/

[2]: https://docs.scala-lang.org/scala3/reference/experimental/cc...


See also arena allocation, for realtime systems. But those systems typically require that any task have a reasonably tight upper bound on memory usage.

Thank you, that’s what I came here to learn!

Most web request cases where you care about performance probably have multiple parallel web requests, so there’s no clean separation possible?

Sure, but each request has its own context. Shared resources like DB connection pools will be longer lived but by definition they aren’t alllcated by the request thread. So why not simply exempt everything allocated by a request thread from GC, and simply destroy it on request completion?

Go tried that [1], a failed experiment that was a complex NIH version of the generational hypothesis. They currently use a CMS-stye collector.

[1] https://docs.google.com/document/d/1gCsFxXamW8RRvOe5hECz98Ft...


Generational GC assumes that short lived objects tend to come in groups, which is probably the best you can do in an OO language with shared everything.

His question is still valid for latency. That parallel GC in Java still seems to pause threads from a quick search. https://inside.java/2022/08/01/sip062/

That's why we got ZGC and Shenandoah, and their generational variants, which have very low pause times (in the order of 1 ms)

So… XP was the right way all along?

2+2 might well not equal 4, since you haven’t specified the base of the numbers or the modulus of the addition.

And what if it’s a full service car wash and you’ve parked nearby because it’s full so you walk over and give them the keys?

Assumptions make asses of us all…


So you're saying it would be useful for an "AI assistant" to ask you for the base each time you give it a math problem? Do you also want it to ask you if you're using the conventional definitions of "2" and "+"? For the car wash, would you like it to ask if you're on Earth or on Mars? Do you have air in your tires? Is the car actually a toy car?

Some assumptions are always necessary and reasonable, that's why I'm saying the "AI" lacks common sense.


Seems like you’re the one not applying common sense now!

Yes, that is exactly the point of my comment. Illustrating that disregarding normal (=common) assumptions (=sense) is a lack of common sense.

Fully agreed. It’s like the bad phrasings of the Monty Hall problem where it’s not made clear Monty actively chooses to show a goat.

Because inference costs are negligible compared to training costs

AGI is completely orthogonal to consciousness. Crows seem pretty conscious to me, as does my cat, but I have no way to test or prove it. They are intelligent though.

You are right, but many people trust it.

P.S., hope your cat have nice day.


What? Nobody says cubic zirconia is an artificial diamond, it’s just a different shiny crystal. We have loads of actual artificial diamonds, so cheap you can get a cutting disc made fr9m them for $10 at home depot.

And nobody working in the space either as ML/AI practitioners, or as philosophers, or as cognitive scientists, even thinks we know what consciousness is, or what is required to create it. So there would be no way to tell if an AI is conscious because we haven’t yet managed to reliably tell if humans, or dogs, or chimpanzees or whales are conscious.

The claim that is often made is that more work on the current generation of AI tech will lead to AGI at a human or better level. I agree with Yann Lecun that this is unlikely.


I'm pretty sure mammals and birds are conscious. Insects, probably not.

Why? Are you arguing that insects are purely automatons? I personally don't have a strong view on insects, but my intuition is that there are different degrees of consciousness, and feel natural to attribute some consciousness to insects, and even individual amoebas, and maybe even (as in Chalmers's famous example) to thermostats.

I would draw a separate line around sapience, and particularly the capacity for suffering, maybe indeed attributing it to mammals and birds but not insects, but consciousness seems more widespread to me.


Bees seem like they know what's going on. What about a cell, though? A virus?

It depends on the cell; an amoeba for example clearly seems to know what's going on around it. A virus on the other hand, having no metabolism of its own clearly doesn't.

If you were to force the choice I might agree. But I’d prefer to think there’s likely a sliding scale in operation here. Even humans aren’t conscious all the time, or equally conscious at all times. It will be an amazing day when we figure this out.

I know lots of people who had the offer to work in gambling but chose not to take it for moral reasons


I had an offer to work in gambling as a young inexperienced student, fortunately they didn't hire me because I was too inexperienced. I can imagine how my career would move if my first working experience was in such company. Some people might be like that.


Presumably you mean a “trolley” not a “stroller”, because strollers are for moving children not luggage

But yeah, free airport trolleys are are an easy marker of evolved civilisations, and the USA fails this test.

Countries that have passed this test for me that I can recall: Australia, Greece, Singapore, China, UK, Thailand, Italy, Spain…


So much this. We had a rental BYD in Greece this summer, and while it was actually great car in general the mandated “assistance” was awful.

It constantly got the speed limits wrong, constantly tried to tug me out of the correct lane, and was generally awful. It could be disabled but was re-enabled on each restart of the ignition because it’s mandated by EU regulation.

I appreciate a Greek island perimeter road may be a worst case scenario, but it did the same with roadworks on the freeway and many other situations.

Actively dangerous in my experience…


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: