Skip to content

A high-performance, extremely flexible, and easily extensible universal workflow engine.

License

Notifications You must be signed in to change notification settings

siyul-park/uniflow

Repository files navigation

🪐 Uniflow

go report go doc release ci code coverage

A high-performance, extremely flexible, and easily extensible universal workflow engine.

📝 Overview

Uniflow is designed to manage a wide range of tasks, from short-term jobs to long-term processes. It supports declarative workflow definitions and allows for dynamic changes to data flows. With built-in extensions, you can implement complex workflows and add or remove nodes to expand its functionality as needed.

This system empowers you to deliver customized experiences through your service and continuously enhance its capabilities.

🎯 Core Values

  • Performance: Optimized for maximum throughput and minimal latency.
  • Flexibility: Adapt workflows on-the-fly to meet evolving needs.
  • Extensibility: Easily integrate new components and expand your system’s functionality.

🚀 Quick Start

🛠️ Build and Install

To get started, install Go 1.23 or later. Then, follow these steps:

git clone https://github.com/siyul-park/uniflow

cd uniflow

make init
make build

The executable will be located in the dist directory after building.

⚡ Run an Example

Try a basic HTTP request handler using ping.yaml:

- kind: listener
  name: listener
  protocol: http
  port: '{{ .PORT }}'
  ports:
    out:
      - name: router
        port: in

- kind: router
  name: router
  routes:
    - method: GET
      path: /ping
      port: out[0]
  ports:
    out[0]:
      - name: pong
        port: in

- kind: snippet
  name: pong
  language: text
  code: pong

Start the workflow with:

./dist/uniflow start --from-specs ./examples/ping.yaml --env PORT=8000

Verify by calling the HTTP endpoint:

curl localhost:8000/ping
pong#

⚙️ Configuration

Adjust settings through .uniflow.toml or environment variables.

TOML Key Environment Variable Key Example
database.url DATABASE_URL mem:// or mongodb://
database.name DATABASE_NAME -
collection.specs COLLECTION_SPECS nodes
collection.secrets COLLECTION_SECRETS secrets

📊 Benchmark

The following benchmark was conducted on a Contabo VPS S SSD (4 cores, 8GB) using the Apache HTTP benchmarking tool to measure the performance of ping.yaml involving listener, router, and snippet nodes.

ab -n 102400 -c 1024 http://127.0.0.1:8000/ping
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
Benchmarking 127.0.0.1 (be patient)
Server Hostname:        127.0.0.1
Server Port:            8000
Document Path:          /ping
Document Length:        4 bytes
Concurrency Level:      1024
Time taken for tests:   122.866 seconds
Complete requests:      1024000
Failed requests:        0
Total transferred:      122880000 bytes
HTML transferred:       4096000 bytes
Requests per second:    8334.29 [#/sec] (mean)
Time per request:       122.866 [ms] (mean)
Time per request:       0.120 [ms] (mean, across all concurrent requests)
Transfer rate:          976.67 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   3.8      0      56
Processing:     0  121  53.4    121     593
Waiting:        0  120  53.4    121     592
Total:          0  123  53.3    123     594

Percentage of the requests served within a certain time (ms)
  50%    123
  66%    143
  75%    155
  80%    163
  90%    185
  95%    207
  98%    240
  99%    266
 100%    594 (longest request)

📚 Learn More

🌐 Community and Support

📜 License

This project is available under the MIT License. You are free to use, modify, and distribute it in accordance with the terms.