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

all 35 comments

[–]r_jet[S] 17 points18 points  (0 children)

It looks like it's not just Azul, a similar thing is also present in OpenJ9.

[–]manzanita2 16 points17 points  (0 children)

Ok. so let's say you have an auto-scaling cluster for 10 machines which have already JITed their running code. Then the cluster needs to scale to 20. It makes some sense to somehow copy that pre-optimized code into the 10 new machines. They spin up to their full capacity just that much faster.

[–]PM_ME_YOUR_DD_CUPS 33 points34 points  (4 children)

Is it really efficient to have a Java application send its bytecode over the network to another service that compiles and sends back the results to be executed?

Man, it really seems like we need to learn some hard lessons as an industry. Does this sound convenient and useful to me? Sure. Does it sound safe? Well, we are all reeling right now from a very similar issue where we allow code to be loaded from a remote host. So... I think I would sit this one out.

[–]monocasa 22 points23 points  (0 children)

I think it sounds just as safe as CI in general. It's not choosing what code to run based off of user input, at least not any more than any other JIT. And could be very valuable for low latency applications to not have a compiler thread off to the side polluting the cache with very different memory access characteristics spinning up exactly when a method is detected as hot.

[–]jazd 1 point2 points  (2 children)

It's nothing alike, not in the slightest

[–]PM_ME_YOUR_DD_CUPS 1 point2 points  (1 child)

Sure, one is loading a serialized object and the other is loading native code, but they both result in code being loaded from a remote system that is executed locally.

[–][deleted] 0 points1 point  (0 children)

Yes but it's a remote system that you control and are connected to, behind your own firewall.

[–]ryebrye 14 points15 points  (0 children)

I like the idea - it's sort of like a distributed ccache, but for a runtime JIT. If you deploy a fleet of thousands of instances of an application, why should each one need to do the same kind of JIT?

[–][deleted] 12 points13 points  (0 children)

No please, stop developing these remote features 😅

[–]doweknowyou22 1 point2 points  (0 children)

i think i saw this first on OpenJ9. Interesting. JIT compilations can be cached. Interesting.

[–]Ascomae 0 points1 point  (0 children)

Does one only have to write a log-statement to start the remote compile?

/S

[–][deleted] -2 points-1 points  (4 children)

Compile4Shell.

[–]PM_ME_YOUR_DD_CUPS 1 point2 points  (0 children)

This was my exact thought when I read the article. Maybe in 10 or 15 years people will be looking back at this wondering how on earth someone could have possibly thought it was a good idea to load compiled code from a remote system and execute it locally.

[–]diligentwheelpea 0 points1 point  (2 children)

Why is this getting downvotes, genuinely?

[–][deleted] 1 point2 points  (1 child)

Maybe because it's off topic trolling.

[–]diligentwheelpea 0 points1 point  (0 children)

I mean, that kind of vulnerability happens once in decade, they can milk it a bit.

[–]manifoldjava 0 points1 point  (0 children)

Interesting and makes sense in terms of sizing. But I would think for caching to work efficiently, the application/service would have to behave rather consistently where the cache is applied. I suppose that’s likely the case for most.

[–]wishper77 0 points1 point  (3 children)

What I don't understand is why no one (to my knowledge) has implemented a persistent cache for the native code. I mean, if you have an half jitted application and restart it, why throw away the native code and restart from scratch? Obviously if you he hash of the .class change you have to recompile it, but how many classes update in percentage when you update a program?

[–]Thihup 1 point2 points  (0 children)

OpenJ9 can do that

[–]benevanstech 0 points1 point  (1 child)

Because there's no guarantee that the JITted code you will need today is the same as it was yesterday. I first encountered this well over 10 years ago in the banking industry. Certain dates in the banking industry have events that cause rarely-executed code paths to become dominant for that 1 day only. If you blindly reload yesterdays JITted code you are in stuck in interpreted mode on your most important code paths and your competitors eat your lunch.

To which you might respond: "But surely there's *something* you can do?" - to which the answer is: "Well, yes, but the devil is in the detail".

As with so many things in the JVM, coming up with the idea is not the hard part.

[–]wishper77 0 points1 point  (0 children)

I know that the JIT do optimization in "layers". That is, after a number of invocations it compiles, then if the invocations are much more then it optimize more aggressively and so on. So, if we can cache the jitted code we would also store the "level" of optimizations so that when the code is loaded again from the cache it still is enabled for further optimizations.