많은 사용자가 붙는 서버를 만들 일이 많지 않았지만, 꽤 괜찮은 내용을 찾았다.
The epoll facility is available in the Linux 2.6, and newer, kernels. The new epoll-based SelectorProvider implementation is more scalable than the traditional poll-based SelectorProvider implementation when there are thousands of SelectableChannels registered with a Selector.
Sun 문서에는 위처럼 너무 간단하게 나왔다.
리눅스 2.6 커널일 경우 디폴트로 poll 이 아닌 epoll 을 써서 확장성이 더 좋다. 이 뿐.
그래서 좀 더 자세한 글을 찾아보려 구글님께 자문을 구해보았다.
Alan Bateman 씨의 포스트가 검색되었다.
요샌 다들 커널 2.6을 쓰고 있을테니 대부분의 서버 프로그래머들이 즐거워할 일인듯 하다.
정말 어느정도의 차이가 나는지 테스트를 해보려면 다음과 같이 강제로 poll을 쓰도록 switching 할 수 있다.
System.setProperty("java.nio.channels.spi.SelectorProvider", "sun.nio.ch.PollSelectorProvider");
커널 2.4에서도 epoll을 쓸 수 있는 패치가 있다지만, 이녀석을 감지하진 못한단다.
mustang 깔란 얘기다.
근데 j2se 1.5.0_09 에서도 이 기능이 포함되었다고 한다.
대신 default로 epoll을 사용하지 않기 때문에
System.setProperty("java.nio.channels.spi.SelectorProvider", "sun.nio.ch.EPollSelectorProvider");
를 해주어 수동으로 켜 주어야만 한다.
이 포스트에 달린 코멘트 임팩트가 아주 제대로다.
works great for me. With b59, on one of our perf tests, I am seeing system CPU go down from 40% with JDK 1.5.0_05 to 6-7% system in b59 with 10000 connections.
Posted by anandp on November 05, 2005 at 09:06 AM PST #
6배의 성능 향상!