I've known about Vert.x and Play for quite some time but just never got around to covering them here. I recently decided that it was past time to correct for that error in judgement. For those wishing to build reactive microservices for the JVM, these two frameworks definitely merit your consideration. While you don't absolutely require a reactive framework in order to develop reactive microservices, it sure does help to adopt one. If you feel comfortable developing microservices that don't depend on the Spring framework, then read on.
These blogs have been getting more ambitious in scope lately. For the longest time, I would develop the next feature identical rudimentary news feed microservice and blog about how it compares to a previously coded and covered implementation. That type of story usually takes about 6 pages to tell. The last 2 blogs had a wider scope, comparing golang to all previous implementations and comparing both REST vs GraphQL with javascript vs typescript. They both were 10 pages in length each. This blog compares reactive to non-reactive and 2 new frameworks with both each other and with a servlet based predecessor. That is why this latest blog is 14 pages in length.
link | description |
---|---|
Writing Reactive Microservices for the JVM | article below |
Vert.x | reactive web framework used by feed 11 |
Play | reactive web framework used by feed 12 |
Google Trends | Google trends comparison of Play with Vert.x |
Netty | server backend used by both feed 11 and feed 12 |
reactive programming | concepts behind reactive programming |
feed 6 | news feed implementation in Scalatra |
feed 11 | news feed implementation in Vert.x |
feed 12 | news feed implementation in Play |
Slick | library used by feed 11 and 12 for accessing MySql |
Scalatra | servlet web framework used by feed 6 |
Circe | Library used by feed 11 and 12 for working with JSON |
Guice | Library used by feed 12 for dependency injection |
Gatling | Library used by feed 12 for local profile based load testing |
Akka HTTP | Play can be configured to use this instead of Netty |
Java NIO | Netty uses this part of the JRE for non-blocking IO |
Here is a summary of the article below in numbers.
per file Lines of Code | cyclomatic | external | |||
---|---|---|---|---|---|
feed | mean | median | std dev | complexity | dependencies |
6 | 40.15 | 36 | 29.47 | 1,981 | 110 |
11 | 42.33 | 33 | 33.58 | 1,300 | 136 |
12 | 55.48 | 51 | 32.92 | 1,764 | 177 |
throughput | latency | percentiles | ||||
---|---|---|---|---|---|---|
RPM | milliseconds | |||||
feed | entity | mean | mean | median | 95th | 99th |
6 | participant | 3,885 | 6 | 6 | 9 | 12 |
11 | participant | 3,035 | 8 | 7 | 14 | 19 |
12 | participant | 1,824 | 7 | 7 | 10 | 13 |
6 | outbound | 9,580 | 9 | 9 | 14 | 19 |
11 | outbound | 14,136 | 5.3 | 5 | 11 | 15 |
12 | outbound | 20,151 | 4.4 | 4 | 8 | 11 |
Writing Reactive Microservices for the JVM
Having trouble viewing the embedded document? Feel free to download the PDF for offline viewing.