You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The biggest factor is not serialization but opening HTTP connection and waiting for the result.
Low hanging fruits:
make HttpConnection reuse connections instead opening new ones - this shaves off ~400ms from each envelope and increases throughput 3x
increase the number of threads in AsyncConnection. Single thread with reusable HTTP connections can send ~8 messages per second (depending on location and how quickly Sentry server sends back the response).
Not-so-low hanging fruits - develop a non blocking version of Connection which takes into account the constraints and requirements mentioned above.
At this point microbenchmarking does not bring much value, as the time is spent on HTTP (and likely negotiating TLS) rather than constructs in our Java code.
Switching to non blocking version solves the problem completely BUT as a drawback - pulls dependencies to HTTP clients that users may not want to have on their classpath. I believe the right way to continue is to give users an easy way to provide their own instance of Connection so that they can implement sending data to Sentry using the client of their choice.
In addition to that, we will provide one NIO based implementation - based either on
The transport is an internal construct of the client that abstracts away the event sending. Typically the transport runs in a separate thread and gets events to send via a queue. The transport is responsible for sending, retrying and handling rate limits. The transport might also persist unsent events across restarts if needed.
I believe the connectionFactory and transport should work together and not independently.
Also, transportGate must exist unless we move the whole transport implementation for Android from the sentry package to the sentry android core package.
Ok, then I need to re-think it. Transport returns TransportResult - perhaps if we change it to return Future<TransportResult>. Currently Transport is tightly coupled with the AsyncConnection, to introduce NIO we need to change both, but at least at this stage changing Connection is not possible. Providing an option to set both connection and transport on SentryOptions also does not make sense.
yeah, merging AsyncConnection and HttpTransport makes sense, the abstraction came up from the old Java imp, but it's not needed to remain like this, it's just legacy inheritance.
it'd be fine to return a Future IMO, it's available since API 1 on Android
Activity
maciejwalkowiak commentedon Dec 9, 2020
The biggest factor is not serialization but opening HTTP connection and waiting for the result.
Low hanging fruits:
HttpConnectionreuse connections instead opening new ones - this shaves off ~400ms from each envelope and increases throughput 3xAsyncConnection. Single thread with reusable HTTP connections can send ~8 messages per second (depending on location and how quickly Sentry server sends back the response).Not-so-low hanging fruits - develop a non blocking version of
Connectionwhich takes into account the constraints and requirements mentioned above.At this point microbenchmarking does not bring much value, as the time is spent on HTTP (and likely negotiating TLS) rather than constructs in our Java code.
maciejwalkowiak commentedon Dec 14, 2020
Switching to non blocking version solves the problem completely BUT as a drawback - pulls dependencies to HTTP clients that users may not want to have on their classpath. I believe the right way to continue is to give users an easy way to provide their own instance of
Connectionso that they can implement sending data to Sentry using the client of their choice.In addition to that, we will provide one NIO based implementation - based either on
as an optional dependency.
To provide custom implementation, following two interfaces would have to be implemented:
SentryOptionsobject would have a new propertyconnectionFactory, and we would droptransportandtransportGatefrom there.marandaneto commentedon Dec 14, 2020
why would we drop
transportandtransportGate?https://develop.sentry.dev/sdk/unified-api/
I believe the
connectionFactoryandtransportshould work together and not independently.Also,
transportGatemust exist unless we move the whole transport implementation for Android from the sentry package to the sentry android core package.maciejwalkowiak commentedon Dec 14, 2020
Ok, then I need to re-think it.
TransportreturnsTransportResult- perhaps if we change it to returnFuture<TransportResult>. CurrentlyTransportis tightly coupled with theAsyncConnection, to introduce NIO we need to change both, but at least at this stage changingConnectionis not possible. Providing an option to set both connection and transport onSentryOptionsalso does not make sense.marandaneto commentedon Dec 14, 2020
yeah, merging
AsyncConnectionandHttpTransportmakes sense, the abstraction came up from the old Java imp, but it's not needed to remain like this, it's just legacy inheritance.it'd be fine to return a
FutureIMO, it's available since API 1 on Androidbruno-garcia commentedon Dec 17, 2020
The signature of transport in .NET for example is just
Task(aka:Future). No "TrasnportResult" there.https://github.com/getsentry/sentry-dotnet/blob/main/src/Sentry/Extensibility/ITransport.cs#L17
Merge branch 'gh-1097-transport-connection-flip' of https://github.co…
Merge remote-tracking branch 'origin/main' into gh-1097-rate-limiter
Merge branch 'gh-1097-rate-limiter' of https://github.com/getsentry/s…
Merge remote-tracking branch 'origin/main' into gh-1097-rate-limiter
Merge branch 'main' into gh-1097-rate-limiter