Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't `git push` on the HTTP thread #154
Comments
alexcrichton
added
the
P-high
label
May 26, 2015
brson
removed
the
P-high
label
Jun 23, 2016
This comment has been minimized.
This comment has been minimized.
|
Removed P-high. No activity. Seems to work fine. |
carols10cents
added
C-enhancement
A-backend
labels
Dec 15, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
alexcrichton commentedMay 11, 2015
Currently the architecture of this server is to have a pool of worker threads and each request is assigned its own thread. Threads are only re-used after a request completes. This is OK most of the time, but there's a lot of blocking things that we do on each thread:
Right now I believe postgres/S3 to be robust enough to not be hugely worrisome, but sometimes threads pushing to github can block for very long periods of time (for one reason or another). An example of this is when GitHub went down recently due to a DDoS, causing all of our pushes of new crates being published to take a very long time. What ends up happening is that all worker threads are exhausted by waiting for a
git pushto finish, preventing new requests from being served. At the very least it would be nice to time out the push operation, but it does not appear that libgit2 supports this kind of timeout right now, so that may not be an option.To get around this, there are a few possible strategies:
git pushon the HTTP thread, instead do it on a worker thread elsewhere. This would involve building up a queue ofgit pushrequests which is processed occasionally, but it also loses the guarantee that when/api/v1/crates/newreturns that your crate is 100% published (it may still take some time to make its way into the index).