티스토리 뷰

개발

java lts cpu 확인

달리는개발자 2023. 4. 6. 14:40

2021년 9월에 java 17 LTS(Long-Term Support)가 나왔고 23년 9월에 java 21 LTS가 나온다.

아래 블로그와 같이 java 17이 발표되면서 LTS 주기가 2년으로 변경됐다.

java lts

https://blogs.oracle.com/javakr/post/jdk-17

 

JDK 17 발표 및 새로운 변화

새로운 LTS 버전인 JDK 17이 발표가 되었습니다. 지난 LTS 버전인 11 이후에 3년만에 발표된 LTS 릴리스이고, LTS 릴리스로써 최소 8년 동안 성능, 안정성 및 보안 업데이트가 예정되어 있는 중요한 릴

blogs.oracle.com

 

JDK 릴리즈는 아래 사이트에서 확인가능하다.

https://www.java.com/releases/

 

JDK Releases

The release information on this page covers the Java SE releases that were widely distributed or significant to the development of Java. It does not cover patch releases or other one-off releases.

www.java.com

확인하던 중에 CPU Type이란게 있어서 확인해보니 CPU(Critical Patch Update) 이다.

https://www.oracle.com/security-alerts/cpujan2023.html#AppendixJAVA

 

Oracle Critical Patch Update Advisory - January 2023

Oracle Critical Patch Update Advisory - January 2023 Description A Critical Patch Update is a collection of patches for multiple security vulnerabilities. These patches address vulnerabilities in Oracle code and in third-party components included in Oracle

www.oracle.com

 

java 20이 2023년 3월 21일에 출시되었고 중요한 feature 중에 눈에 가는 건 virtual thread이다.

Virtual Thread는 처리량이 많은 동시 응용 프로그램을 작성, 유지 관리 및 관찰하는 노력을 크게 줄이는 경량 스레드입니다.

가상 스레드는 특정 OS 스레드에 연결되지 않은 java.lang.Thread의 인스턴스입니다. 반면 플랫폼 스레드는 전통적인 방식으로 구현된 java.lang.Thread의 인스턴스로, OS 스레드 주변의 얇은 래퍼로 구현됩니다.

요청당 스레드 스타일의 애플리케이션 코드는 전체 요청 기간 동안 가상 스레드에서 실행될 수 있지만 가상 스레드는 CPU에서 계산을 수행하는 동안에만 OS 스레드를 소비합니다.

비동기 논블로킹으로 자원 효율적인 개발방식인 reactive programming이 한때 많이 소개되었던 적이 있었는데 실제 프로젝트에 적용한 것을 보기가 드물었습니다.

예제도 단순 샘플들이 많았고 reactive 패러다임을 익히면서 개발하기가 참 힘들었죠

Virtual Thread는 현재 java 19에서 preview이고 (--enable-preview 설정을 해야지 쓸 수 있음) 이고 java 20에서 second-preview입니다.

java 21 LTS에서 실제로 적용될 것으로 보입니다. 빨리 쓸 수 있는 날이 왔으면 좋겠네요 ^^

https://www.oracle.com/java/technologies/javase/20-relnote-issues.html#NewFeature

 

JDK 20 Release Notes, Important Changes, and Information

These notes describe important changes, enhancements, removed APIs and features, deprecated APIs and features, and other information about JDK 20 and Java SE 20. In some cases, the descriptions provide links to additional detailed information about an issu

www.oracle.com

 

아래는 Virtual Thread 코드 샘플입니다.

실제 sleep으로 1초 대기가 될 것이고 os thread는 약 1개정도? 사용될 것이라고 하네요

일반 플랫폼쓰레드를 사용하여 10,000개인 것을 100만 이상으로 늘리면 heap memory 크기에 따라서 OOM(Out Of Memory)가 날 수 있습니다.

Virtual Thread는 잘 동작합니다 ^^

try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
    IntStream.range(0, 10_000).forEach(i -> {
        executor.submit(() -> {
            Thread.sleep(Duration.ofSeconds(1));
            return i;
        });
    });
}  // executor.close() is called implicitly, and waits

보다 자세한 설명은 아래 사이트를 참고하세요~!!

https://bugs.openjdk.org/browse/JDK-8295817

 

[JDK-8295817] JEP 436: Virtual Threads (Second Preview) - Java Bug System

 

bugs.openjdk.org

 

자바 릴리즈 정보

https://www.java.com/releases/

 

JDK Releases

The release information on this page covers the Java SE releases that were widely distributed or significant to the development of Java. It does not cover patch releases or other one-off releases.

www.java.com

 

java 20 new features

https://www.infoworld.com/article/3676699/jdk-20-the-new-features-in-java-20.html

 

JDK 20: The new features in Java 20

The latest upgrade of standard Java, now available in a production release, incubates or previews a number of new capabilities including virtual threads and structured concurrency.

www.infoworld.com

https://blogs.oracle.com/java/post/the-arrival-of-java-20

 

The Arrival of Java 20

The arrival of Java 20

orasites-prodapp.cec.ocp.oraclecloud.com

 

현재 실무에서 java 11, 17을 사용하고 아직 spring boot 3, spring 6으로 넘어가지 못하고 있습니다.

프로젝트를 하다보면 기능 개발에 치여 java, spring 업데이트를 따라가지 못하는 경우가 많습니다.

그래도 java news 등을 통해서 새로운 것을 익혀놓고 미리 준비해놓는 것도 나쁘지 않을 것 같네요

미리 미리 준비하셔서 즐겁게 개발하세요 ^^

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함