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

Is it possible to increase the speed and throughput? #30

Open
nilstk opened this issue May 12, 2021 · 2 comments
Open

Is it possible to increase the speed and throughput? #30

nilstk opened this issue May 12, 2021 · 2 comments

Comments

@nilstk
Copy link

nilstk commented May 12, 2021

Hello developers,

after compiling the demo app for Android and using Gattlink+UDP+DTLS (we will require the same setup and encryption or even something with certificates), I noticed that the throughput is very slow with about 1950 B/s only.

By default, increasing the packet size would allow me to reduce protocol overhead and gain more speed/throughput. I was wondering, which values you would recommend me for tweaking here?

In the "Link Controller Setup" I noticed that the MTU (for BT) is set to 185. By default, BT should support larger packets and I assume this figure is based on the IP/UDP overhead?

What about those values like 1280 for the IP MTU... ? Any chance to increase the throughput somehow?

P.S.
It appears modifying the values in the link controller setup has no effect. At least, there is no update of the settings. Can you confirm that or let me know how to use it?

@barbibulle
Copy link
Contributor

Hi. The GATT MTU doesn't play such a large role in the overall throughput you can achieve. Very small values (like the default value of 23) are a problem, but at the MTU gets larger, the overhead starts being negligible. 185 is a "common" value that used to be the default for iOS devices for a while.
What affects throughput the most is:
1/ whether or not both devices support the "Data Length Extension" feature of Bluetooth (introduced in 4.2 I believe). That can make a significant difference. Most recent phones support that, but a number of embedded devices still don't
2/ the limit on the number of Bluetooth packets that can be send/received per connection event. Most phones do have an (undocumented) limit, depending on the phone model and OS version. For example, older iPhones tend to limit the number of low level packets per connection event to 6 (it is higher on more recent phones). This is all the most impactful when there's no Data Length Extension support (the packets are smaller). The duration of a connection event depends on the negotiated connection interval between the two peers, so exactly how many low level packets per second can be sent/received will vary based on those two factors

What we observe in practice is that without Data Length Extension, with a 150 to 512 GATT MTU, you should see on the order of 10,000 bytes/s of reliable throughput, with a connection interval of 15 to 30ms. You can get much better if you're able to negotiate a short (say <= 15ms) connection event, and Data Length Extension is supported, and the limit on the number of packets per connection event isn't severely limited.

In your case, what's the device on the other side of the connection? Another Android phone, or an embedded device, or something else? Are you able to check the values of the negotiated connection interval?
The best way to analyze this is with a BT sniffer (you can get one for ~$20).

Please note that the Link Controller feature, while in code base, isn't really enabled. We have currently left it mostly de-activated, because is requires some additional logic that we haven't had the time to integrate into the Github project yet. But it really shouldn't be needed here, at least not for speed. The main role of the link controller is to allow dynamic changes in the connection parameters, which can currently only really be done when you have full control over an embedded device with a customized BT stack.

@nilstk
Copy link
Author

nilstk commented May 26, 2021

Thanks for your reply.

We used two Android devices (Samsung S7 [Android 8] and a S88 Pro [Android 10]) and the included GoldenGate example Android app without modifications so far.

The app indicates an RX/TX length of 23 in the Link Controller setup. I don't know if these values are correct with respect to your last paragraph? That said the connection is very slow with just 2000 Bytes at maximum.

I tried already to update the MTU settings (GATTLINK_FRAGMENT_SIZE and IP_MTU), but it didn't not really increased the throughput. Nevertheless, on other devices (Pixel 3 and Lenova Tablet) we see a throughput of around 5000 Bytes/s using the original app. Maybe, it is caused by one of the devices.

Nevertheless, even 5000 Bytes per second wouldn't be that fast. Am I correct that I can set the GATT MTU using GG_STACK_BUILDER_DEFAULT_GATTLINK_FRAGMENT_SIZE (gg_stack_builder_base.h) and just increase its value?

warrencomputes pushed a commit that referenced this issue Nov 16, 2022
…ve_reference_refactoring_part1 to master

* commit '7945c6720216024c80b03792e18d1af258f17b8d':
  FC-5315: add create and free wrapper functions
  FC-5315: add synchronized annotation to setter and getter
  FC-5315: apply new native reference interface to CoapEndpoint and coap filter class
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

No branches or pull requests

2 participants