Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4322452
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:52:31+00:00 2026-05-21T08:52:31+00:00

While testing my webapp under load I got following top excerpt under Linux: PID

  • 0

While testing my webapp under load I got following top excerpt under Linux:

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
3964 nobody    20   0 4965m 622m 6048 S  8.5 11.0   6:02.49 java 
1985 mysql     20   0  294m 125m 3804 S  2.1  2.2   0:05.39 /usr/sbin/mysqld

I need an explanation on java’s %CPU column. As I understand it, during web request one of java‘s thread is performing some pure Java logic, consuming some of CPU time (let it be 5ms). Then it connects to database via JDBC, sends some sql query and waits, say 10ms, for response. These 10ms are obviously counted as /usr/sbin/mysqld CPU usage. Then java thread resumes it’s operation and finishes, consuming another 20ms and amounting to 5+10+20=30ms total execution time.

And the newbie question is: don’t you think that these db-related 10ms are counted twice: one time as java thread waiting for db to process the query and second time as database CPU usage itself? What don’t I understand here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:52:32+00:00Added an answer on May 21, 2026 at 8:52 am

    When a process is simply waiting on a socket it will not normally be using significant amounts of CPU. Basically, the kernel knows that it is in a waiting state and will not schedule it to run – except for little things like signal handling, which can be used e.g. to run the garbage collector regularly.

    (OK, if there is a lot of garbage to collect, that “little thing” might not be so little.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was given this code a while back. I finally got around to testing
While testing the below SQL code for another stackoverflow answer , I got the
While testing a console app, I set the properties of the console window to
I'm facing a problem while unit testing my forms. The problem is that data
While trying to answer a question in the vicinity ' Unit Testing WPF Bindings
While going through university and from following the development of SO, I've heard a
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal
What are different points to note down while testing android applications? What are different
I am developing a small application using EF 4.0 and POCO. While testing my
While testing a design for a site, I took a screenshot with TinyGrab and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.