Skip to content

EMQ X 4.0.0 Released

Compare
Choose a tag to compare
@Rory-Z Rory-Z released this 17 Jan 11:54
· 16873 commits to master since this release
7a1d22e

Introduction

EMQ X 4.0.0 is a major release.

In this version we significantly improved the throughput of the broker by refactoring the session and channel, improved the extensibility and monitorability by adding more hooks and counters, redesigned rule-engine SQL to filtering messages/events mainly by topics. And also lots of improvements in REST APIs, authentication plugins, and the MQTT client.

The Broker

  • Improved the throughput of the broker:

    The session process is removed. Now all the logics about session and connection are put into a single process. This significantly improves the throughput of the broker. In one of our benchmarks, we've achieved throughput max to 1 million TPS of QoS0 messages on a single node with 16 CPU cores. And another test shows emqx is able to handle 2 million concurrent connections on a single node without any problem using only about 17G memory. See the benchmark reports of emqx v4.0.0 for more information.

  • Optimized handling of MQTT packets:

    The handling of MQTT packets is changed a lot to make a cleaner code base. See the module emqx_channel for more infomation.

  • Improved the metrics:

    We've renamed some counters and also added more counters:

    • client.connect
    • client.connack
    • client.connected
    • client.authenticate
    • client.check_acl
    • client.subscribe
    • client.unsubscribe
    • client.disconnected
    • session.created
    • session.resumed
    • session.takeovered
    • session.discarded
    • session.terminated
  • Improved the hooks:

    We've modified parameters of some hooks and also added more hook-points:

    • client.connect: MQTT CONNECT Packet Received
    • client.connack: MQTT CONNACK Packet Sent
    • client.connected: The MQTT Client is connected
    • client.disconnected: The MQTT Client is disconnected
    • client.authenticate: Authenticate the MQTT Client
    • client.check_acl: Check Pub/Sub ACL
    • client.subscribe: MQTT SUBSCRIBE Packet Received
    • client.unsubscribe: MQTT UNSUBSCRIBE Packet Received
    • session.created: A new session is created
    • session.subscribed: After session subscribed a topic
    • session.unsubscribed: After session unsubscribed a topic
    • session.resumed: A session is resumed
    • session.takeovered: A session is takeovered
    • session.discarded: A session is discarded
    • session.terminated: A session is terminated
    • message.publish: A message is published
    • message.delivered: A message is delivered
    • message.acked: A messaeg is acked
    • message.dropped: A message is dropped due to no subscribers
  • Fixed the issue that failure of SSL handshake would crash the process:

    To defend the process crash and give a readable error log message if SSL handshake failed.

  • Fixed the issue that max_subscriptions not working:

    Fixed the issue that the zone.external.max_subscriptions in emqx.conf not working. See emqx/emqx#2908 for more information.

  • Fixed message out-of-order issues when forwarding across clusters:

    The inter-node messages are sent via multiple RPC channels, and the strategy of choosing the channels is random by default. This causes the messages of the same topic out-of-order after being sent to the other node. We changed the default strategy to hashed by topic in this fix.

  • Fixed the issue that REST API and CLI cannot get multiple routes for a topic:

    See emqx/emqx-management#150 for more information.

REST API

  • Supported IPv6 in REST APIs:

    IPv6 is now supported in all REST APIs.

  • The default listening port for the HTTP API server is changed from 8080 to 8081:

    The old default port of management APIs 8080 is easily conflicted with other services running on the same node. We changed it defaults to 8081.

  • Redesgin the APIs for sessions and connections:

    The session in emqx is now a concept part of the clients. connections APIs are changed to clients APIs, and the new APIs support all the old features was in session APIs.

  • Support returning the real topic of shared subscription in the subscriptions API:

    Now the shared subscriptions are shown in the form of '$shared//topic'.

  • Support configuring the default AppID and AppSecret:

    Now default AppID and AppSecret can be configured in etc/emqx_management.conf.

  • The HTTP API for publishing message now supports base64 encoded payload:

    Some users may want to publish binary message over HTTP APIs. From this feature they can do that by sending a base64 encoded payload.

  • Fix the issue that encoded URI isn't handled correctly:

    The API for deleting banned clients was not handling the percent encoded URL before this fix.

Authentication Plugins

  • Support defining HTTP request headers in config files.

  • Support configuring the default clientids and usernames in config files:

    This feature was removed from emqx v3.0, and is added again now.

MQTT Client (emqtt)

  • emqtt provides command line interfaces for publishing and subscribing.

Rule Engine (emqx-rule-engine)

  • Redesigned the SQL for rule engine:

    SQL for rule-engine is changed a little bit in its FROM clause. The old syntax looks like:

    SELECT * FROM "message.publish"

    But now it is changed to:

    SELECT * FROM "t/#"

    So it is now filtering messages/events mainly by topics.

    This change stops rule engine from processing the SELECT clause if the topic is not matched, so improved the performance.