HN user

haglin

114 karma
Posts2
Comments61
View on HN

I work on OpenJDK, so I may be biased, but I’ve also found that JFR works really well with LLMs.

  $ java -XX:StartFlightRecording:maxsize=10M,filename=dump.jfr -jar app.jar

  $ jfr view all-views dump.jfr > report.txt

  $ jfr print dump.jfr > all.txt
Then ask Codex, or whatever AI tool you use, to analyze report.txt for issues and use all.txt to dig deeper, if needed.

Splitting up a PR is a lot of work, especially if you want each commit to compile, but it would be great if you could categorize changes using 5–10 colors and then have checkboxes that you can toggle to hide code corresponding to a color.

What each color means would depend on the PR, but, for instance, yellow = refactoring, brown = test code, blue = drive-by fix, orange = more efficient data structure etc.

The colors and their meanings could be set by either the author or the reviewers. It would be similar to the file checkboxes that exist today, but in this case, it would be per concept, not per file.

Yeah, Windows 2000 was probably the best operating system Microsoft ever produced. It had no crashes, a snappy/intuitive/sleek user interface, and DirectX support for games. I am currently running Mac OS X because I never liked Windows XP/Vista/10/11.

In hindsight, the progress Microsoft made in the ten years between Windows 3.0 (1990) and Windows 2000 seems incredible. They transitioned from a 16-bit shell running on top of DOS to a fully-fledged operating system with a hardware abstraction layer, preemptive multitasking, permissions, a registry, proper device drivers etc.

Twenty-five years later, there has been basically no progress.

At a minimum, I would have expected something like the Knowledge Navigator

https://www.youtube.com/watch?v=umJsITGzXd0

JFR only samples running Java methods.

I would guess at least some of the bottlenecks are in hardware, the operating system or in native code (including the JVM) in this case.

Two years it too short.

The reason I now use gmail and not hotmail is because Microsoft did a similar thing 20 years ago. When I lost my hotmail account, I thought I might as well use gmail from now on. Reason I didn't log into my hotmail account was because I used the mail address I got from the university.

An alternative to avoid safepoints (only samples executing threads)

    var r = new RecordingStream();
    r.enable("jdk.ExecutionSample").withStackTrace().withPeriod(Duration.ofMillis(1));
    r.onEvent("jdk.ExecutionSample", e -> {
        store.addSample(e.getStackTrace().getFrames());
    });   
    r.startAsync();
    ...

There are multiple ways to represent an optional value, for example:

1) an empty list/array 2) throw an exception if the return value is missing. 3) -1

Optional can be used as a better alternative in all these cases. It's not just null.

The JDK comes with a powerful memory leak tool.

$ java -XX:StartFlightRecording:settings=profile MyApp

$ jcmd MyApp JFR.dump paths-to-gc-root=true filename=dump.jfr

$ jfr print --events OldObjectSample --stack-depth 64 dump.jfr

The tool will list objects on the heap, their path to the GC roots and allocation stack trace. That is usually sufficient to solve the memory leak. No need to create a large HPROF file or upload data to a server. Everything can be done in the shell.

https://docs.oracle.com/en/java/javase/13/troubleshoot/troub...

Sensitive information, like credit card numbers, will not even leave the Java heap.

In JDK 14, Flight Recorder events will be available for monitoring.

   try (var rs = new RecordingStream()) {
     rs.onEvent("jdk.GCPhasePause", event -> {
       System.out.println(event.getDuration());
     });
   }
IT Runs on Java 8 7 years ago

I haven't tried serverless, but shouldn't that be Java's cup of tea?

The JVM can load code dynamically and adapt the runtime to the work load. Maybe there is a framework missing, so those that provide serverless starts a new JVM per function call, but they shouldn't really have to do that.

It depends on how you use it.

You can create a design ticket where you describe the larger overall picture (city planning) and then as you implement it, add enhancements (neighbourhoods and sewers) as subtasks. If something breaks when you add the enhancement, for example a memory leak when calling method X, you can create a bug ticket that only concerns the micro details.

Can you elaborate? I don't understand what you mean.

Oracle contributes patches to OpenJDK, for instance lambda support.

Do you want less of that? Are the commits made by Oracle employees especially bad?

It's not like you need to use the Oracle JDK. There are many different distros, just like Linux.