Zeebe speed vs Camunda speed

I am really inspired about Zeebe internal architecture. But right now I cannot understand what is going on my test environments.
I’ve created 2 the same environment with Camunda Latest and Zeebe 0.25 (0.24). And deployed identical bpm for testing. It has 3 steps:

  1. Generate random item+amount (from 0 to 1000)
  2. Gateway (amount more 800 or less)
  3. Just message what path is taken.
    Test show that 3js external procedures are running about 1 ms total. So it is engine test for speed.

Here is docker projects:


Setup easy to repeat:
Clone, start.sh - to start everything up
deploy_test_bpm.sh - to deploy test bpm
test.sh - run test. It spams 100 workflow instances.

I am running it on 4 cpu linux server, not super fast, just a test server.
Here is Elastic search data on zeebe:
one of 100
Time intent value.bpmnElementType value.elementId
October 15th 2020, 01:08:19.572 ELEMENT_COMPLETED PROCESS payment-retrieval
October 15th 2020, 01:08:19.567 ELEMENT_COMPLETING PROCESS payment-retrieval
October 15th 2020, 01:08:19.559 ELEMENT_COMPLETED END_EVENT Event_payment_done
October 15th 2020, 01:08:19.551 ELEMENT_COMPLETING END_EVENT Event_payment_done
October 15th 2020, 01:08:19.541 ELEMENT_ACTIVATED END_EVENT Event_payment_done
October 15th 2020, 01:08:19.532 ELEMENT_ACTIVATING END_EVENT Event_payment_done
October 15th 2020, 01:08:19.523 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_1x4x0wm
October 15th 2020, 01:08:19.510 ELEMENT_COMPLETED SERVICE_TASK charge-card
October 15th 2020, 01:08:19.503 ELEMENT_COMPLETING SERVICE_TASK charge-card
October 15th 2020, 01:08:19.399 ELEMENT_ACTIVATED SERVICE_TASK charge-card
October 15th 2020, 01:08:19.387 ELEMENT_ACTIVATING SERVICE_TASK charge-card
October 15th 2020, 01:08:19.359 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_03ohmj4
October 15th 2020, 01:08:19.349 ELEMENT_COMPLETED EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:08:19.335 ELEMENT_COMPLETING EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:08:19.322 ELEMENT_ACTIVATED EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:08:19.302 ELEMENT_ACTIVATING EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:08:19.279 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_0mpi2xp
October 15th 2020, 01:08:19.248 ELEMENT_COMPLETED SERVICE_TASK generate
October 15th 2020, 01:08:19.220 ELEMENT_COMPLETING SERVICE_TASK generate
October 15th 2020, 01:08:19.143 ELEMENT_ACTIVATED SERVICE_TASK generate
October 15th 2020, 01:08:19.104 ELEMENT_ACTIVATING SERVICE_TASK generate
October 15th 2020, 01:08:19.063 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_1jf65ng
October 15th 2020, 01:08:19.049 ELEMENT_COMPLETED START_EVENT StartEvent_1
October 15th 2020, 01:08:19.032 ELEMENT_COMPLETING START_EVENT StartEvent_1
October 15th 2020, 01:08:19.005 ELEMENT_ACTIVATED START_EVENT StartEvent_1
October 15th 2020, 01:08:18.967 ELEMENT_ACTIVATING START_EVENT StartEvent_1
October 15th 2020, 01:08:18.941 ELEMENT_ACTIVATED PROCESS payment-retrieval
October 15th 2020, 01:08:18.924 ELEMENT_ACTIVATING PROCESS payment-retrieval

single test:
Time intent value.bpmnElementType value.elementId
October 15th 2020, 01:34:21.008 ELEMENT_COMPLETED PROCESS payment-retrieval
October 15th 2020, 01:34:21.004 ELEMENT_COMPLETING PROCESS payment-retrieval
October 15th 2020, 01:34:21.000 ELEMENT_COMPLETED END_EVENT Event_payment_done
October 15th 2020, 01:34:20.996 ELEMENT_COMPLETING END_EVENT Event_payment_done
October 15th 2020, 01:34:20.993 ELEMENT_ACTIVATED END_EVENT Event_payment_done
October 15th 2020, 01:34:20.989 ELEMENT_ACTIVATING END_EVENT Event_payment_done
October 15th 2020, 01:34:20.985 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_1x4x0wm
October 15th 2020, 01:34:20.981 ELEMENT_COMPLETING SERVICE_TASK charge-card
October 15th 2020, 01:34:20.981 ELEMENT_COMPLETED SERVICE_TASK charge-card
October 15th 2020, 01:34:20.941 ELEMENT_ACTIVATED SERVICE_TASK charge-card
October 15th 2020, 01:34:20.938 ELEMENT_ACTIVATING SERVICE_TASK charge-card
October 15th 2020, 01:34:20.933 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_03ohmj4
October 15th 2020, 01:34:20.929 ELEMENT_COMPLETED EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:34:20.924 ELEMENT_COMPLETING EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:34:20.919 ELEMENT_ACTIVATED EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:34:20.915 ELEMENT_ACTIVATING EXCLUSIVE_GATEWAY Gateway_19wpozq
October 15th 2020, 01:34:20.910 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_0mpi2xp
October 15th 2020, 01:34:20.901 ELEMENT_COMPLETED SERVICE_TASK generate
October 15th 2020, 01:34:20.900 ELEMENT_COMPLETING SERVICE_TASK generate
October 15th 2020, 01:34:20.803 ELEMENT_ACTIVATED SERVICE_TASK generate
October 15th 2020, 01:34:20.793 ELEMENT_ACTIVATING SERVICE_TASK generate
October 15th 2020, 01:34:20.785 SEQUENCE_FLOW_TAKEN SEQUENCE_FLOW Flow_1jf65ng
October 15th 2020, 01:34:20.776 ELEMENT_COMPLETED START_EVENT StartEvent_1
October 15th 2020, 01:34:20.766 ELEMENT_COMPLETING START_EVENT StartEvent_1
October 15th 2020, 01:34:20.759 ELEMENT_ACTIVATED START_EVENT StartEvent_1
October 15th 2020, 01:34:20.749 ELEMENT_ACTIVATING START_EVENT StartEvent_1
October 15th 2020, 01:34:20.748 ELEMENT_ACTIVATED PROCESS payment-retrieval
October 15th 2020, 01:34:20.731 ELEMENT_ACTIVATING PROCESS payment-retrieval

Here is camunda data:
camunda: act_hi_actinst
act_id_ act_type_ start_time_ end_time_ duration_ ms
Event_payment_done noneEndEvent 15.10.2020 1:43 15.10.2020 1:43 0
charge-card serviceTask 15.10.2020 1:43 15.10.2020 1:43 31
Gateway_19wpozq exclusiveGateway15.10.2020 1:43 15.10.2020 1:43 1
generate serviceTask 15.10.2020 1:43 15.10.2020 1:43 74
StartEvent_1 startEvent 15.10.2020 1:43 15.10.2020 1:43 0
Total: 106ms

I have to note that I was trying many zeebe params and it is fastest configuration ive got. If I increase number of brokers and number of partitions and replications factor speed is slowing. Yes, I understand that every broker uses a lots of thread and should be on different server, and partitions on different disk. But it is just basic test for speed, when everything works as docker-compose file.
And right now it is standalone gateway + 1 broker (fastest).


Here is idle htop when system is doing nothing.
First for 1 broker + 1 gateway
Second for 3 brokers + 1 gateway
I cannot understand why 4 cpu are spending 15 and 35% of resources.
When I stop zeebe and run camunda, and I see everything is ok. 0-2%