How do I implement load balancing with Git?
-
To explain the problem in detail :- I am working on a node.js module which will ease setting up of git clusters. The setup is a classic Distributed system with git servers behind a proxy (load balancers). I am really new to git internals so I cannot find out a way to forward requests from the user (e.g. git push origin mainline , git remote add <some remote repo>) which land up on load balancers port (not implemented yet , but this port is where git request comes , for ssh this should be 22). As I understand this is not just a single request and git makes a couple of requests to the server to get the job done (Like one to fetch the head , one for merge etc.) If it was a single request , I would have forwarded the same to the backend cluster and returned the response directly to the client . But since it is not , my best bet is to open up a pipe between the backend cluster and the client. This might not be a very good option because this will put load balancer with a lot of open file handles. So , my question is . How do I get this stuff done ? I found a Git Server written in node.js which can do this job. But this requires having node up and running on the clustered server as well (which seems like an unnecessary overkill) Any suggestions ?
-
Answer:
Do you really just want load balancing, or do you actually need Git replication? If you're load balancing across several Git servers you need them to have the same state. You should be able to load-balance your Git-over-HTTP traffic with any HTTP load balancer. However at some point you actually need to keep your individual Git repositories in sync. To do that you need to (1) transfer objects, which is relatively easy because of how Git names its objects and (2) sync up the branch references, which is harder because Computer Science. Fortuantely there are programs such as etcd and Zookeeper to do the second one for you:http://zgp.org/pipermail/linux-elitists/2013-August/013541.html (proof of concept here:https://github.com/dmarti/piehole ) It's an interesting problem but you need to understand something about the Git data structures to work on it. Good article on that: http://stefan.saasen.me/articles/git-clone-in-haskell-from-the-bottom-up/ (you don't have to know Haskell to learn a lot from this).
Don Marti at Quora Visit the source
Related Q & A:
- How do I implement actionBarSherlock?Best solution by androidbegin.com
- How do I migrate a flat svn repo to git repo?Best solution by Stack Overflow
- How can I implement an atomic incr and decr on top of an eventually consistent key-value store?Best solution by Stack Overflow
- How can I implement idle timeout in android?Best solution by Stack Overflow
- How can I implement a multilayer social network in R?Best solution by Computational Science
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.