子ページ
  • Stash を拡張して連続統合性能を実現する

Stash is now known as Bitbucket Server.
See the

Unknown macro: {spacejump}

of this page, or visit the Bitbucket Server documentation home page.

メタデータの末尾にスキップ
メタデータの先頭に移動

If you've got CI or other automatic tooling set up to poll Stash for changes, you can end up with high load on your Stash server. Consider for instance a CI server that has a number of builds set up for a given repository. Each of those builds polls Stash for changes and when it detects a change, it starts a new build. If your CI server supports parallel and/or chained build steps, each of these builds typically results in multiple clone operations of the same repository. The result: lots of polling for changes, and bursts of clones of a repository.

 

キャッシング

CI results in highly repetitive calls to Stash: polling for changes typically results in the same response 90% of the time and a build triggers a number of identical clone calls to Stash. Both operations can benefit greatly from caching when you experience repetitive load from CI. 

制限事項

  • Caching is applied to the HTTP protocol only. If your CI builds access Stash over SSH, consider switching to HTTP/HTTPS to benefit from caching. Requests over SSH will not benefit from caching.
  • Caching is applied to 'ref advertisement' (polling for changes), clone and shallow clone requests only. Fetch/pull operations are not cached, but these operations will still benefit from the 'ref advertisement' cache.
  • As a precaution, ref advertisement caching is disabled by default. The openness of the plugin system means that plugins (or manually installed git hooks) could be updating refs in repository without the caching plugin detecting these changes. The result would be a stale refs cache and failing clone/fetch operations. However, if you know that there are no plugins or git hooks installed that make changes to the repository directly, you can enable the ref advertisement caching (see the Configuration section below). Note that as an additional precaution, the ref advertisement caches are configured to automatically expire after a minute.

インストールガイド

  • Install the SCM Cache Plugin from the Marketplace.
  • Update the configuration if required.

構成

The SCM Cache Plugin for Stash can be configured through the REST endpoint (some settings, not all) and <STASH-HOME>/stash-config.properties. Settings configured through REST are considered before the settings in stash-config.properties.

stash-config.properties settings

設定既定値説明
plugin.stash-scm-cache.expiry.check.interval

300

(5 min)

Controls how frequently expired caches are checked and deleted from disk.

Time is in SECONDS.

plugin.stash-scm-cache.minimum.free.space

1073741824

(1 Gb)

Controls how much space needs to be available on disk (specifically under <STASH-HOME>/caches) for caching to be enabled. This setting ensures that the cache plugin does not fill up the disk.

Value is in BYTES.

plugin.stash-scm-cache.refs.enabled
falseControls whether ref advertisement operations are cached.
plugin.stash-scm-cache.refs.ttl

60

(1 min)

Controls how long the caches for ref advertisements are kept around when there no changes to the repository.

ユーザーがリポジトリへのプッシュを行ったり、プル リクエストがマージされたりすると、キャッシュは自動的に無効化されます。

Time is in SECONDS.

plugin.stash-scm-cache.upload-pack.enabled
true

Controls whether clone operations are cached.

plugin.stash-scm-cache.upload-pack.ttl

3600

(1 hour)

リポジトリへの変更がないときに、クローン操作のキャッシュを保持する長さを制御します。

ユーザーがリポジトリへのプッシュを行ったり、プル リクエストがマージされたりすると、キャッシュは自動的に無効化されます。

Time is in SECONDS.

 

REST API

メソッドURL説明
GET
/rest/scm-cache/latest/config/refs/enabled
ref advertisement キャッシュが有効化されているか (true) 無効化されているか (false) を取得します。
PUT
/rest/scm-cache/latest/config/refs/enabled/{status}

ref advertisement キャッシュを有効化 (status = true) または無効化 (status = false) します。

GET
/rest/scm-cache/latest/config/refs/ttl
ref advertisement キャッシュの有効期限を秒単位で取得します。
PUT
/rest/scm-cache/latest/config/refs/ttl/{expiryInSec}
ref advertisement キャッシュの有効期限を秒単位で設定します。
GET
/rest/scm-cache/latest/config/upload-pack/enabled
Retrieve the whether clone caching is enabled (true) or disabled (false).
PUT
/rest/scm-cache/latest/config/upload-pack/enabled/{status}
クローン キャッシュを有効化 (status = true) または無効化 (status = false) します。
GET
/rest/scm-cache/latest/config/upload-pack/ttl
クローン キャッシュの有効期限を秒単位で取得します。
PUT
/rest/scm-cache/latest/config/upload-pack/ttl/{expiryInSec}
クローン キャッシュの有効期限を秒単位で設定します。
GET
/rest/scm-cache/latest/caches
現在のキャッシュに関する情報 (サイズ、キャッシュのヒット数、ミス数など) を取得します。
削除
/rest/scm-cache/latest/caches
すべてのキャッシュをクリアします。
GET
/rest/scm-cache/latest/caches/{projectKey}/{repoSlug}
projectKey および repoSlug で識別されるリポジトリのキャッシュに関する情報 (サイズ、キャッシュのヒット数、ミス数など) を取得します。
削除
/rest/scm-cache/latest/caches/{projectKey}/{repoSlug}

projectKey および repoSlug で識別されるリポジトリのキャッシュをクリアします。

 

 

 

 

  • ラベルなし