I have an app that uses Resque to enqueue process that handle video processing (similar to youtube). I have a Docker Swarm environment with multiple nodes, some nodes have one or more Resque's workers but some nodes are more powerful than others (i.e more RAM, CPU, GPU) so I want these workers that have better performance to have more "priority" to pick up the jobs enqueued if they are available. I've read in the documentation that it is possible to create multiple queues and set priority to the queues but couldn't find anything about the "worker priority".
Related Questions in RUBY
- how to integrate cashfree payment gateway in ruby on rails project
- RSpec Capybara throwing Selenium error when trying to click a button with browser confirm
- Duplicate GET requests - Rails & Heroku
- convert csv file with json data inside to a column, rows table in 2nd csv file
- Installing dependencies from a gemspec file
- Verifying Google Identity OAuth2 token with Ruby
- Java code of AES/GCM/NoPadding encryption algorithm with authentication tag
- How to fix error in model with gem lockbox
- Cannot install Ruby Gem on Window
- use logstash filter ,aes gcm encrypted in ruby,but cannot decrypted in java
- In Rails 7, what is the right ActiveRecord callback to use if I need to prevent (or rollback) persistance on error?
- How can I go through an array and still remove elements from it
- Nokogiri only returning 5 results
- How do I get the fullscreen mode in firefox?
- undefined group option when using branch reset group regex in Ruby
Related Questions in REDIS
- How to Socket.IO Multithreading on a Raspberry Pi?
- How to get the session ID returned by cookie with spring-session-data-redis
- Cannot serialize (Spring Boot)
- JEDIS/REDIS 'ON' Keyword or broken query?
- Quart_Sessions Redis deletes keys and create backups instead
- Docker builds redis, mounts the host network and uses 192.168.*.* to access the redis server and is denied
- Need a script to fetch the redis latency values over 20 seconds and store the results in a file
- Service in Docker Compose not connecting to Redis container in docker, Failed to connect to any host resolved for DNS name
- Install redis vector database on GCP in a GKE cluster
- how to avoid while loop while waiting for future complete?
- Is it possible to append the data in Redis command
- Not able to inject RedisCache/SyncCache/StatefulRedisConnection beans in micronaut 4.2.1 version
- RedisConnectionFailureException intermittently
- using redis timeseries in aredes error =>Error handling publish event: [ErrorReply: ERR TSDB: invalid value]
- HttpResponseMessage caching using redis
Related Questions in DOCKER-SWARM
- Docker on Multipass VMs: Connecting worker nodes to swarm results in rcp error
- One shared named volume with multiple paths
- Auto update Docker Container by updated Github Repository
- Docker Swarm DNS fails for service name, but service virtual IP address and task IPs are resolved correctly. How to debug this?
- mlflow and docker swarm
- cannot deploy a pypiserver as a service on my docker swarm cluster
- How i can set swarm environment variables in the kafka-ui docker image
- Config reverse proxy for multiple nginx services in docker swarm mode
- Traefik v1.7 : segment issue
- Cannot start postdock/pgpool
- What is the equivalent of Kubernetes Namespaces on Docker swarm
- How to properly manage (access/archive/rotate) logs in a production Docker swarm cluster with several managers/workers, without any lost in no case?
- How to run and network Docker Swarm inside Docker containers?
- Common repository and different Dockerfile and docker-compose.yml
- Gitlab group members missing disappeared
Related Questions in RESQUE
- How to monitor Resque::DirtyExit error in Resque gem worker/child processes?
- How to re run queued job in resque using redis
- When does eager loading happen with resque?
- Resque Set verify_mode on Redis to OpenSSL::SSL::VERIFY_NONE on Heroku
- Finding queue name of a resque job while its being processed
- Rails + How do I assign dedicated workers to Resque queues?
- Allocate multiple workers to the same queue in resque
- Rails Resque - AWS ECS task randomly stuck
- TypeError: Unsupported command argument type: Resque::Worker
- RubyOnRails How to Kill Stuck/Stale Resque Workers
- ActiveJob does not execute the job asynchronously
- Unsupported command argument type: Resque::Worker
- Rails 6.0 Resque Redis and Auth
- How to add a scheduled Resque job in ruby on rails?
- Define worker priority in Resque
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
TL;DR
Run demanding queues on high performance nodes. That's the "Resque way." Otherwise, you'll need to fool around with introspecting queues and node performance in a job hook such as #before-dequeue or #before-perform, but you'll be spending time doing queue management instead of using Resque (or an alternative) in the intended way.
Run Demanding Queues on High-Performance Nodes
Resque doesn't handle numerical queue priorities. It's simply not designed for it. There's are some old (and possibly unmaintained) gems for trying to layer named-based queuing priorities on top of resque (with resque-queue-priority simply being a random example from search results; there are others, but all appear old and largely inactive.
Resque itself is pretty clear that you'll have to adjust your workflow rather than Resque to do what you want, as that kind of node-based affinity is simply not how it was designed to work. The Resque maintainers suggest that you should choose Resque over Delayed Job if:
In Resque, queue priority is really more about which queues get checked first when multiple queues are considered, and is not directly related to node affinities or providing fine-grained priority settings. The project page includes some considerations about when to choose Resque vs. Delayed Job. Other systems will provide other trade-offs, as each has different design and performance goals baked in.
The general expectation for Resque is that you will assign workers to the appropriate queues for that group of workers or on that node. In other words, you should be assigning high-resource items to high-resources queues, and then running those high-resource queues on workers or nodes where you want them run rather than just running
QUEUE="*"everywhere. You could then run other queues with lower resource requirements elsewhere, or even allow your high-performance nodes to consider low-resource queues when the high-resource queues are empty, so long as the resource-intensive jobs don't have to be serviced immediately.If you really want finer grained control of priorities, Resque may not be the right tool. You can look at Delayed Job, Sidekiq, or Rocket Job to see if they fit your needs better. If you have to (or want to) use Resque, then you will likely need to rethink how and where you run your queues, rather than trying to make Resque do something outside its intended design.
Using Job Hooks to Complicate Your Life
If you insist on doing so anyway, you can attempt to inspect a job or the current worker or node's capabilities in a job hook before trying to #perform it, and raising Resque::Job::DontPerform if you want to skip the job while making sure that it doesn't get treated as a failed job or get repeatedly grabbed again by the wrong workers or nodes, but I would consider this approach an error-prone anti-pattern.
Assign resource-intensive jobs to the right queues in the first place, and then run only specific queues on each node based on its capacity or performance characteristics. That way, you reduce the problem to queue assignment for jobs and workers instead of creating job complexity at the code and queue management levels. With that in mind, think carefully before going down the (perhaps tempting) garden path of abusing hooks for capacity management or performance purposes.