sFlow.org Perv Rastogi http://www.sFlow.org/ PayPal info@sflow.org Saran Arul PayPal Peter Phaal InMon Corp. December 2011 sFlow Java Virtual Machine Structures Copyright Notice Copyright (C) sFlow.org (2011). All Rights Reserved. Abstract This memo describes sFlow version 5 structures for exporting Java virtual machine related data. Table of Contents 1. Overview ...................................................... 1 2. Discussion .................................................... 2 3. sFlow Datagram Extensions ..................................... 2 4. References .................................................... 4 5. Author's Addresses ............................................ 4 1. Overview This document describes additional structures that allow an sFlow agent to export information from Java virtual machines [1]. sFlow version 5 is an extensible protocol that allows the addition of new data structures without impacting existing collectors. This document does not change the sFlow version 5 protocol [2], it simply defines additional, optional, data structures describing java virtual machine performance. FINAL sFlow.org [Page 1] FINAL sFlow Java Virtual Machine Structures December 2011 2. Discussion The sFlow Host Structures [3] specification defines a framework for monitoring physical and virtual machine performance metrics. This document builds on that framework, mapping java virtual machine attributes and metrics into existing structures and defining addition structures specific to Java virtual machines. 3. sFlow Datagram Extensions The sFlow Host Structures [3] specification requires that the data source associated with the physical host on which the Java virtual machine(s) are running export a counter_sample structures containing host performance statistics (host_cpu, host_memory, host_disk_io and host_net_io) as well as host_adapter and and host_descr data structures. Each data source associated with a virtual machine running on the physical host is required to export a counter_sample structure containing virtual machine performance statistics (virt_cpu, virt_memory, virt_disk_io and virt_net_io) as well as host_adapter, host_parent and host_descr structures. Populating the existing sFlow virtual machine structures to the fullest extent possible maximises interoperability, ensuring that existing sFlow analysis tools can report on java virtual machine performance. Additional structures are only defined where necessary to report java virtual machine specific attributes. In order to populate the host_descr structure, this document extends the os_name enumeration [3] to include java in the list of operating system names: java = 13 Currently Java virtual machines lack the instrumentation needed to export virt_disk_io and virt_net_io structures and the structures should be omitted. Since a Java virtual machine does not virtualize networking, but makes use of the host networking stack, the host_adapter structure should also be omitted. The Java Management Extensions (JMX) API [4] defines a standard set of metrics for Java virtual machine performance monitoring. The following sFlow structures are defined to export Java virtual machine performance metrics based on the JMX API: /* JVM Runtime Attributes */ /* See RuntimeMXBean */ FINAL sFlow.org [Page 2] FINAL sFlow Java Virtual Machine Structures December 2011 /* opaque = counter_data; enterprise = 0; format = 2105 */ struct jvm_runtime { string vm_name<64>; /* vm name */ string vm_vendor<32>; /* the vendor for the JVM */ string vm_version<32>; /* the version for the JVM */ } /* JVM Statistics */ /* See MemoryMXBean, GarbageCollectorMXBean, ClassLoadingMXBean, */ /* CompilationMXBean, ThreadMXBean and UnixOperatingSystemMXBean */ /* opaque = counter_data; enterprise = 0; format = 2106 */ struct jvm_statistics { unsigned hyper heap_initial; /* initial heap memory requested */ unsigned hyper heap_used; /* current heap memory usage */ unsigned hyper heap_committed; /* heap memory currently committed */ unsigned hyper heap_max; /* max heap space */ unsigned hyper non_heap_initial; /* initial non heap memory requested */ unsigned hyper non_heap_used; /* current non heap memory usage */ unsigned hyper non_heap_committed; /* non heap memory currently committed */ unsigned hyper non_heap_max; /* max non-heap space */ unsigned int gc_count; /* total number of collections that have occurred */ unsigned int gc_time; /* approximate accumulated collection elapsed time in milliseconds */ unsigned int classes_loaded; /* number of classes currently loaded in vm */ unsigned int classes_total; /* total number of classes loaded since vm started */ unsigned int classes_unloaded; /* total number of classe unloaded since vm started */ unsigned int compilation_time; /* total accumulated time spent in compilation (in milliseconds) */ unsigned int thread_num_live; /* current number of live threads */ unsigned int thread_num_daemon; /* current number of live daemon threads */ unsigned int thread_num_started; /* total threads started since vm started */ unsigned int fd_open_count; /* number of open file descriptors */ unsigned int fd_max_count; /* max number of file descriptors */ } The jmx-sflow-agent [5] is an open source implementation of the sFlow Java Virtual Machine Structures specification that serves to clarify the mapping of Java metrics into the generic and java specific FINAL sFlow.org [Page 3] FINAL sFlow Java Virtual Machine Structures December 2011 virtual machine structures. 4. References [1] Oracle, "Java", http://www.oracle.com/technetwork/java/index.html [2] Phaal, P. and Lavine, M., "sFlow Version 5", http://www.sflow.org/sflow_version_5.txt, July 2006 [3] Phaal, P. and Jordan, R., "sFlow Host Structures", http://www.sflow.org/sflow_host.txt July 2010 [4] Oracle, "Java Management Extensions (JMX) Technology", http://www.oracle.com/technetwork/java/javase/tech/javamanage- ment-140525.html [5] "jmx-sflow-agent", http://jmx-sflow-agent.googlecode.com/ 5. Author's Address Perv Rastogi PayPal 2211 North First Street San Jose, CA 95131 Phone: (408) 488-0170 EMail: pkrastogi@paypal.com Saran Arul PayPal 2211 North First Street San Jose, CA 95131 Phone: (408) 528-4170 EMail: sarul@ebay.com Peter Phaal InMon Corp. 580 California Street, 5th Floor San Francisco, CA 94104 Phone: (415) 283-3263 EMail: peter.phaal@inmon.com FINAL sFlow.org [Page 4]