I want to implement a service for a great number of devices. This service should be able to send/receive (small - max 1kB) messages between server and client, but also p2p between device and device.
For now I am thinking about achieving this with MQTT, as it seems to be a lightweight low traffic generating protocol. As stated in this question XMPP might also be an alternative, but I'm not sure if this is giving me the performance I need.
Summarized I have the following expectations for the protocol:
- Small Overhead
- Small Payload
- High number of clients (starting with 100.000)
- Handles unstable network connection
- Scalability for example by using multiple broker instances
- P2P Connections between clients (could be solved with an involved server)
- If possible open source implementations in Java, JavaScript and C++
Is MQTT the right approach for me or should I better look at some alternatives? Please keep also in mind that I would need to create a highly scalable service.
I think all your expectations except for 6. can be fulfilled with MQTT if you use it the right way. You should have a look at http://www.eclipse.org/paho/ and http://mosquitto.org/ for OpenSource implementations.
As MQTT has a publish-subscribe architecture where every message is send to and distributed by the message broker (server), P2P might be a problem. You could use a dedicated topic for every connection between two clients, but the messages would still have to pass through a message broker. As a workaround, you could negotiate a P2P connection between clients over MQTT and then use the negotiated channel with another protocol.