Saving a new row in DynamoDB and then listing all those items with eventual read consistency? The 2019 Stack Overflow Developer Survey Results Are InDynamodb 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 someone be penalized for an "unlawful" act if no penalty is specified?

Time travel alters history but people keep saying nothing's changed

If a Druid sees an animal’s corpse, can they wild shape into that animal?

Can a flute soloist sit?

Can you compress metal and what would be the consequences?

Delete all lines which don't have n characters before delimiter

Is "plugging out" electronic devices an American expression?

Are there incongruent pythagorean triangles with the same perimeter and same area?

Earliest use of the term "Galois extension"?

Is there a symbol for a right arrow with a square in the middle?

Shouldn't "much" here be used instead of "more"?

Does a dangling wire really electrocute me if I'm standing in water?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Are spiders unable to hurt humans, especially very small spiders?

Geography at the pixel level

How to answer pointed "are you quitting" questioning when I don't want them to suspect

Am I thawing this London Broil safely?

What is the accessibility of a package's `Private` context variables?

Is a "Democratic" Oligarchy-Style System Possible?

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

Did 3000BC Egyptians use meteoric iron weapons?

What is the most effective way of iterating a std::vector and why?

Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?

Button changing it's text & action. Good or terrible?



Saving a new row in DynamoDB and then listing all those items with eventual read consistency?



The 2019 Stack Overflow Developer Survey Results Are InDynamodb 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?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















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?










share|improve this question




























    0















    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?










    share|improve this question
























      0












      0








      0








      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?










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 9:45









      Force HeroForce Hero

      407516




      407516






















          1 Answer
          1






          active

          oldest

          votes


















          1














          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.






          share|improve this answer























          • 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











          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
          );



          );













          draft saved

          draft discarded


















          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









          1














          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.






          share|improve this answer























          • 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















          1














          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.






          share|improve this answer























          • 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













          1












          1








          1







          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.






          share|improve this answer













          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 10:24









          Javier RamirezJavier Ramirez

          1,8881023




          1,8881023












          • 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











          • 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



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved