I run a ESP8266 that send out a door state (open ,close) before going to deep sleep for a while.
Since it is powered by a battery I want to by as quick as possible to connect + send MQTT message.
I made some (very stable) mesurements (wake-up & sending frequence = 1 minute) :
By pushing my investigations I noticed that every 5 minutes (every 6 sending) the MQTT connection & sending takes not 500 ms but almost 2 sec where as the WIFI connection delay stays inchanged.
Did you have a similar issue on Mosquitto brocker connection ?
After some software improvement, I finally achieve to reduce significatly the connection delay
I finally get 254 ms to connect to wifi, connect to MQTT brocker, send payload and return to deep sleep which is really excellent.
That ensures years with one 18650 battery.