- Create a new Ruby Project
- Write the code
- Run the worker
- Queue a message
- Pros & Cons
Achieve Cloud Elasticity with Iron
Speak to us to find how you can achieve cloud elasticity with a serverless messaging queue and background task solution with free handheld support.
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
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
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
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
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.
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.