git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Seeing high CPU usage during git-upload-pack

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
May 9, 2012, 10:37 UTC
Message-ID
<CACsJy8DMm0ZNiQYQ1CvOfDJu5ogP42Y06792iA_xyzeHDGLJaw@mail.gmail.com>
In-Reply-To
<CAPeUw3EsFCxki6obAAeVBb0g4MKNWBteL3VueG5djbajkFiv3A@mail.gmail.com>
On Wed, May 9, 2012 at 2:01 PM, David Ebbo <david.ebbo@gmail.com> wrote:
> We’re using git-upload-pack in a simple git server. When the repo is
> on a slow share, we’re noticing that git-upload-pack is hugging the
> CPU during the whole pack-objects operation.
What OS is it run on? What git version?
Show 13 quoted lines
> More details:
>
> - git-upload-pack gets launched (with params git-upload-pack
> --stateless-rpc //path/to/repo)
> - it itself launches a git process (with params pack-objects --revs
> --all --stdout --progress --delta-base-offset). This git process is
> the one that does all the disk I/O, but it's not the one using up the
> CPU time.
> - git-upload-pack appears to be waiting for the git process, and is at
> high CPU during that time, suggesting that it's doing some kind of
> busy wait. To further test that, I stopped the git process in the
> debugger, preventing it from making progress. At that point,
> git-upload-pack pegs the CPU forever.

How about stopping upload-pack and see where it stops? There's a main loop in upload-pack.c, create_pack_file() that is only active when data comes. I looked but failed to see how it becomes a busywait loop. Maybe you can put some debugging there.

Setting env var GIT_TRACE_PACKET and GIT_DEBUG_SEND_PACK before running upload-pack might also help.

> Would someone familiar with the sources be able to comment on this
> busy wait behavior, and on whether it could conceivably be done in a
> way that doesn’t use up some much CPU?
-- 
Duy
Previous: David EbboNext: Nguyen Thai Ngoc Duy
Message 2 of 4 in “Seeing high CPU usage during git-upload-pack”
  1. David EbboMay 9, 2012
  2. Nguyen Thai Ngoc DuyMay 9, 2012
  3. Nguyen Thai Ngoc DuyMay 9, 2012
  4. David EbboMay 10, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.