cschleiden / go-workflows

Embedded durable workflows for Golang similar to DTFx/Cadence/Temporal
https://cschleiden.github.io/go-workflows/
MIT License
229 stars 49 forks source link

Add support for workflow and activity queues #351

Closed cschleiden closed 4 months ago

cschleiden commented 4 months ago

This PR introduces the option to have different queues for workflows and activities. For example,

workflow.ExecuteActivity[any](ctx, workflow.ActivityOptions{
    Queue: "custom",
}, MyActivity).Get(ctx)

will schedule the activity task for this activity on a custom queue. Only workers listening to the custom queue will see the task and work on it.

Remaining work:

Closes: #115

cschleiden commented 4 months ago

!bench !large

github-actions[bot] commented 4 months ago

Redis run

Command Mean [ms] Min [ms] Max [ms] Relative
redis-main 158.6 ± 18.0 133.8 178.5 1.00
redis-pr 193.3 ± 23.3 153.8 259.5 1.22 ± 0.20

Large MySQL payload run (1MB)

Command Mean [s] Min [s] Max [s] Relative
mysql-main 24.314 ± 1.450 22.745 27.836 1.02 ± 0.07
mysql-pr 23.933 ± 0.691 23.013 25.016 1.00

Large SQLite payload run (1MB)

Command Mean [s] Min [s] Max [s] Relative
sqlite-main 22.167 ± 0.720 20.974 23.102 1.01 ± 0.05
sqlite-pr 21.922 ± 0.761 21.112 22.967 1.00

Large Redis payload run (1MB)

Command Mean [s] Min [s] Max [s] Relative
redis-main 20.808 ± 0.858 19.723 21.773 1.00
redis-pr 21.007 ± 0.821 19.799 21.945 1.01 ± 0.06
cschleiden commented 4 months ago

!bench !large

cschleiden commented 4 months ago

!bench

github-actions[bot] commented 4 months ago

Redis run

Command Mean [ms] Min [ms] Max [ms] Relative
redis-main 143.2 ± 19.7 121.2 176.1 1.00
redis-pr 184.4 ± 35.8 129.7 252.8 1.29 ± 0.31
cschleiden commented 4 months ago

!bench

github-actions[bot] commented 4 months ago

Redis run

Command Mean [ms] Min [ms] Max [ms] Relative
redis-main 150.2 ± 20.3 124.3 176.8 1.00
redis-pr 198.1 ± 27.8 152.8 258.3 1.32 ± 0.26
cschleiden commented 4 months ago

!bench

github-actions[bot] commented 4 months ago

Redis run

Command Mean [ms] Min [ms] Max [ms] Relative
redis-main 280.1 ± 56.1 202.2 399.7 1.00
redis-pr 313.5 ± 75.2 175.9 432.4 1.12 ± 0.35
cschleiden commented 4 months ago

!bench

github-actions[bot] commented 4 months ago

Redis run

Command Mean [ms] Min [ms] Max [ms] Relative
redis-main 138.8 ± 17.8 120.1 189.9 1.00
redis-pr 167.2 ± 20.7 120.4 189.7 1.21 ± 0.21
cschleiden commented 4 months ago

!bench

github-actions[bot] commented 4 months ago

MySQL run

Command Mean [ms] Min [ms] Max [ms] Relative
mysql-main 547.2 ± 147.0 422.7 920.9 1.07 ± 0.30
mysql-pr 510.9 ± 42.9 463.2 566.6 1.00

SQLite run

Command Mean [ms] Min [ms] Max [ms] Relative
sqlite-main 847.8 ± 108.3 586.8 917.2 1.29 ± 0.32
sqlite-pr 657.0 ± 138.4 475.2 873.5 1.00

Redis run

Command Mean [ms] Min [ms] Max [ms] Relative
redis-main 168.1 ± 28.1 133.9 247.8 1.00
redis-pr 208.1 ± 24.8 174.0 253.1 1.24 ± 0.25