Replies: 1 comment 2 replies
-
You don't have the full source, so it's not easy to say, but I have an idea looking at what's here. It looks like you are running a new HTTPS connection for each message. HTTPS requires a SSL handshake which is very slow on these embedded systems. There is no specialized encryption or certificate hardware so it takes a lot of cycles just to do the initial TLS handshake. Maybe you should consider WebSockets? https://github.com/Links2004/arduinoWebSockets . That keeps the connection open and lets you do your comms w/o requiring a handshake every message. The actual encrypt/decrypt isn't too bad, only the TLS handshaking, so that might give massive improvements. Alternatively look into TLS sessions. Basically they let you short-circuit the TLS handshake by storing the last parameters. |
Beta Was this translation helpful? Give feedback.
-
Hi there, I'm trying to upload data to a server via HTTP post. I'm pre-assembling the data into a single char array and sending that in one go using client.print(&array) using the below code, which works perfectly at very low data rates (one line of ~250 characters every 5 seconds):
I connect to the server using the following routine:
However, when I run the code five times and average the time taken to send each packet I get the following result:
If I hook up a scope to the wifi chip's clock pin (R6) I see the following trace:
You can see that after every SPI transaction there's an almost immediate reply from the wifi chip... Then 60ms where the device does nothing. This seems like an excessive delay to me, but I can't track down where it's coming from in the source. How can I optimise my HTTP code to increase throughput?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions