-
Notifications
You must be signed in to change notification settings - Fork 514
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
Improve streaming /order_book endpoint #644
Comments
Good idea, I think I vote for:
it's easy to check the difference in the client side (especially in React apps where you can simply push a new state to the app) and sending a diff would complicate this endpoint a lot. I think along this change we could also keep a local cache of each active order book (that has listening clients) and send updates if there is a change. Then even if there are thousands of listening clients to a single order book it will only send a single DB query every X seconds. This still will be a bit slow if you send many requests to different order books but given there are only a few popular markets (so far) it will largely improve performance. But first, let's check if we can optimize the I'm adding this to Horizon 0.14.X milestone as it's a performance fix but would be really great to have this.
There will be no changes between ledgers so this can be updated every new ledger (2-5 sec.). |
Closed by #828 |
It looks like Horizon's streaming
/order_book
endpoint is unaware of changes to the data. It sends the entire orderbook every second over the eventstream.Check out the Stellar Lab for an example.
Ideally it could do one of the following:
Either way, it could be rate limited to send at most an update every 200ms (configurable), to avoid flooding the client with a very busy order book.
@bartekn @tomerweller
The text was updated successfully, but these errors were encountered: