IronWorker CaaS Worker: SideKiq Setup
In this article, we will tell you the steps you need to set up SideKiq for IronWorker.
to try a free 14 day trial of Iron.io click here
Setup Outline:
- Create a new Ruby Project
- Write the code
- Run the worker
- Queue a message
- Notes
- Security
- Pros & Cons
SideKiq pronounced Side-Kick is a lightweight Ruby library that provides jobs worker; it relays on Redis in the background as its database.
To implement the SideKiq worker server, you need to have a machine with Ruby and Redis installed on it.
The following steps will show the basic steps need to write your first SideKiq Worker server code.
1. Create a new Ruby project
Create a new directory and add “GemFile” with the following gem and run $ bundle to build your project
source "https://rubygems.org"
gem "sidekiq"
2. Write the Code
Will write a simple code for client and server and define the worker “Perform” function, which executes based on queued job complexity in our use case example.
3. Run the worker
To start the server run $ bundle exec sidekiq -r ./worker.rb
Iron.io Serverless Tools
Speak to us to learn how IronWorker and IronMQ are essential products for your application to become cloud elastic.
4. Queue a message
Run the client
$ bundle exec irb -r ./worker.rb
Call Ourworker.perform_async message to queue a message and pass complexity
OurWorker.perform_async(“easy”)
On the running server console, you can see the asynchronous processing of the queued jobs and the time it takes depending on each one complexity
5. Notes
SideKiq is a lightweight tool for rapid implementation of Worker system if you are familiar with Ruby and can dedicate a server to run the worker and its dependencies
6. Security
SideKiq is compliant with GDPR
7. Pros & Cons
Pros of SideKiq is that it’s a super-fast worker tool with multithreading, automatically configured with Redis, suitable for the application-level worker solutions.
On the other side, it works only with Redis, and if Redis crashes while handling a queue data could be lost.
Unlike IronWorker, it requires a managed server to run and you have to use Ruby, and it requires several dependencies.
References:
https://www.sqlbot.co/blog/delayed-job-vs-sidekiq-which-one-should-you-choose
Unlock the Cloud with Iron.io
Find out how IronWorker and IronMQ can help your application obtain the cloud with fanatical customer support, reliable performance, and competitive pricing.