Skip to content

Tests for vertx bug #43 - vertx don't instant sends messages while processing handlers!

Notifications You must be signed in to change notification settings

tetv/vertx3-blocking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vertx3-blocking

Tests for vertx bug that doesn't send instantaneously messages while processing handlers!

Background

It seems that vertx in some cases doesn't send messages instantaneously. That means while a vertx is very busy/active there is no messages dispatched to eventBus until the vertx becomes completely idle, that could be a big limitation if there is a need to send messages immediately.

To illustrate the issues, I created a simple ping pong example with junit tests.

  • Ping sends several messages to pong;
  • Pong emulates a 50ms processing time and reply back the message to ping.
  • Ping, in some cases, doesn't receive immediately the message after pong has processed it.

The tests includes two workarounds (while the fix is not available) that solves the issue:

  • using WorkerExecutor (available since vertx 3.3.x) - Vertx documentation
  • using java ExecutorService

Non-clustured vertx:

The issue happens when using vertx.executeBlocking (only for non ordered) or when processing default code in a Multi-Thread Worker.

v Test Type / Pong Verticle Type > Standard Worker MT Worker
Direct code (No executeBlocking) ✔️ ✔️ ✖️≥ 40
vertx.executeBlocking(ordered) ✔️ ✔️ ✔️
vertx.executeBlocking(not ordered) ✖️≥ 40 ✖️≥ 40 ✖️≥ 40
workerExecutor.executeBloking(ordered) ✔️ ✔️ ✔️
workerExecutor.executeBloking(not ordered) ✔️ ✔️ ✔️
javaExecutor.process(ordered) ✔️ ✔️ ✔️
javaExecutor.process(not ordered) ✔️ ✔️ ✔️

Clustured vertx:

The issue happens when using vert.executeBlocking in a worker verticle and when processing default code in a verticle (independently of the verticle type).

This issue could be connected with this issue: vert-x3/issues#75

v Test Type / Pong Verticle Type > Standard Worker MT Worker
Direct code (No executeBlocking) ✖️≥ 2 ✖️≥ 2 ✖️≥ 40
vertx.executeBlocking(ordered) ✔️ ✖️≥ 2 ✖️≥ 2
vertx.executeBlocking(not ordered) ✔️ ✖️≥ 40 ✖️≥ 40
workerExecutor.executeBloking(ordered) ✔️ ✔️ ✔️
workerExecutor.executeBloking(not ordered) ✔️ ✔️ ✔️
javaExecutor.process(ordered) ✔️ ✔️ ✔️
javaExecutor.process(not ordered) ✔️ ✔️ ✔️

Note: The -Dvertx.hazelcast.async-api=true doesn't influence the result.

Build

mvn clean package

Tests

mvn clean test

Test environment

  • Ubuntu 16.04 LTS
  • Java 1.8.0_101-b13

About

Tests for vertx bug #43 - vertx don't instant sends messages while processing handlers!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published