From asaf.mesika at gmail.com Wed Aug 17 07:05:42 2022 From: asaf.mesika at gmail.com (Asaf Mesika) Date: Wed, 17 Aug 2022 10:05:42 +0300 Subject: OperatingSystemMXBean and network usage and limit information Message-ID: Hi, I've searched through the various mailing lists, but couldn't find a suitable one so I'm posting it here. I would like to have the ability to know from an application the current network usage and limit (relative to host or cgroup). I have seen the class OperatingSystemMXBean that is provided by the JDK. I was wondering if the idea of adding that information to this bean has been considered in the past. Currently, the best option I found, which is operating system-specific code, is to use the /sys/class/net/ files. Thanks, Asaf -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgehwolf at redhat.com Wed Aug 17 08:59:14 2022 From: sgehwolf at redhat.com (Severin Gehwolf) Date: Wed, 17 Aug 2022 10:59:14 +0200 Subject: OperatingSystemMXBean and network usage and limit information In-Reply-To: References: Message-ID: Hi, On Wed, 2022-08-17 at 10:05 +0300, Asaf Mesika wrote: > Hi, > > I've searched through the various mailing lists, but couldn't find a > suitable?one so I'm posting it here. > > I would like to have the ability to know from an application the > current network usage and limit (relative to host or cgroup). > > I have seen the class??OperatingSystemMXBean?that is provided by the > JDK. I was wondering if the idea of adding that information?to this > bean has been considered in the past. > > Currently, the best option I found, which is operating system- > specific code, is to use the?/sys/class/net/?files. One challenge for this would be to do this in a version agnostic way. Another is that nothing is using this info at present and we'd have to have a compelling use-case where adding such an API would be useful.? AFAIK, net_cls which would allow something like that in v1, does not exist for v2. With all that said, I don't think there are any plans to do this. Thanks, Severin From hohensee at amazon.com Wed Aug 17 18:40:03 2022 From: hohensee at amazon.com (Hohensee, Paul) Date: Wed, 17 Aug 2022 18:40:03 +0000 Subject: OperatingSystemMXBean and network usage and limit information Message-ID: <2730DAF1-DA41-4E35-B3E7-A541DA336211@amazon.com> This is a serviceability-dev issue, redirected. Thanks, Paul ?-----Original Message----- From: discuss on behalf of Severin Gehwolf Date: Wednesday, August 17, 2022 at 2:00 AM To: "discuss at openjdk.org" Subject: RE: OperatingSystemMXBean and network usage and limit information Hi, On Wed, 2022-08-17 at 10:05 +0300, Asaf Mesika wrote: > Hi, > > I've searched through the various mailing lists, but couldn't find a > suitable one so I'm posting it here. > > I would like to have the ability to know from an application the > current network usage and limit (relative to host or cgroup). > > I have seen the class OperatingSystemMXBean that is provided by the > JDK. I was wondering if the idea of adding that information to this > bean has been considered in the past. > > Currently, the best option I found, which is operating system- > specific code, is to use the /sys/class/net/ files. One challenge for this would be to do this in a version agnostic way. Another is that nothing is using this info at present and we'd have to have a compelling use-case where adding such an API would be useful. AFAIK, net_cls which would allow something like that in v1, does not exist for v2. With all that said, I don't think there are any plans to do this. Thanks, Severin From maxim.kartashev at jetbrains.com Tue Aug 30 06:50:22 2022 From: maxim.kartashev at jetbrains.com (Maxim Kartashev) Date: Tue, 30 Aug 2022 09:50:22 +0300 Subject: Any interest in WatchService based on MacOS FSEvents? Message-ID: WatchService on MacOS is still implemented by the generic PollingWatchService, which continuously re-scans the directory consuming CPU, introduces large latencies to the generated WatchEvent's, and misses changes that occur faster than the re-scan interval. At the same time, there are two technologies available on the platform to receive the necessary information from the OS similar to what is available on Windows and Linux: Kernel Queues and File System Events, the latter being more suitable for implementing the WatchServie functionality. There are several stand-alone implementations out there that utilize one or the other (or even both), which suggests that demand exists for WatchService on MacOS to be more responsive and less resource-hungry. If the community is interested in getting this functionality in OpenJDK proper, I'd be happy to contribute code that was developed, tested, and used at JetBrains for around half a year. It is based on FSEvents, supports the FILE_TREE modifier (recursive directory watch), and does not do any excessive I/O except the necessary minimum. References * WatchService interface - https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/nio/file/WatchService.html * PollingWatchService source code - https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java * File System Events - https://developer.apple.com/documentation/coreservices/file_system_events?language=objc * Kernel Queues - https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/FSEvents_ProgGuide/KernelQueues/KernelQueues.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From marius at volkhart.com Tue Aug 30 23:21:41 2022 From: marius at volkhart.com (Marius Volkhart) Date: Tue, 30 Aug 2022 19:21:41 -0400 Subject: Any interest in WatchService based on MacOS FSEvents? In-Reply-To: References: Message-ID: <9864649E-054C-4160-9049-3996B7F69C25@volkhart.com> Hi Maxim, I think this would be great, and would be very pleased to see it in the JDK. Cheers, Marius > On Aug 30, 2022, at 02:52, Maxim Kartashev wrote: > > ? > WatchService on MacOS is still implemented by the generic PollingWatchService, which continuously re-scans the directory consuming CPU, introduces large latencies to the generated WatchEvent's, and misses changes that occur faster than the re-scan interval. At the same time, there are two technologies available on the platform to receive the necessary information from the OS similar to what is available on Windows and Linux: Kernel Queues and File System Events, the latter being more suitable for implementing the WatchServie functionality. > > There are several stand-alone implementations out there that utilize one or the other (or even both), which suggests that demand exists for WatchService on MacOS to be more responsive and less resource-hungry. > > If the community is interested in getting this functionality in OpenJDK proper, I'd be happy to contribute code that was developed, tested, and used at JetBrains for around half a year. It is based on FSEvents, supports the FILE_TREE modifier (recursive directory watch), and does not do any excessive I/O except the necessary minimum. > > References > * WatchService interface > - https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/nio/file/WatchService.html > * PollingWatchService source code > - https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java > * File System Events > - https://developer.apple.com/documentation/coreservices/file_system_events?language=objc > * Kernel Queues > - https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/FSEvents_ProgGuide/KernelQueues/KernelQueues.html -------------- next part -------------- An HTML attachment was scrubbed... URL: