days
-1
0
hours
-2
-1
minutes
0
-7
seconds
-2
0
search
Take out the trash

GCeasy API – Time Filters: Garbage collection analysis made simple

Ram Lakshmanan
GC
© Shutterstock / foton1601_k

Are you a master at analyzing garbage collection logs? Forget the tedium and find out how to analyze GC logs under certain filters and what use cases this has. In this article, Ram Lakshamanan gives some examples and how to make it happen.

Sometimes users want to analyze GC logs for a certain time interval instead of analyzing the entire GC Log. Here are the use cases for it:

  1. If GC logs are not configured to roll over (which is typically the case in most organizations), one single GC log file will end up having the information of all GC events. Certain applications would have been started days/weeks back. Thus, one single GC log file would end up having all those days/weeks’ worth of GC events. The user might want to analyze only for last 24 hours worth of GC activities.
  2. Each application will have high traffic volume and low traffic volume time in a day. The user might want to analyze the GC only during peak volume time periods. Say for example, if the user is from the financial industry, and he wants to monitor GC activities only during COW (Critical Online Window) i.e. 9:00am to 6:00pm.

To facilitate such time-based processing, we have provided 4 filtering options in GCeasy API. You are welcome to use the option that best works for you.

Time Filter Options

In this section let’s review the Time filter options:

As it’s always said, the best way to learn is through example. Let’s take this hypothetical example: This GC log file has only 5 GC events. Below are the timestamps of the 5 GC events.

Event 1 Timestamp: 2017-12-25T10:01:00.000-0700

Event 2 Timestamp: 2017-12-25T10:02:00.000-0700

Event 3 Timestamp: 2017-12-25T10:03:00.000-0700

Event 4 Timestamp: 2017-12-25T10:04:00.000-0700

Event 5 Timestamp: 2017-12-25T10:05:00.000-0700

First event ran at 2017-12-25T10:01:00.000-0700. Fifth (i.e. last) event ran at 2017-12-25T10:05:00.000-0700. There is 1-minute interval between each GC event.

SEE ALSO: Popular myths about Garbage Collection

#1. startTime

Using this option, you can filter garbage collection logs from a starting timestamp. All GC events that occurred earlier to this timestamp will be ignored. Let’s say you invoke the GCeasy API with ‘startTime’ to be 2017-12-25T10:03:00.000-0700 (i.e. event #3); then, GCeasy API will only parse events #4 and #5 . Events #1, #2 and #3 will be ignored.

You can invoke this option by passing ‘startTime’ in the HTTP URL.

Syntax:

http://gceasy.io/analyzeGC?apiKey=<API-KEY>&startTime=<yyyy-MM-dd’T’HH:mm:ss.SSSZ>

Example:

http://gceasy.io/analyzeGC?apiKey=e094a34e-c3eb-4c9a-8254-f0de107135dc&startTime=2017-12-25T10%3A03%3A00.000-0700 

Note: When you pass the timestamp in the HTTP URL, it needs to be encoded. Encoded format of 2017-12-25T10:03:00.000-0700 is 2017-12-25T10%3A03%3A00.000-0700

#2. endTime

Using this option, you can filter GC logs till an ending timeStamp. All GC events that occured after this timestamp will be ignored. Let’s say, you invoke the GCeasy API with ‘endTime’ to be 2017-12-25T10:03:00.000-0700 (i.e. event #3), then GCeasy API will only parse events #1 and #2. Events #3, #4 and #5 will be ignored.

You can invoke this option, by passing ‘endTime’ in the HTTP URL.

Syntax:

http://gceasy.io/analyzeGC?apiKey=<API-KEY>&endTime=<yyyy-MM-dd’T’HH:mm:ss.SSSZ>

Example:

http://gceasy.io/analyzeGC?apiKey=e094a34e-c3eb-4c9a-8254-f0de107135dc&endTime=2017-12-25T10%3A03%3A00.000-0700

#3. startTime and endTime

Using this option, you can filter GC logs from a starting timestamp to an ending timestamp. All GC events that occurred earlier to and after these timestamps will be ignored. Let’s say, you invoke the GCeasy API with ‘startTime’ to be 2017-12-25T10:02:00.000-0700 (i.e. event #2) and ‘endTime’ to be 2017-12-25T10:04:00.000-0700 (i.e. event #4), then GCeasy API will only parse event #3. Events #1, #2, #4, #5 will be ignored.

Syntax:

http://gceasy.io/analyzeGC?apiKey=<API-KEY>&startTime=<yyyy-MM-dd’T’HH:mm:ss.SSSZ>&endTime=<yyyy-MM-dd’T’HH:mm:ss.SSSZ>

SEE ALSO: Garbage Collection logs: Can we really use it like that?

Example:

http://gceasy.io/analyzeGC?apiKey=e094a34e-c3eb-4c9a-8254-f0de107135dc&startTime=2017-12-25T10%3A02%3A00.000-0700&endTime=2017-12-25T10%3A04%3A00.000-0700

#4. beforeEndTime

Using this option, you can filter GC logs for a specific time period before the end of the GC log file. Let’s say you invoke the GCeasy API with ‘beforeEndTime’ to be ‘2min’ then GCeasy API will only parse events #4 and #5. Events #1, #2, #3 will be ignored because they occurred 2 minutes before the end of the GC log file.

Syntax:

http://gceasy.io/analyzeGC?apiKey=<API-KEY>&beforeEndTime=<TIME-PERIOD>

Here are the allowed values for the TIME-PERIOD:

  • ms
  • sec
  • min
  • hr
  • day

Example: 

http://gceasy.io/analyzeGC?apiKey=<API-KEY>&beforeEndTime=2min

Author
GC

Ram Lakshmanan

Every single day, millions & millions of people in North America—bank, travel, and commerce—use the applications that Ram Lakshmanan has architected. Ram is an acclaimed speaker in major conferences on scalability, availability, and performance topics. Recently, he has founded a startup, which specializes in troubleshooting performance problems.


Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of