Testing out some simple workers with Ruby, Python, and Node. Was surprised to see Ruby was the fastest and Node was the slowest.
- Ruby 2.7.2
- Node 14.9.0
- Python 3.7.5
- Faktory 1.4.2
- macOS 10.15.7
Vanilla install of Faktory via Homebrew.
Start Faktory
$ faktory
Faktory 1.4.2
Copyright © 2021 Contributed Systems LLC
Licensed under the GNU Public License 3.0
I 2021-02-28T15:31:12.296Z Initializing redis storage at /Users/josh/.faktory/db, socket /Users/josh/.faktory/db/redis.sock
I 2021-02-28T15:31:12.322Z Web server now listening at localhost:7420
I 2021-02-28T15:31:12.322Z PID 23332 listening at localhost:7419, press Ctrl-C to stop
Start a worker for Ruby, Python, and Node.js
$ faktory-worker -r ./worker.rb -l ruby -q ruby
Starting ruby worker...
2021-02-28T15:35:01.284Z 23609 TID-z0 INFO: Running in ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
2021-02-28T15:35:01.285Z 23609 TID-z0 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2021-02-28T15:35:01.285Z 23609 TID-z0 INFO: Starting processing, hit Ctrl-C to stop
$ python worker.py
INFO:faktory.worker:Registered task: python_worker
INFO:root:Starting python worker...
INFO:faktory.connection:Connecting to localhost:7419
INFO:faktory.worker:Queues: python
INFO:faktory.worker:Labels: python
$ node worker.js
Starting node.js worker...
Start 10,000 jobs each
$ ruby app.rb 10000
Starting 10000 jobs for each (ruby, node, python)
2021-02-28 10:36:13 -0500
Done.
Note the last timestamp for each worker:
Ruby: 2021-02-28T10:37:06-05:00 (~ 53 sec)
Python: 2021-02-28T10:37:25.452204 (~ 72 sec)
Node: 2021-02-28T15:37:38.289Z (~ 85 sec)