Saving a new row in DynamoDB and then listing all those items with eventual read consistency?Dynamodb checking for uniqueness across primary key AND another fieldDynamoDB eventually consistence read ordering for sequential written dataConfused by AWS DynamoDB with UserIDHow to tackle eventual consistency issues on AWSAWS IAM Fine-Grained Access Control though APIGateway and LambdaDoes Terraform offer strong consistency with S3 and DynamoDB?Using AWS To Process Large Amounts Of Data With ServerlessDynamoDB Eventually consistent reads vs Strongly consistent readsHow to handle eventually consistent reads in DynamoDBAWS DynamoDB. Am I overusing my write capacity?
Can I Retrieve Email Addresses from BCC?
voltage of sounds of mp3files
Why does John Bercow say “unlock” after reading out the results of a vote?
Is there an Impartial Brexit Deal comparison site?
Can somebody explain Brexit in a few child-proof sentences?
What to do with wrong results in talks?
Ways to speed up user implemented RK4
Displaying the order of the columns of a table
What are the ramifications of creating a homebrew world without an Astral Plane?
Why Were Madagascar and New Zealand Discovered So Late?
Implement the Thanos sorting algorithm
Where in the Bible does the greeting ("Dominus Vobiscum") used at Mass come from?
What's a natural way to say that someone works somewhere (for a job)?
What would be the benefits of having both a state and local currencies?
Everything Bob says is false. How does he get people to trust him?
Trouble understanding overseas colleagues
Print name if parameter passed to function
I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?
Have I saved too much for retirement so far?
The baby cries all morning
Was the picture area of a CRT a parallelogram (instead of a true rectangle)?
How to be diplomatic in refusing to write code that breaches the privacy of our users
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
Efficiently merge handle parallel feature branches in SFDX
Saving a new row in DynamoDB and then listing all those items with eventual read consistency?
Dynamodb checking for uniqueness across primary key AND another fieldDynamoDB eventually consistence read ordering for sequential written dataConfused by AWS DynamoDB with UserIDHow to tackle eventual consistency issues on AWSAWS IAM Fine-Grained Access Control though APIGateway and LambdaDoes Terraform offer strong consistency with S3 and DynamoDB?Using AWS To Process Large Amounts Of Data With ServerlessDynamoDB Eventually consistent reads vs Strongly consistent readsHow to handle eventually consistent reads in DynamoDBAWS DynamoDB. Am I overusing my write capacity?
So imagine we have a web frontend & API Gateway/Lambda/DynamoDB backend.
The user navigates to the "Add Project" page where they type the name of the new Project and click Save, this then navigates to a list of Projects (which should include the one they just added).
Because the read in DynamoDB is eventual by default, it is possible that the user would click save and then not see their new Project listed on the next page - this could cause confusion and if they entered a lot of information a bit of panic.
Is it a good pattern to have the backend accept an additional param to say "strongly consistent read" on the "getProjects" call? Or is there another way to deal with this?
amazon-web-services amazon-dynamodb serverless
add a comment |
So imagine we have a web frontend & API Gateway/Lambda/DynamoDB backend.
The user navigates to the "Add Project" page where they type the name of the new Project and click Save, this then navigates to a list of Projects (which should include the one they just added).
Because the read in DynamoDB is eventual by default, it is possible that the user would click save and then not see their new Project listed on the next page - this could cause confusion and if they entered a lot of information a bit of panic.
Is it a good pattern to have the backend accept an additional param to say "strongly consistent read" on the "getProjects" call? Or is there another way to deal with this?
amazon-web-services amazon-dynamodb serverless
add a comment |
So imagine we have a web frontend & API Gateway/Lambda/DynamoDB backend.
The user navigates to the "Add Project" page where they type the name of the new Project and click Save, this then navigates to a list of Projects (which should include the one they just added).
Because the read in DynamoDB is eventual by default, it is possible that the user would click save and then not see their new Project listed on the next page - this could cause confusion and if they entered a lot of information a bit of panic.
Is it a good pattern to have the backend accept an additional param to say "strongly consistent read" on the "getProjects" call? Or is there another way to deal with this?
amazon-web-services amazon-dynamodb serverless
So imagine we have a web frontend & API Gateway/Lambda/DynamoDB backend.
The user navigates to the "Add Project" page where they type the name of the new Project and click Save, this then navigates to a list of Projects (which should include the one they just added).
Because the read in DynamoDB is eventual by default, it is possible that the user would click save and then not see their new Project listed on the next page - this could cause confusion and if they entered a lot of information a bit of panic.
Is it a good pattern to have the backend accept an additional param to say "strongly consistent read" on the "getProjects" call? Or is there another way to deal with this?
amazon-web-services amazon-dynamodb serverless
amazon-web-services amazon-dynamodb serverless
asked Mar 8 at 9:45
Force HeroForce Hero
407516
407516
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It's actually a good pattern to do a consistent read after you insert or update an item. An example of this can be seen at the DynamoDB docs when describing CRUD operations
A common pattern I've done in the past when working with web applications is to end any POST/PUT request with a redirect to a GET in which I enable strong consistency. That gives strong consistency to the list immediately after inserting. In most cases users will just do nothing after inserting, will navigate to a different part of the application, or will click to see the details of the item.
Let's suppose the user clicks on the item in the list to see the details. Theoretically it might not be propagated yet (although chances is it will be, because DynamoDB replication tends to be very fast). Another pattern I have used in the past is for detail pages I issue an eventual request, but if I get no results, instead of returning not found directly to the end user, I retry once the read with consistency. If it returns no results, then I return the not found, but if it was just a propagation issue, then you are good to go.
Thanks, this is useful. In your last para, you said suppose they click the item but theoretically it might not be propagated - if it's listed it will have propagated won't it? Does the consistent read wait for propagation or does it attempt to read from 2 of 3 DDb instances and will therefore always get the record if it exists?
– Force Hero
Mar 8 at 11:00
You cannot assume anything, as the underlying mechanism might change over time. The contract between DynamoDB and you is that if you want to be sure you get consistent data, you need to issue a consistent read. Having executed a consistent read before is not a guarantee that the next inconsistent read will have the latest data. As you well said, it might be the case the consistent read is using a quorum mechanism, but that's an implementation detail that it's not part of the API contract.
– Javier Ramirez
Mar 8 at 11:24
1
Got it, crystal clear. Thanks for your help!
– Force Hero
Mar 8 at 11:53
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55060527%2fsaving-a-new-row-in-dynamodb-and-then-listing-all-those-items-with-eventual-read%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's actually a good pattern to do a consistent read after you insert or update an item. An example of this can be seen at the DynamoDB docs when describing CRUD operations
A common pattern I've done in the past when working with web applications is to end any POST/PUT request with a redirect to a GET in which I enable strong consistency. That gives strong consistency to the list immediately after inserting. In most cases users will just do nothing after inserting, will navigate to a different part of the application, or will click to see the details of the item.
Let's suppose the user clicks on the item in the list to see the details. Theoretically it might not be propagated yet (although chances is it will be, because DynamoDB replication tends to be very fast). Another pattern I have used in the past is for detail pages I issue an eventual request, but if I get no results, instead of returning not found directly to the end user, I retry once the read with consistency. If it returns no results, then I return the not found, but if it was just a propagation issue, then you are good to go.
Thanks, this is useful. In your last para, you said suppose they click the item but theoretically it might not be propagated - if it's listed it will have propagated won't it? Does the consistent read wait for propagation or does it attempt to read from 2 of 3 DDb instances and will therefore always get the record if it exists?
– Force Hero
Mar 8 at 11:00
You cannot assume anything, as the underlying mechanism might change over time. The contract between DynamoDB and you is that if you want to be sure you get consistent data, you need to issue a consistent read. Having executed a consistent read before is not a guarantee that the next inconsistent read will have the latest data. As you well said, it might be the case the consistent read is using a quorum mechanism, but that's an implementation detail that it's not part of the API contract.
– Javier Ramirez
Mar 8 at 11:24
1
Got it, crystal clear. Thanks for your help!
– Force Hero
Mar 8 at 11:53
add a comment |
It's actually a good pattern to do a consistent read after you insert or update an item. An example of this can be seen at the DynamoDB docs when describing CRUD operations
A common pattern I've done in the past when working with web applications is to end any POST/PUT request with a redirect to a GET in which I enable strong consistency. That gives strong consistency to the list immediately after inserting. In most cases users will just do nothing after inserting, will navigate to a different part of the application, or will click to see the details of the item.
Let's suppose the user clicks on the item in the list to see the details. Theoretically it might not be propagated yet (although chances is it will be, because DynamoDB replication tends to be very fast). Another pattern I have used in the past is for detail pages I issue an eventual request, but if I get no results, instead of returning not found directly to the end user, I retry once the read with consistency. If it returns no results, then I return the not found, but if it was just a propagation issue, then you are good to go.
Thanks, this is useful. In your last para, you said suppose they click the item but theoretically it might not be propagated - if it's listed it will have propagated won't it? Does the consistent read wait for propagation or does it attempt to read from 2 of 3 DDb instances and will therefore always get the record if it exists?
– Force Hero
Mar 8 at 11:00
You cannot assume anything, as the underlying mechanism might change over time. The contract between DynamoDB and you is that if you want to be sure you get consistent data, you need to issue a consistent read. Having executed a consistent read before is not a guarantee that the next inconsistent read will have the latest data. As you well said, it might be the case the consistent read is using a quorum mechanism, but that's an implementation detail that it's not part of the API contract.
– Javier Ramirez
Mar 8 at 11:24
1
Got it, crystal clear. Thanks for your help!
– Force Hero
Mar 8 at 11:53
add a comment |
It's actually a good pattern to do a consistent read after you insert or update an item. An example of this can be seen at the DynamoDB docs when describing CRUD operations
A common pattern I've done in the past when working with web applications is to end any POST/PUT request with a redirect to a GET in which I enable strong consistency. That gives strong consistency to the list immediately after inserting. In most cases users will just do nothing after inserting, will navigate to a different part of the application, or will click to see the details of the item.
Let's suppose the user clicks on the item in the list to see the details. Theoretically it might not be propagated yet (although chances is it will be, because DynamoDB replication tends to be very fast). Another pattern I have used in the past is for detail pages I issue an eventual request, but if I get no results, instead of returning not found directly to the end user, I retry once the read with consistency. If it returns no results, then I return the not found, but if it was just a propagation issue, then you are good to go.
It's actually a good pattern to do a consistent read after you insert or update an item. An example of this can be seen at the DynamoDB docs when describing CRUD operations
A common pattern I've done in the past when working with web applications is to end any POST/PUT request with a redirect to a GET in which I enable strong consistency. That gives strong consistency to the list immediately after inserting. In most cases users will just do nothing after inserting, will navigate to a different part of the application, or will click to see the details of the item.
Let's suppose the user clicks on the item in the list to see the details. Theoretically it might not be propagated yet (although chances is it will be, because DynamoDB replication tends to be very fast). Another pattern I have used in the past is for detail pages I issue an eventual request, but if I get no results, instead of returning not found directly to the end user, I retry once the read with consistency. If it returns no results, then I return the not found, but if it was just a propagation issue, then you are good to go.
answered Mar 8 at 10:24
Javier RamirezJavier Ramirez
1,8531022
1,8531022
Thanks, this is useful. In your last para, you said suppose they click the item but theoretically it might not be propagated - if it's listed it will have propagated won't it? Does the consistent read wait for propagation or does it attempt to read from 2 of 3 DDb instances and will therefore always get the record if it exists?
– Force Hero
Mar 8 at 11:00
You cannot assume anything, as the underlying mechanism might change over time. The contract between DynamoDB and you is that if you want to be sure you get consistent data, you need to issue a consistent read. Having executed a consistent read before is not a guarantee that the next inconsistent read will have the latest data. As you well said, it might be the case the consistent read is using a quorum mechanism, but that's an implementation detail that it's not part of the API contract.
– Javier Ramirez
Mar 8 at 11:24
1
Got it, crystal clear. Thanks for your help!
– Force Hero
Mar 8 at 11:53
add a comment |
Thanks, this is useful. In your last para, you said suppose they click the item but theoretically it might not be propagated - if it's listed it will have propagated won't it? Does the consistent read wait for propagation or does it attempt to read from 2 of 3 DDb instances and will therefore always get the record if it exists?
– Force Hero
Mar 8 at 11:00
You cannot assume anything, as the underlying mechanism might change over time. The contract between DynamoDB and you is that if you want to be sure you get consistent data, you need to issue a consistent read. Having executed a consistent read before is not a guarantee that the next inconsistent read will have the latest data. As you well said, it might be the case the consistent read is using a quorum mechanism, but that's an implementation detail that it's not part of the API contract.
– Javier Ramirez
Mar 8 at 11:24
1
Got it, crystal clear. Thanks for your help!
– Force Hero
Mar 8 at 11:53
Thanks, this is useful. In your last para, you said suppose they click the item but theoretically it might not be propagated - if it's listed it will have propagated won't it? Does the consistent read wait for propagation or does it attempt to read from 2 of 3 DDb instances and will therefore always get the record if it exists?
– Force Hero
Mar 8 at 11:00
Thanks, this is useful. In your last para, you said suppose they click the item but theoretically it might not be propagated - if it's listed it will have propagated won't it? Does the consistent read wait for propagation or does it attempt to read from 2 of 3 DDb instances and will therefore always get the record if it exists?
– Force Hero
Mar 8 at 11:00
You cannot assume anything, as the underlying mechanism might change over time. The contract between DynamoDB and you is that if you want to be sure you get consistent data, you need to issue a consistent read. Having executed a consistent read before is not a guarantee that the next inconsistent read will have the latest data. As you well said, it might be the case the consistent read is using a quorum mechanism, but that's an implementation detail that it's not part of the API contract.
– Javier Ramirez
Mar 8 at 11:24
You cannot assume anything, as the underlying mechanism might change over time. The contract between DynamoDB and you is that if you want to be sure you get consistent data, you need to issue a consistent read. Having executed a consistent read before is not a guarantee that the next inconsistent read will have the latest data. As you well said, it might be the case the consistent read is using a quorum mechanism, but that's an implementation detail that it's not part of the API contract.
– Javier Ramirez
Mar 8 at 11:24
1
1
Got it, crystal clear. Thanks for your help!
– Force Hero
Mar 8 at 11:53
Got it, crystal clear. Thanks for your help!
– Force Hero
Mar 8 at 11:53
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55060527%2fsaving-a-new-row-in-dynamodb-and-then-listing-all-those-items-with-eventual-read%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown