Unbounded Result Sets
Learn about design with skepticism, and resilience, with an example of commerce server failure, out of memory error.
We'll cover the following
Design with skepticism
Designing with skepticism will help achieve resilience. Ask, “What can system X do to hurt me?” and then design a way to dodge whatever wrench your supposed ally throws. If our application is like most, it probably treats its database server with far too much trust. We’re going to illustrate how a healthy dose of skepticism will help applications dodge a bullet or two. A common structure in the code goes like this: send a query to the database and then loop over the result set, processing each row. Often, processing a row means adding a new data object to a collection. What happens when the database suddenly returns five million rows instead of the usual hundred or so? Unless our application explicitly limits the number of results it’s willing to process, it can end up exhausting its memory or spinning in a while loop long after the user loses interest.
Get hands-on with 1400+ tech skills courses.