Task Multithreading with Python for your Server

Words
312
Reading
2 min
Listen
Play
9y

Hello coders!

I'd like to share with you my new discovery: RQ (Redis Queue)

This is such a powerful tool that I felt like writing a little introduction (I must admit it's simple nature captivated me).

This out-of-the-box python library allows you to easily queue intensive tasks with a dedicated virtual server (Redis) in a controlled manner.

Let's say you have a low budget hosting plan; with RQ you can easily schedule tasks priorities and let the server fulfill the "jobs" on its own pace without interfering with the primary http workflow. Naturally, whether you run a local or remote server, the resources will efficiently apply on the chain of tasks.

Why this is not just a great tool for budget servers


Even the most powerful server can bottleneck its http workflop while running intensive secondary activities. You always want to make sure (if you run a web app) users can still have a good experience in your site while your server performs high intensity taks in the background.

If you are interested, RQ has a wonderful documentation website.

Why I chose RQ over Celeris

Celeris seems like a very powerful task management library. The reason why I chose RQ is because of its simplicity and ease of use. Celeris requires more time and configuration and, specially in case you run a small app, RQ has probably already all you need.

Control over assigned jobs

Omg this is so great, each job you assign gets a special ID and you can track every single one. You can check the tasks results, and in case of failure, you get a special flag with the error raise information. There is also a localhost dashboard web out of the box, with which you can easily test and monitor the workflow. Within the dashboard you can also clean/repair/delete tasks and create different kind of work queues.