Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: Events API is unreliable #2529

Merged
merged 1 commit into from Sep 12, 2018
Merged

Problem: Events API is unreliable #2529

merged 1 commit into from Sep 12, 2018

Conversation

vrde
Copy link
Contributor

@vrde vrde commented Sep 10, 2018

Solution: Stop getting events from the Tendermint events API. Get the
event right before returning from the COMMIT phase of Tendermint and
publish it to the events queue.

Fixes #2442
Fixes #2506
Fixes #2434

@ttmc
Copy link
Contributor

ttmc commented Sep 10, 2018

@vrde I put two issues that this PR "Fixes" in the initial comment. Can you verify that I put the correct issues there?

yield {'height': block['height'],
'asset_id': asset_id,
'transaction_id': tx['id']}
'transaction_id': tx.id}
Copy link
Contributor

@ttmc ttmc Sep 10, 2018

Choose a reason for hiding this comment

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

While we're busy fixing the events API, we may as well fix the docs about it. If you look in the docs subsection

http://docs.bigchaindb.com/projects/server/en/master/events/websocket-event-stream-api.html#id3

it gives this "Example message:"

{
    "transaction_id": "<sha3-256 hash>",
    "asset_id": "<sha3-256 hash>",
    "block_id": "<int>"
}

Clearly, "block_id" should be replaced by "height".

Copy link
Contributor

Choose a reason for hiding this comment

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

The sentence right before that also refers to the "containing block’s ID." but it should say "containing block's height."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"block_id": "<int>" is an int wrapped in a string. Should we just use int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll use int. Given that the biggest integer in JavaScript is 9007199254740991, and if a BigchainDB network creates a block every second, we will have problems in 286 million years.

At that point in time we would have other problems to deal with, since all the continents on Earth may fuse into a supercontinent (from Wikipedia).

@vrde vrde force-pushed the fix-events branch 4 times, most recently from d7e179b to 70c3fb4 Compare September 12, 2018 13:21
@codecov-io
Copy link

codecov-io commented Sep 12, 2018

Codecov Report

Merging #2529 into master will increase coverage by 0.82%.
The diff coverage is 80%.

@@            Coverage Diff             @@
##           master    #2529      +/-   ##
==========================================
+ Coverage    93.2%   94.02%   +0.82%     
==========================================
  Files          44       43       -1     
  Lines        2547     2495      -52     
==========================================
- Hits         2374     2346      -28     
+ Misses        173      149      -24

@vrde vrde force-pushed the fix-events branch 2 times, most recently from 6b29818 to 51fed0d Compare September 12, 2018 14:05
Solution: Stop getting events from the Tendermint events API. Get the
event right before returning from the COMMIT phase of Tendermint, and
publish it to the events queue.
Copy link
Contributor

@kansi kansi left a comment

Choose a reason for hiding this comment

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

Seems good. It would be good to test how reliable is the events api now under stress

@vrde
Copy link
Contributor Author

vrde commented Sep 12, 2018

Seems good. It would be good to test how reliable its the events api now under stress

I'm implicitly testing this with the performance tests. I'm able to push 1M transactions and get them through the WebSocket API without any problem. Before it was not possible. I also think this way of getting events removes some load from both BigchainDB and Tendermint (with the previous version of the code, I saw some delay between committing a block and having the transactions through the WebSocket).

@kansi kansi merged commit 4b54e70 into bigchaindb:master Sep 12, 2018
@vrde vrde deleted the fix-events branch September 12, 2018 15:23
@vrde
Copy link
Contributor Author

vrde commented Sep 12, 2018

This PR also closes #2414.

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.

None yet

4 participants