I saw this earlier too. It's a cute trick when you have discrete latency sensitive events of a fixed SLA (e.g. animation running at 60 fps in the article). But, when the arrival rate of latency sensitive tasks is random (or "constant"), you really don't know a priori whether you have idle time or not. Moreover, 16 millis is an eternity for some server workloads, and it's unlikely smaller time slices would suffice to get any meaningful GC done on a typical server heap.
Fundamentally, if you must ensure no jitter due to GC then you need to take control away from it. Otherwise, you're always subject to its heuristics/implementation details biting you.
sent from my phone
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Aug 11, 2015, at 4:57 AM, Vitaly Davidovich <vit...@gmail.com> wrote:I saw this earlier too. It's a cute trick when you have discrete latency sensitive events of a fixed SLA (e.g. animation running at 60 fps in the article). But, when the arrival rate of latency sensitive tasks is random (or "constant"), you really don't know a priori whether you have idle time or not. Moreover, 16 millis is an eternity for some server workloads, and it's unlikely smaller time slices would suffice to get any meaningful GC done on a typical server heap.
Fundamentally, if you must ensure no jitter due to GC then you need to take control away from it. Otherwise, you're always subject to its heuristics/implementation details biting you.
Indeed, it’s easy to tune to a fixed goal such as 16ms. You know how long it takes to process a frame. That tells you how long a pause you can tolerate. With fixed rates of arrival and fixed rates of garbage being created means you can schedule GC in the dead time after processing the frame completes and the vsync. As soon as you hit a web facing application with variable allocation rates scheduling becomes more probabilistic and deterministic.On Aug 11, 2015, at 4:57 AM, Vitaly Davidovich <vit...@gmail.com> wrote:I saw this earlier too. It's a cute trick when you have discrete latency sensitive events of a fixed SLA (e.g. animation running at 60 fps in the article). But, when the arrival rate of latency sensitive tasks is random (or "constant"), you really don't know a priori whether you have idle time or not. Moreover, 16 millis is an eternity for some server workloads, and it's unlikely smaller time slices would suffice to get any meaningful GC done on a typical server heap.
I like Cliff Clicks comment that the JVM gives you the illusion that you have infinite amount of memory. You don’t and if in the long term, your reclaim rate < allocation rate you can have all the control you want over your collector, your application is going to come to a grinding halt because that illusion is a leaky abstraction.Fundamentally, if you must ensure no jitter due to GC then you need to take control away from it. Otherwise, you're always subject to its heuristics/implementation details biting you.
Regards,Kirk
sent from my phone
On Aug 10, 2015 10:04 PM, "Jimmy Jia" <tes...@gmail.com> wrote:
I thought this piece might look interesting to some people here:Of course, 16.6 ms is an eternity and then some to most of us, but it's a cool technique. It's quite fascinating to me to see what techniques are available in "adjacent" fields, if you will.--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
Interestingly, .NET recently added something like that: https://msdn.microsoft.com/en-us/library/system.gc.trystartnogcregion(v=vs.110).aspx
sent from my phone
It would be nice if you could tell the jvm to enter a particular method in a timely and deterministic fashion. Something similar to realtime os capabilities. If the method completes before the deadline then the jvm can go and do its garbage collection or anything else it fancy to do. I remember there was ton of talks about real-tme java a while ago but that seems like it died down. This would be great for latency sensisitive apps instead of fiddling with gc. At the very least what this does is guaranties that when the system is under load you would still not exceed your maximum expected load and perform back pressure on the the stuff waiting in line.
On Tuesday, August 11, 2015 at 2:21:42 AM UTC-4, Kirk Pepperdine wrote:
Indeed, it’s easy to tune to a fixed goal such as 16ms. You know how long it takes to process a frame. That tells you how long a pause you can tolerate. With fixed rates of arrival and fixed rates of garbage being created means you can schedule GC in the dead time after processing the frame completes and the vsync. As soon as you hit a web facing application with variable allocation rates scheduling becomes more probabilistic and deterministic.On Aug 11, 2015, at 4:57 AM, Vitaly Davidovich <vit...@gmail.com> wrote:I saw this earlier too. It's a cute trick when you have discrete latency sensitive events of a fixed SLA (e.g. animation running at 60 fps in the article). But, when the arrival rate of latency sensitive tasks is random (or "constant"), you really don't know a priori whether you have idle time or not. Moreover, 16 millis is an eternity for some server workloads, and it's unlikely smaller time slices would suffice to get any meaningful GC done on a typical server heap.
I like Cliff Clicks comment that the JVM gives you the illusion that you have infinite amount of memory. You don’t and if in the long term, your reclaim rate < allocation rate you can have all the control you want over your collector, your application is going to come to a grinding halt because that illusion is a leaky abstraction.Fundamentally, if you must ensure no jitter due to GC then you need to take control away from it. Otherwise, you're always subject to its heuristics/implementation details biting you.
Regards,Kirk
sent from my phone
On Aug 10, 2015 10:04 PM, "Jimmy Jia" <tes...@gmail.com> wrote:
I thought this piece might look interesting to some people here:Of course, 16.6 ms is an eternity and then some to most of us, but it's a cool technique. It's quite fascinating to me to see what techniques are available in "adjacent" fields, if you will.--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
On Aug 12, 2015, at 3:39 PM, ymo <ymol...@gmail.com> wrote:It would be nice if you could tell the jvm to enter a particular method in a timely and deterministic fashion. Something similar to realtime os capabilities. If the method completes before the deadline then the jvm can go and do its garbage collection or anything else it fancy to do. I remember there was ton of talks about real-tme java a while ago but that seems like it died down. This would be great for latency sensisitive apps instead of fiddling with gc. At the very least what this does is guaranties that when the system is under load you would still not exceed your maximum expected load and perform back pressure on the the stuff waiting in line.
On Tuesday, August 11, 2015 at 2:21:42 AM UTC-4, Kirk Pepperdine wrote:Indeed, it’s easy to tune to a fixed goal such as 16ms. You know how long it takes to process a frame. That tells you how long a pause you can tolerate. With fixed rates of arrival and fixed rates of garbage being created means you can schedule GC in the dead time after processing the frame completes and the vsync. As soon as you hit a web facing application with variable allocation rates scheduling becomes more probabilistic and deterministic.On Aug 11, 2015, at 4:57 AM, Vitaly Davidovich <vit...@gmail.com> wrote:I saw this earlier too. It's a cute trick when you have discrete latency sensitive events of a fixed SLA (e.g. animation running at 60 fps in the article). But, when the arrival rate of latency sensitive tasks is random (or "constant"), you really don't know a priori whether you have idle time or not. Moreover, 16 millis is an eternity for some server workloads, and it's unlikely smaller time slices would suffice to get any meaningful GC done on a typical server heap.
I like Cliff Clicks comment that the JVM gives you the illusion that you have infinite amount of memory. You don’t and if in the long term, your reclaim rate < allocation rate you can have all the control you want over your collector, your application is going to come to a grinding halt because that illusion is a leaky abstraction.Fundamentally, if you must ensure no jitter due to GC then you need to take control away from it. Otherwise, you're always subject to its heuristics/implementation details biting you.
Regards,Kirksent from my phone
On Aug 10, 2015 10:04 PM, "Jimmy Jia" <tes...@gmail.com> wrote:I thought this piece might look interesting to some people here:Of course, 16.6 ms is an eternity and then some to most of us, but it's a cool technique. It's quite fascinating to me to see what techniques are available in "adjacent" fields, if you will.--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
On Aug 12, 2015, at 8:30 PM, Jimmy Jia <tes...@gmail.com> wrote:I think the lesson to learn is that GC intrusiveness can be reduced when there's some awareness of the problem domain at hand.
In some sense, the JVM does the worst possible thing in initiating GC on allocation, because that's exactly when you know for sure that you aren't idle!
If you write everything GC-free, it's not a big deal - this is more for cases where you are mostly idle; even if events arrive randomly, it seems like you ought to be able to reduce the probability of GC happening when you care. Something like calling System.gc() yourself, but perhaps with a bit more control (i.e. I've made the calculation that if I give the JVM 20 ms to GC now, in expectation that speeds up future request handling).
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
Interestingly, .NET recently added something like that: https://msdn.microsoft.com/en-us/library/system.gc.trystartnogcregion(v=vs.110).aspx
sent from my phone
On Aug 12, 2015 9:39 AM, "ymo" <ymol...@gmail.com> wrote:
It would be nice if you could tell the jvm to enter a particular method in a timely and deterministic fashion. Something similar to realtime os capabilities. If the method completes before the deadline then the jvm can go and do its garbage collection or anything else it fancy to do. I remember there was ton of talks about real-tme java a while ago but that seems like it died down. This would be great for latency sensisitive apps instead of fiddling with gc. At the very least what this does is guaranties that when the system is under load you would still not exceed your maximum expected load and perform back pressure on the the stuff waiting in line.
On Tuesday, August 11, 2015 at 2:21:42 AM UTC-4, Kirk Pepperdine wrote:
Indeed, it’s easy to tune to a fixed goal such as 16ms. You know how long it takes to process a frame. That tells you how long a pause you can tolerate. With fixed rates of arrival and fixed rates of garbage being created means you can schedule GC in the dead time after processing the frame completes and the vsync. As soon as you hit a web facing application with variable allocation rates scheduling becomes more probabilistic and deterministic.On Aug 11, 2015, at 4:57 AM, Vitaly Davidovich <vit...@gmail.com> wrote:I saw this earlier too. It's a cute trick when you have discrete latency sensitive events of a fixed SLA (e.g. animation running at 60 fps in the article). But, when the arrival rate of latency sensitive tasks is random (or "constant"), you really don't know a priori whether you have idle time or not. Moreover, 16 millis is an eternity for some server workloads, and it's unlikely smaller time slices would suffice to get any meaningful GC done on a typical server heap.
I like Cliff Clicks comment that the JVM gives you the illusion that you have infinite amount of memory. You don’t and if in the long term, your reclaim rate < allocation rate you can have all the control you want over your collector, your application is going to come to a grinding halt because that illusion is a leaky abstraction.Fundamentally, if you must ensure no jitter due to GC then you need to take control away from it. Otherwise, you're always subject to its heuristics/implementation details biting you.
Regards,Kirk
sent from my phone
On Aug 10, 2015 10:04 PM, "Jimmy Jia" <tes...@gmail.com> wrote:
I thought this piece might look interesting to some people here:Of course, 16.6 ms is an eternity and then some to most of us, but it's a cool technique. It's quite fascinating to me to see what techniques are available in "adjacent" fields, if you will.--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
Yeah, there are other pause sources in the JVM. The GC ones, however, are the ones people mostly tend to notice (and thus try to avoid/shorten) even outside the low latency space. The chief reason, I suspect, is because the GC pauses don't scale well with increasing heap sizes whereas the other ones (monitor deflation, biased lock revocation, nmethod sweeping, nmethod hotness marking, compiler deoptimizations) tend to stay relatively constant (increasing thread count could bump some of those as well). So although there's no hard realtime guarantees (besides the JVM, the OS can induce some anyway), folks tend to try minimizing the ones inflicting the most noticeable performance penalties.
As for CLR, it doesn't have some of the safepoint tasks that are performed by the JVM (e.g. no nmethod sweeping/hotness marking, no biased lock revocation, no compiler deopt) so GC tends to be the only runtime induced pause.
sent from my phone
Depending on JVM, there is already a (non-guaranteed, implementation dependent) way to suppress GC activity during a critical execution section using GetPrimitiveArrayCritical() and ReleasePrimitiveArrayCritical() from JNI. HotSpot variants (including Oracle JVM, OpenJDK, and Zing) implement GetPrimitiveArrayCritical() by suppressing GC until the matching ReleasePrimitiveArrayCritical() is called.Note that is not guaranteed (spec'ed) behavior. GetPrimitiveArrayCritical() MAY be implemented with object pinning (which would just disable the relocation of the specific array, but not block GC) or with copying (producing an off-heap copy of the array for JNI to operate on when GetPrimitiveArrayCritical() is called, and copying it's contents back to the on-heap array when ReleasePrimitiveArrayCritical() is called). The fact that HotSpot variants implement GetPrimitiveArrayCritical() by delaying GC until the release is an implementation detail that cannot be relied on in the long term...
Also note the strong limitation on using this GetCrtical/ReleaseCritical method. It is assumed to (A) be very short lived, and (B) not depend on allocation of Java objects to proceed. (A) is obvious. (B) is needed to avoid deadlocks (critical code wits for something to allocate a java object, java object allocation waits for GC to free memory, GC waits for critical code to complete).And last, preventing GC from proceeding is not the same as guaranteeing no interruption or stalls in the executed code. GC is just one of many things that causes a modern JVM to stall, so delaying GC will not guarantee anything close to determinsitic execution. For an overview of *some* of the many things that can make a JVM pause, you can view John Cuthbertson's excellent presentation on "What els makes a JVM pause" at https://www.youtube.com/watch?v=Y39kllzX1P8 .
On Wednesday, August 12, 2015 at 3:52:47 AM UTC-10, Vitaly Davidovich wrote:
Interestingly, .NET recently added something like that: https://msdn.microsoft.com/en-us/library/system.gc.trystartnogcregion(v=vs.110).aspx
sent from my phone
On Aug 12, 2015 9:39 AM, "ymo" <ymol...@gmail.com> wrote:
It would be nice if you could tell the jvm to enter a particular method in a timely and deterministic fashion. Something similar to realtime os capabilities. If the method completes before the deadline then the jvm can go and do its garbage collection or anything else it fancy to do. I remember there was ton of talks about real-tme java a while ago but that seems like it died down. This would be great for latency sensisitive apps instead of fiddling with gc. At the very least what this does is guaranties that when the system is under load you would still not exceed your maximum expected load and perform back pressure on the the stuff waiting in line.
On Tuesday, August 11, 2015 at 2:21:42 AM UTC-4, Kirk Pepperdine wrote:
Indeed, it’s easy to tune to a fixed goal such as 16ms. You know how long it takes to process a frame. That tells you how long a pause you can tolerate. With fixed rates of arrival and fixed rates of garbage being created means you can schedule GC in the dead time after processing the frame completes and the vsync. As soon as you hit a web facing application with variable allocation rates scheduling becomes more probabilistic and deterministic.On Aug 11, 2015, at 4:57 AM, Vitaly Davidovich <vit...@gmail.com> wrote:I saw this earlier too. It's a cute trick when you have discrete latency sensitive events of a fixed SLA (e.g. animation running at 60 fps in the article). But, when the arrival rate of latency sensitive tasks is random (or "constant"), you really don't know a priori whether you have idle time or not. Moreover, 16 millis is an eternity for some server workloads, and it's unlikely smaller time slices would suffice to get any meaningful GC done on a typical server heap.
I like Cliff Clicks comment that the JVM gives you the illusion that you have infinite amount of memory. You don’t and if in the long term, your reclaim rate < allocation rate you can have all the control you want over your collector, your application is going to come to a grinding halt because that illusion is a leaky abstraction.Fundamentally, if you must ensure no jitter due to GC then you need to take control away from it. Otherwise, you're always subject to its heuristics/implementation details biting you.
Regards,Kirk
sent from my phone
On Aug 10, 2015 10:04 PM, "Jimmy Jia" <tes...@gmail.com> wrote:
I thought this piece might look interesting to some people here:Of course, 16.6 ms is an eternity and then some to most of us, but it's a cool technique. It's quite fascinating to me to see what techniques are available in "adjacent" fields, if you will.--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
Yeah, there are other pause sources in the JVM. The GC ones, however, are the ones people mostly tend to notice (and thus try to avoid/shorten) even outside the low latency space. The chief reason, I suspect, is because the GC pauses don't scale well with increasing heap sizes whereas the other ones (monitor deflation, biased lock revocation, nmethod sweeping, nmethod hotness marking, compiler deoptimizations) tend to stay relatively constant (increasing thread count could bump some of those as well). So although there's no hard realtime guarantees (besides the JVM, the OS can induce some anyway), folks tend to try minimizing the ones inflicting the most noticeable performance penalties.
As for CLR, it doesn't have some of the safepoint tasks that are performed by the JVM (e.g. no nmethod sweeping/hotness marking, no biased lock revocation, no compiler deopt) so GC tends to be the only runtime induced pause.
You received this message because you are subscribed to a topic in the Google Groups "mechanical-sympathy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mechanical-sympathy/6vVb_ML2yoo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mechanical-symp...@googlegroups.com.
CLR JIT is nowhere near as sophisticated as say Hotspot; closest comparison is probably to the C1 compiler. There's no interpreter and no tiered compilation, and hence no real profile information and not enough time to do sophisticated analyses. There's nothing to base speculations on. This isn't quite as dire as java would be since methods are non-virtual by default and generics are reified. I actually think that if the CLR had the same aggressive deopt capabilities as Hotspot it would be a significantly faster platform given the rest of the type system and capabilities/flexibility. But the pertinent bit for this discussion is the JIT is not a source of stalls other than first invocation of a method, whereas it is in Hotspot.
sent from my phone
Yes of course, there're many costs with carrying a more sophisticated profiling JIT, memory being one. However, the deopt ability is what brings substantial gains to JITs in languages where the static compiler does nothing in terms of optimizations, dynamic class loading is possible, and that are heavy on virtual dispatch.
sent from my phone
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
If anyone is interested about the iface dispatch technique this article mentions, it's described here: https://github.com/dotnet/coreclr/blob/master/Documentation/botr/virtual-stub-dispatch.md
Note that this is a dispatch optimization for interfaces only to avoid itable lookup when callsite is monomorphic; it's not guarded inlining (PIC) or CHA like Hotspot.
sent from my phone
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.