Load Test
According to a benchmark made by Glory4Gamers, the open source version of the Mercure.rocks hub is able to 40k concurrent connections on a single EC2 t3.micro instance. It's even possible to handle way more connections by using the HA version of the Mercure.rocks Hub.
To test your own infrastructure, we provide a Gatling-based load test. It allows to test any implementation of the protocol, including the open source Hub.
Running the Load Test
Download Gatling version 3
Clone the Mercure repository:
git clone https://github.com/dunglas/mercure
Run
path/to/gatling/bin/gatling.sh --simulations-folder mercure/gatling/
Configuration
Available environment variables (all are optional):
HUB_URL
: the URL of the hub to testJWT
: the JWT to use for authenticating publishersSUBSCRIBER_JWT
: the JWT to use for authenticating subscribers, fallbacks toJWT
not set andPRIVATE_UPDATES
setINITIAL_SUBSCRIBERS
: the number of concurrent subscribers initially connectedSUBSCRIBERS_RATE_FROM
: minimum rate (per second) of additional subscribers to connectSUBSCRIBERS_RATE_TO
: maximum rate (per second) of additional subscribers to connectPUBLISHERS_RATE_FROM
: minimum rate (per second) of publicationsPUBLISHERS_RATE_TO
: maximum rate (per second) of publicationsINJECTION_DURATION
: duration of the publishers injectionCONNECTION_DURATION
: duration of subscribers' connectionRANDOM_CONNECTION_DURATION
: to randomize the connection duration (will longsCONNECTION_DURATION
at max)PRIVATE_UPDATES
: to send private updates with random topics instead of public updates always with the same topic