Skip to content

Commit

Permalink
deploy: d60b110
Browse files Browse the repository at this point in the history
  • Loading branch information
whummer committed Oct 31, 2023
1 parent 7dab134 commit 02b9bac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions references/persistence-mechanism/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html><html itemscope itemtype=http://schema.org/WebPage lang=en class=no-js><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=generator content="Hugo 0.101.0"><meta name=robots content="index, follow"><link rel="shortcut icon" href=/favicons/favicon.ico><link rel=apple-touch-icon href=/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/favicons/android-96x96.png sizes=96x96><link rel=icon type=image/png href=/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/favicons/android-192x192.png sizes=192x192><title>Persistence | Docs</title><meta name=description content="Internals of LocalStack persistence mechanism
"><meta property="og:title" content="Persistence"><meta property="og:description" content="Internals of LocalStack persistence mechanism
"><meta property="og:type" content="article"><meta property="og:url" content="/references/persistence-mechanism/"><meta property="article:section" content="references"><meta property="article:modified_time" content="2023-08-17T22:23:40+05:30"><meta property="og:site_name" content="Docs"><meta itemprop=name content="Persistence"><meta itemprop=description content="Internals of LocalStack persistence mechanism
"><meta itemprop=dateModified content="2023-08-17T22:23:40+05:30"><meta itemprop=wordCount content="1174"><meta itemprop=keywords content><meta name=twitter:card content="summary"><meta name=twitter:title content="Persistence"><meta name=twitter:description content="Internals of LocalStack persistence mechanism
"><meta property="og:type" content="article"><meta property="og:url" content="/references/persistence-mechanism/"><meta property="article:section" content="references"><meta property="article:modified_time" content="2023-10-31T09:51:37-04:00"><meta property="og:site_name" content="Docs"><meta itemprop=name content="Persistence"><meta itemprop=description content="Internals of LocalStack persistence mechanism
"><meta itemprop=dateModified content="2023-10-31T09:51:37-04:00"><meta itemprop=wordCount content="1140"><meta itemprop=keywords content><meta name=twitter:card content="summary"><meta name=twitter:title content="Persistence"><meta name=twitter:description content="Internals of LocalStack persistence mechanism
"><link rel=preload href=/scss/main.min.da1aef37f15e6c619f4ea24392f1c1b6367fbf2acfef7370b7623840ed90d2f9.css as=style><link href=/scss/main.min.da1aef37f15e6c619f4ea24392f1c1b6367fbf2acfef7370b7623840ed90d2f9.css rel=stylesheet integrity><script src=https://code.jquery.com/jquery-3.6.0.min.js integrity=sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK crossorigin=anonymous></script>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@docsearch/css@3><script type=text/javascript id=hs-script-loader async defer src=//js-eu1.hs-scripts.com/26596507.js></script>
<script type=text/javascript>!function(){var e,t="179335348579cf9",n=function(){Reo.init({clientID:"179335348579cf9"})};(e=document.createElement("script")).src="https://static.reo.dev/"+t+"/reo.js",e.async=!0,e.onload=n,document.head.appendChild(e)}()</script><script async src="https://www.googletagmanager.com/gtag/js?id=UA-101988473-1"></script>
Expand Down Expand Up @@ -304,9 +304,8 @@
There are four strategies that you can choose from that govern when these snapshots are taken.
You can select a particular save strategy by setting <code>SNAPSHOT_SAVE_STRATEGY=&lt;strategy></code>.</p><ul><li><strong><code>ON_REQUEST</code></strong>: on every AWS API call that potentially modifies the state of a service, LocalStack will save the state of that service.
This strategy minimizes the chance for data loss, but also has significant performance implications. The service has to be locked during snapshotting, meaning that any requests to the particular AWS service will be blocked until the snapshot is complete. In many cases this is just a few milliseconds, but can become significant in some services.</li><li><strong><code>ON_SHUTDOWN</code></strong>: the state of all services are saved during the shutdown phase of LocalStack.
This strategy has zero performance impact, but is not good when you want to minimize the chance for data loss. Should LocalStack for some reason not shut down properly or is terminated before it can finalize the snapshot, you may be left with an incomplete state on disk.</li><li><strong><code>SCHEDULED</code></strong>: (<strong>default</strong>): saves at regular intervals the state of all the services that have been modified since the last snapshot.
This strategy has zero performance impact, but is not good when you want to minimize the chance for data loss. Should LocalStack for some reason not shut down properly or is terminated before it can finalize the snapshot, you may be left with an incomplete state on disk.</li><li><strong><code>SCHEDULED</code></strong> (<strong>default</strong>): saves at regular intervals the state of all the services that have been modified since the last snapshot.
By default, the flush interval is 15 seconds. It can be configured via the <code>SNAPSHOT_FLUSH_INTERVAL</code> configuration variable.
This is a compromise between <code>ON_REQUEST</code> and <code>ON_SHUTDOWN</code> in terms of performance and reliability.</li><li><strong><code>SCHEDULED</code></strong>: (<strong>default</strong>) every 15 seconds, the state of all services that have been modified since the last snapshot are saved.
This is a compromise between <code>ON_REQUEST</code> and <code>ON_SHUTDOWN</code> in terms of performance and reliability.</li><li><strong><code>MANUAL</code></strong>: turns off automatic snapshotting and gives you control through the internal state endpoints.</li></ul><h3 id=load-strategies>Load Strategies</h3><p>You can also configure when LocalStack should restore the state snapshots.</p><ul><li><strong><code>ON_REQUEST</code></strong>: (<strong>default</strong>) the state is loaded lazily when the service is requested. This maintains LocalStack&rsquo;s lazy-loading behavior for AWS services.</li><li><strong><code>ON_STARTUP</code></strong>: the state of all services in the snapshot is restored when LocalStack starts up. This means that services that have stored state are also started on LocalStack start, which will increase the startup time, but also give you immediate feedback whether the state was restored correctly.</li><li><strong><code>MANUAL</code></strong>: turns off automatic loading of snapshots and gives you control through the internal state endpoints.</li></ul><h3 id=endpoints>Endpoints</h3><p>As mentioned, with the <code>MANUAL</code> save or load strategy you can trigger snapshotting manually when it best suits your application flow.</p><ul><li><code>POST /_localstack/state/&lt;service>/save</code> take a snapshot the given service</li><li><code>POST /_localstack/state/&lt;service>/load</code> load the most recent snapshot of the given service</li></ul><p>For example, a snapshot for a particular service (e.g., <code>s3</code>) can be triggered by running the following command.
The service name refers to the AWS service code.</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-console data-lang=console><span style=display:flex><span><span style=color:#000;font-style:italic>curl -X POST http://localhost:4566/_localstack/state/s3/save
</span></span></span></code></pre></div><p>It is also possible to take and load a snapshot of all the services at once. We provide the following endpoints:</p><ul><li><code>POST /_localstack/state/save</code></li><li><code>POST /_localstack/state/load</code></li></ul><p>The response streams line by line the service that has been saved/loaded and the status of the operation.</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-console data-lang=console><span style=display:flex><span><span style=color:#000;font-style:italic>curl -X POST localhost:4566/_localstack/state/save
Expand Down Expand Up @@ -339,7 +338,7 @@
When we restore server backends (like an RDS server or DynamoDB server), we make sure that they are configured to use the state stored in the respective asset directory.</p><p>When LocalStack saves snapshots, it has to lock the particular service to avoid state pollution.
That means that, while a snapshot for a particular service is created, all requests to the service are blocked.
Depending on what you are building, you may find this behavior is slowing down your application.
In most cases, the <code>ON_SHUTDOWN</code> save strategy should solve this problem.</p><br><div class="text-muted mt-5 pt-3 border-top">Last modified August 17, 2023: <a href=https://github.com/localstack/docs/commit/67942a18c3db043c50c9d8395b700cb4ba87f726>revamp the tutorials UI for the Developer Hub (#648) (67942a18c)</a></div></div></main></div></div><footer class="footer-localstack d-print-none"><div class=container-fluid><div class=row><div class=col><div class=mb-3><a href=https://localstack.cloud><img class=footer-logo src=/images/logo.svg></a></div></div><div class=col><div class="text-right link-lists"><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=Twitter aria-label=Twitter><a target=_blank rel=noopener href=https://twitter.com/localstack aria-label=Twitter><i class="fab fa-twitter"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=Discussion aria-label=Discussion><a target=_blank rel=noopener href=https://discuss.localstack.cloud/ aria-label=Discussion><i class="fa fa-comments"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Stack Overflow" aria-label="Stack Overflow"><a target=_blank rel=noopener href=https://stackoverflow.com/questions/tagged/localstack aria-label="Stack Overflow"><i class="fab fa-stack-overflow"></i></a></li></ul><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=GitHub aria-label=GitHub><a target=_blank rel=noopener href=https://github.com/localstack/ aria-label=GitHub><i class="fab fa-github"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Issue tracker" aria-label="Issue tracker"><a target=_blank rel=noopener href=https://github.com/localstack/localstack/issues aria-label="Issue tracker"><i class="fa fa-bug"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=Slack aria-label=Slack><a target=_blank rel=noopener href=https://localstack-community.slack.com/ aria-label=Slack><i class="fab fa-slack"></i></a></li></ul></div></div></div><div class=row><div class=col><hr><div class=row><div class=col><small>Copyright &copy; 2023 LocalStack All Rights Reserved</small></div><div class="col text-right"><small class=ml-1><a href=https://localstack.cloud/privacy-policy/ target=_blank rel=noopener>Privacy Policy</a></small></div></div></div></div></div></footer></div><script src=/js/main.min.1171c0d4dbac2c311ddef7a93d7145f6a82ce227d12106ba66debb77d44b9eef.js integrity="sha256-EXHA1NusLDEd3vepPXFF9qgs4ifRIQa6Zt67d9RLnu8=" crossorigin=anonymous></script>
In most cases, the <code>ON_SHUTDOWN</code> save strategy should solve this problem.</p><br><div class="text-muted mt-5 pt-3 border-top">Last modified October 31, 2023: <a href=https://github.com/localstack/docs/commit/d60b110bf18b6c4d1a2b8b83cbdde2c6f0b283fc>fix duplicate section in docs for scheduled persistence strategy (#882) (d60b110bf)</a></div></div></main></div></div><footer class="footer-localstack d-print-none"><div class=container-fluid><div class=row><div class=col><div class=mb-3><a href=https://localstack.cloud><img class=footer-logo src=/images/logo.svg></a></div></div><div class=col><div class="text-right link-lists"><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=Twitter aria-label=Twitter><a target=_blank rel=noopener href=https://twitter.com/localstack aria-label=Twitter><i class="fab fa-twitter"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=Discussion aria-label=Discussion><a target=_blank rel=noopener href=https://discuss.localstack.cloud/ aria-label=Discussion><i class="fa fa-comments"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Stack Overflow" aria-label="Stack Overflow"><a target=_blank rel=noopener href=https://stackoverflow.com/questions/tagged/localstack aria-label="Stack Overflow"><i class="fab fa-stack-overflow"></i></a></li></ul><ul class="list-inline mb-0"><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=GitHub aria-label=GitHub><a target=_blank rel=noopener href=https://github.com/localstack/ aria-label=GitHub><i class="fab fa-github"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title="Issue tracker" aria-label="Issue tracker"><a target=_blank rel=noopener href=https://github.com/localstack/localstack/issues aria-label="Issue tracker"><i class="fa fa-bug"></i></a></li><li class="list-inline-item mx-2 h3" data-toggle=tooltip data-placement=top title=Slack aria-label=Slack><a target=_blank rel=noopener href=https://localstack-community.slack.com/ aria-label=Slack><i class="fab fa-slack"></i></a></li></ul></div></div></div><div class=row><div class=col><hr><div class=row><div class=col><small>Copyright &copy; 2023 LocalStack All Rights Reserved</small></div><div class="col text-right"><small class=ml-1><a href=https://localstack.cloud/privacy-policy/ target=_blank rel=noopener>Privacy Policy</a></small></div></div></div></div></div></footer></div><script src=/js/main.min.1171c0d4dbac2c311ddef7a93d7145f6a82ce227d12106ba66debb77d44b9eef.js integrity="sha256-EXHA1NusLDEd3vepPXFF9qgs4ifRIQa6Zt67d9RLnu8=" crossorigin=anonymous></script>
<script src=/js/tabpane-persist.js></script>
<script src=https://cdn.jsdelivr.net/npm/@docsearch/js@3></script>
<script type=text/javascript>docsearch({container:"#docsearch",appId:"XBW1JU7CW5",apiKey:"6b0341e2f50196d328d088dbb5cd6166",indexName:"localstack"})</script><script src=/js/global-script.js></script></body></html>
Loading

0 comments on commit 02b9bac

Please sign in to comment.