forked from worstcase/gumshoe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request worstcase#8 from newbrough/feature/more-docs
Feature/more docs
- Loading branch information
Showing
62 changed files
with
1,457 additions
and
765 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
Gumshoe Features | ||
================ | ||
|
||
Measure CPU Usage | ||
----------------- | ||
Data Collection | ||
--------------- | ||
|
||
Measure TCP Socket I/O | ||
---------------------- | ||
These kinds of resource usage are monitored and reported: | ||
- [socket I/O (TCP)](types/socket-io.md) | ||
- [file I/O](types/file-io.md) | ||
- [CPU utilization](types/cpu-stats.md) | ||
- [datagram I/O (UDP)](types/datagram-io.md) | ||
- [unclosed socket detection](types/socket-unclosed.md) | ||
|
||
Measure File I/O | ||
---------------- | ||
|
||
Measure UDP Datagram I/O | ||
------------------------ | ||
Visualization | ||
------------- | ||
|
||
Detect Unclosed Sockets | ||
----------------------- | ||
|
||
Flame Graph | ||
----------- | ||
|
||
Root Graph | ||
---------- | ||
All data collection is associated with a specific call stack, so information is not "system-wide" | ||
but tied to individual threads and method calls. If multiple threads include the same method call, | ||
resource usage can be combined across threads for a total for that method call over all similar threads. | ||
This can be presented by combining identical frames starting at the bottom of the call stack, | ||
which results in a flame graph; or starting at the bottom, which results in a root graph. | ||
|
||
Live capture and view | ||
--------------------- | ||
|
||
Often data is collected from the target application in a text file and analyzed later with the gumshoe viewer. | ||
However, the viewer can also be launched from within the same JVM and data viewed as it is collected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Gumshoe Hooks | ||
============= | ||
|
||
Hooks are techniques used by gumshoe to collect information from the JVM that is filtered, accumulated and | ||
finally reported by probes. Some probes may share a hook, and some probes may work without a hook. | ||
|
||
List of hooks: | ||
|
||
[IoTrace](hooks/io-trace.md) is packaged in its own jar and must be loaded into the | ||
bootclasspath of the JVM to support socket I/O and file I/O probes. | ||
|
||
[SelectorProviderImpl](hooks/selector-provider.md) requires a System property | ||
during startup to override the default factory to support NIO monitoring in | ||
the socket I/O and datagram I/O probes. | ||
|
||
[SocketFactoryImpl](hooks/socket-factory.md) is installed by the unclosed socket probe. | ||
|
||
[DatagramFactoryImpl](hooks/datagram-socket-factory.md) is installed by the datagram I/O probe. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Datagram I/O Hook | ||
================= | ||
|
||
Summary | ||
------- | ||
|
||
The DatagramSocketFactoryImpl mechanism was used to define wrapper classes for regular (non-NIO) | ||
datagram sockets that report I/O statistics to IoTraceAdapter. The wrappers invoke the actual datagram operations | ||
on the original default factory implementation while tracking operations, size and elapsed time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
NIO Monitoring Hook | ||
=================== | ||
|
||
The NIO SelectorProviderImpl mechanism is used to define wrapper classes that add missing IoTrace callsback | ||
to NIO socket non-blocking reads and IoTraceAdapter callsbacks to datagram NIO operations. IO is passed | ||
to the original default implementation and the wrapper only provides event reporting. | ||
|
||
Without the hook, all NIO socket writes, and blocking NIO socket reads and all file I/O are still reported. | ||
The hook is needed for non-blocking socket reads and datagram I/O only. | ||
|
||
To use the hook, the JVM must start with system property: | ||
|
||
java.nio.channels.spi.SelectorProvider=com.dell.gumshoe.network.IoTraceSelectorProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Unclosed Socket Hook | ||
==================== | ||
|
||
Summary | ||
------- | ||
|
||
The SocketFactoryImpl mechanism was used to define wrapper classes for regular (non-NIO) | ||
sockets that track closure and report sockets left open. I/O operations are passed to | ||
the original default factory generated sockets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
I/O Probe Event Handler | ||
======================= | ||
|
||
The socket, datagram and file I/O probes each create entries in a (separate) bounded queue | ||
for each read and write operation to offload statistics tabulation from the thread | ||
performing I/O. If the consumer of the thread is not able to keep up with the events | ||
being generated, the queue will reach capacity and events may be lost. | ||
|
||
Monitoring the Queue | ||
-------------------- | ||
|
||
If an event queue fills, a message is displayed on STDOUT such as: | ||
|
||
GUMSHOE: IO event queue for SocketIOMonitor is full | ||
|
||
If this message is not found in STDOUT, then no further investigation or configuration is needed. | ||
If it is seen, use JMX MBeans to determine how many events are being lost. | ||
|
||
SocketIOProbe, DatagramIOProbe and FileIOProbe each have corresponding MBeans with attributes and operations: | ||
|
||
QueueStatisticsEnabled set true to collect number of events dropped and average queue size | ||
QueueStats text description of average and max queue size, number of events and % dropped | ||
resetQueueStats() operation to reset counters to zero | ||
|
||
Also to enable collecting queue statistics during startup, System properties can be used: | ||
|
||
gumshoe.socket-io.handler.stats-enabled=true | ||
gumshoe.datagram-io.handler.stats-enabled=true | ||
gumshoe.file-io.handler.stats-enabled=true | ||
|
||
Using these controls, enable statistics collection and monitor the target application for some time. | ||
Then look at QueueStats to see what portion of events are dropped. | ||
|
||
Live with It? | ||
------------- | ||
|
||
In most cases, dropping even a significant fraction of the events is not a problem. The events | ||
received should still be a representative sample of all I/O and although the total counts and number of bytes | ||
may not be accurate, the relative weight of each stack and frame should still be usable. | ||
|
||
Deal with It! | ||
------------- | ||
|
||
If you decide you are dropping more events than you are comfortable with, there are a number of ways | ||
to improve reporting. | ||
|
||
- if there are only intermittent periods of dropped events, increasing queue size may be enough to | ||
let the consumer handle events in between peaks. Use properties to set the queue size (default is 500): | ||
|
||
gumshoe.socket-io.handler.queue-size=1000 | ||
gumshoe.datagram-io.handler.queue-size=1000 | ||
gumshoe.file-io.handler.queue-size=1000 | ||
|
||
|
||
|
||
The queue will fill if events are produced (individual I/O operations) faster than they are consumed. | ||
Some possible reasons: | ||
|
||
- The target application is performing a lot of small network operations | ||
|
||
This could be an area to improve the target application. | ||
Lots of small operations are less efficient than fewer large operations. | ||
|
||
Or this could just be the nature of the expected application load, | ||
so increase the gumshoe event queue size and the handler thread priority to accommodate. | ||
|
||
- The JVM is CPU bound | ||
|
||
The event queue may back up if the target application is CPU bound. This could be | ||
an issue in the target application itself, and you may want to look at | ||
[processor utilization statistics](../types/cpu-stats.md) before socket I/O. | ||
|
||
Or it could be due to gumshoe stack filters. Each stack filter configured has to | ||
modify the event call stack on the same event handling thread. Complex filters | ||
(such as the recursion filter) or deep call stacks can result in more load than the | ||
thread can handle. Relax [filters](../filters.md) (at the expense of more memory use) or increase the | ||
event handler thread priority. | ||
|
||
If the event queue is full: | ||
|
||
- Ignore it (_really!, it isn't so bad..._) | ||
|
||
If the problem is intermittent, it may not affect all samples, | ||
and data reported in those affected is still likely a representative subset of all I/O. | ||
Total I/O values will not be accurate but the relative I/O comparisons between threads | ||
should still provide insight into what the target application is doing to generate the I/O load. | ||
|
||
- Increase queue size | ||
|
||
If the problem is intermittent, then a larger queue can let the handler thread | ||
catch up after load spikes. However, if load is consistently over the handler capacity, | ||
this will just delay and not fix the problem. (Requires restart) | ||
|
||
- Increase handler thread priority | ||
|
||
Socket and file I/O events perform all filtering and accumulation functions on the | ||
handler thread. The default is to run at Thread.MIN_PRIORITY, reflecting the decision to | ||
risk dropping data rather than impact the target application. This can be changed to a | ||
higher value to reduce dropping events even if it means taking some CPU time away from | ||
the target application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.