DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • How the Go Runtime Preempts Goroutines for Efficient Concurrency
  • Real-World Garbage Collection Scenarios and Solutions
  • Using Heap Dumps to Find Memory Leaks
  • Different Garbage Collectors in Java: Exploring the Options

Trending

  • Advancing Your Software Engineering Career in 2025
  • Efficient API Communication With Spring WebClient
  • Event-Driven Microservices: How Kafka and RabbitMQ Power Scalable Systems
  • Apple and Anthropic Partner on AI-Powered Vibe-Coding Tool – Public Release TBD
  1. DZone
  2. Coding
  3. Languages
  4. User, Sys and Real Times in GC Log

User, Sys and Real Times in GC Log

You can never know too much about Garbage Collection in Java. Here are breakdowns of what user, sys, and real time means in your GC log.

By 
Grzegorz Mirek user avatar
Grzegorz Mirek
·
Sep. 28, 17 · Tutorial
Likes (16)
Comment
Save
Tweet
Share
14.5K Views

Join the DZone community and get the full member experience.

Join For Free

Have you ever wondered what user, sys , and real times in a GC log mean? Well, I have, a couple of times at least. Let’s say that we have the following line after Full GC entry:

[Times: user=4.21 sys=0.03, real=0.75 secs]

To find out what they represent, we should check the UNIX command time first. time is a utility that executes the command that you put after it and prints time statistics. For example, time ps will show running processes together with the info about how much time it took to invoke ps.

94880 ttys017    0:00.19 -bash
3574 ttys018    0:00.03 -bash
3850 ttys019    0:00.09 -bash

real 0m0.066s
user 0m0.005s
sys 0m0.053s

 

As you can see, the output also contains real, user, and sys times. The manual for the time command gives a little bit more information about the terms:

These statistics consist of (i) the elapsed real time between invocation and termination, (ii) the user CPU time, and (iii) the system CPU time

  • real: The user-perceived time it took to execute the command from the start to the end of the call, including time slices used by other processes and the time when our process is blocked (e.g. I/O waiting). The synonyms are wall clock time and elapsed real time.

  • user: The CPU time that was spent on non-kernel (user-mode) code only within the given process — so other processes and the time when our process is blocked are not included.

  • sys: The CPU time spent on the kernel (system) code only within the given process. Similarly to user time, other processes and the time when our process is blocked are not included.

When real Time Is Lower Than user + sys Time

Let’s look at the GC log example from the top:

[Times: user=4.21 sys=0.03, real=0.75 secs]

What it basically says is that, in reality, from the user perspective, it took 0.75 seconds to complete. Kernel code was executed for 0.03 seconds and non-kernel code took 4.21 seconds. How is it possible that the real elapsed time is lower than user time? Well, it’s because the user code was executed by multiple threads and the statistics print the sum of all threads working on it. So basically, multiple GC threads were involved. 

When real Time Is Equals user + sys Time

That’s a typical situation when the Serial Garbage Collector is used. Because it runs only one GC thread, user + sys time will be more or less similar to the real time.

When real Time Is Greater Than user + sys Times

In certain circumstances, you might see real time to be greater than user + sys time. If it happens often and the differences are substantial, then it might mean that there is either a lack of CPU or there is heavy I/O activity in the system. Lack of CPU is when the application doesn’t get enough CPU cycles to run because they are shared among too many processes. The solution might be to add more CPU cores or to reduce the number of the most CPU-consuming processes. Heavy I/O is well explained in this LinkedIn article.

garbage collection

Published at DZone with permission of Grzegorz Mirek, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How the Go Runtime Preempts Goroutines for Efficient Concurrency
  • Real-World Garbage Collection Scenarios and Solutions
  • Using Heap Dumps to Find Memory Leaks
  • Different Garbage Collectors in Java: Exploring the Options

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!