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

Make network requests serially in network connection #646

Closed
matus-tomlein opened this issue Nov 29, 2023 · 0 comments
Closed

Make network requests serially in network connection #646

matus-tomlein opened this issue Nov 29, 2023 · 0 comments
Labels
category:breaking_change A breaking change will be introduced if this issue is completed. status:completed Completed - but might not be released yet.
Milestone

Comments

@matus-tomlein
Copy link
Contributor

Background
There are 2 settings in the emitter – buffer option (default 10) and emit range (default 150). Buffer option is the number of events that have to pile up before the tracker makes a request. Emit range is the number of events that can be sent in one iteration of the emitter (basically at once).

If due to collector being down, 200 events pile up in the event queue on the tracker, the emitter will make 15 requests with 10 events and fire them at the same time to the collector (because emit range is 150 and buffer size is 10 so max 10 events fit in one request => 15 requests).

Problem
The goal of making parallel requests is to send the events to the collector faster. However, after doing some tests, this does not seem to be the case in practice – sending 500 events in batches of 25 per request takes around the same total time to finish when making requests in parallel as it does when making requests serially.

Moreover, making requests in parallel increases the likelihood of duplicate events ending up in the warehouse. If there is a problem with the network connection while the requests are made, more events will be resent. Also making multiple requests at once increases the chance of network failures on weaker connections.

Suggestion
The suggested approach is to:

  1. Make requests serially. Adapt the NetworkConnection to receive one request at a time.
  2. Change the semantics of the buffer option and emit range so that buffer option is the minimum number of events that have to pile up before making a network request, and emit range is the maximum number of events that can be sent in a single request to the collector (may be larger than buffer option in case of events piling up in the event queue due to previous failed requests).

Same issue on the iOS tracker.

@matus-tomlein matus-tomlein added the category:breaking_change A breaking change will be introduced if this issue is completed. label Nov 29, 2023
@matus-tomlein matus-tomlein added this to the 6.0.0 milestone Dec 7, 2023
@mscwilson mscwilson added the status:completed Completed - but might not be released yet. label Jan 26, 2024
@mscwilson mscwilson mentioned this issue Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:breaking_change A breaking change will be introduced if this issue is completed. status:completed Completed - but might not be released yet.
Projects
None yet
Development

No branches or pull requests

2 participants