Skip to content

WIP: Part 1 recap - #230

Merged
hjwp merged 12 commits into
masterfrom
part-1-recap
Feb 7, 2020
Merged

hjwp merged 12 commits into
masterfrom
part-1-recap

Conversation

@bobthemighty

Copy link
Copy Markdown
Contributor

I think this should satisfy @brandon-rhodes ?

Part 1 just finished unceremoniously, and we should call back to what we're trying to achieve, and psych ourselves up for how part 2 will build upon it.

I think we do want to include a paragraph on performance to the effect that:

  • Performance will be fine if you're fetching 10, 20, even 100 batches at a time. Databases are fast, and our aggregates only include the data that we need to do our calculations.
  • If you honestly need to have more than 50 or so rows in an aggregate, lazy collections are your friends.
  • In practice, we expect to have 20 or so batches "active" at any one time, and the rest are "finished". We only care about active batches for the purposes of this system.
  • If your aggregates are loading too much data, and performance is suffering, you need to find another aggregate. There is no single "correct" aggregate, because it's a choice that we make in order to select an appropriate consistency boundary.

@brandon-rhodes

Copy link
Copy Markdown

It has the Brandon seal of approval!

Comment thread chapter_07_aggregate.asciidoc Outdated
* Dealing with eventual consistency between aggregates can be complex.
|===

Part one Recap

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options, neither of which i'm particularly wedded to:

  • keep this at end of chapter 7
  • give it its own chapter
  • put it in the part 2 intro

i don't have strong enough feelings to make a change, but just in case one of these sparks interest...

Comment thread chapter_07_aggregate.asciidoc Outdated
Comment thread chapter_07_aggregate.asciidoc
Comment thread chapter_07_aggregate.asciidoc Outdated

@seddonym seddonym left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great changes. I've added a few thoughts but nothing major.

BTW @bobthemighty's comments on this PR would be great in the book when talking about aggregate design.

Comment thread chapter_07_aggregate.asciidoc
Comment thread chapter_07_aggregate.asciidoc Outdated
but the failures might be more recoverable. So, as usual, the right solution
will depend on circumstances.
Again, in our simple case, it's not obvious which to prefer. In a more complex
scenario, `SELECT FOR UPDATE` might lead to more deadlocks, while `REPEATABLE

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like you're comparing apples and oranges here. Maybe pessimistic vs optimistic locking is a better comparison. (You can use SELECT FOR UPDATE to implement optimistic locking too - if you can't acquire the lock, you give up and retry later.)

Comment thread chapter_07_aggregate.asciidoc Outdated
.A component diagram for our app at the end of Part One
image::images/apwp_p101.png[]

Well, here we are, at the end of part one. What have we achieved? We've seen how

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially read this as, 'Well, where are we now in comparison to this diagram?' Maybe need to be more explicit, "Our application is now shaped like this..." or something.

Comment thread chapter_07_aggregate.asciidoc Outdated
image::images/apwp_p101.png[]

Well, here we are, at the end of part one. What have we achieved? We've seen how
to start building a domain model that's exercised by a set of high-level unit

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 'start building' should be replaced with 'build'?

Comment thread chapter_07_aggregate.asciidoc Outdated
Well, here we are, at the end of part one. What have we achieved? We've seen how
to start building a domain model that's exercised by a set of high-level unit
tests. Our tests describe the behaviour of our system - the rules that we agreed
with our business stakeholders - in human readable prose. When our business

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think tests are written in prose!

Comment thread chapter_07_aggregate.asciidoc Outdated

Well, here we are, at the end of part one. What have we achieved? We've seen how
to start building a domain model that's exercised by a set of high-level unit
tests. Our tests describe the behaviour of our system - the rules that we agreed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have always like the phrase 'living documentation' to refer to tests.

Comment thread chapter_07_aggregate.asciidoc
one we've shown, you can specify the behavior you want, and see how
it changes. You can also use the test as a basis for performing
some performance experiments.
We don't really have time to discuss all the tradeoffs between `REPEATABLE READ`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify - I'm not sure it's right to be comparing an isolation level with a SQL command...that doesn't make sense to me.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add an example of another DB's OCC mechanism (e.g., Elasticsearch), it may help clarify the point and make a clean segue between this section and the next.

@hjwp
hjwp merged commit 6b48973 into master Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants