Automatic maintenance of application server side repository [message #1240030] |
Wed, 05 February 2014 10:14  |
Eclipse User |
|
|
|
Hello,
My web application uses a jgit repository to store content.
It can have a very high uptime (not being restarted for weeks or months).
When the client git is used on the command line, there are some "cleanup" operations that are done from time to time.
Out of the top of my head:
- garbage collection
- packing
What would be the best way to trigger these operations when a repository will be managed programatically by a very long running process ?
- I have found a gc() method, what about packing ?
- During the associated maintenance calls, what can be still performed in parallel on the git repository ( it's a web application, concurrent requests can occur ) ? I already serialize access to the "write" operations, should I consider these maintenance operations as "write operations" as well ? Do they generally last long ? Is there a scheduling policy that would minimize the time spent each time ?
Thanks in advance,
--
Laurent Petit
|
|
|
Re: Automatic maintenance of application server side repository [message #1240080 is a reply to message #1240030] |
Wed, 05 February 2014 11:55  |
Eclipse User |
|
|
|
- gc includes repacking and might take a long time and consume considerable resources (heap and CPU)
depending on the size and complexity of the repository
- you shouldn't run multiple gc commands concurrently on the same repository since this would waste a lot of
resources, if you try that anyway some of the concurrent runs may fail if they fail to acquire locks implemented
by LockFile [1] which is using atomic rename of the lock file to implement locking semantics in jgit. Native git
is using the same locking mechanism.
- there are only a few commands which modify existing objects in these cases jgit (and native git) use this
locking mechanism relying on the atomicity of renaming a file, on filesystems not providing atomic rename git's
locking mechanism won't work
- running other modifying operations like push, update ref etc should be safe to run while gc is running
- which kind of write operations is your application using ?
- why are you serializing write operations ? This severely limits scalability for these operations.
[1] https://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
|
|
|
Powered by
FUDForum. Page generated in 0.05037 seconds