I have a tinder style app that allows users to rate events. After a user rates an Event, a background resque job runs that re-ranks the other events based on user's feedback.
This background job takes about 10 seconds and it runs about 20 times a minute per user.
Using a simple example. If I have 10 users using the app at any given time, and I never want a job to be waiting, what's the optimal way to do this?
I'm confused about Dynos, resque pools, and redis connections. Can someone help me understand the difference? Is there a way to calculate this?
Rails is a development tool which gives web developers a framework, providing structure for all the code they write. The Rails framework helps developers to build websites and applications, because it abstracts and simplifies common repetitive tasks.
Basecamp, GitHub, Shopify, Airbnb, Hulu and Zendesk all retain elements of Ruby On Rails, as does streaming behemoth Netflix. One of the most popular – arguably era-defining – ways of accessing media still uses Rails and does so very successfully – and that's not to be sniffed at.
Ruby on Rails is used as a backend framework for web applications. It's known for efficiency and scalability. You can write rich functionality with much fewer lines of code as opposed to what you'd need in Java or Node.
Many large companies (Imgur, Github, Twitch.tv, and others) still use RoR for their apps. The foundation for a future for the Ruby on Rails framework has been set. As long as RoR's features and functionality are among the best, well-known companies will continue using it in development.
Not sure you're asking the right question. Your real question is "how can I get better performance?" Not "how many dynos?" Just adding dynos won't necessarily give you better performance. More dynos give you more memory...so if your app is running slowly because you're running out of available memory (i.e. you're running on swap), then more dynos could be the answer. If those jobs take 10 seconds each to run, though...memory probably isn't your actual problem. If you want to monitor your memory usage, check out a visualization tool like New Relic.
There are a lot of approaches to solving your problem. But I would start with the code that your wrote. Posting some code on SO might help understand why that job takes 10 seconds (Post some code!). 10 seconds is a long time. So optimizing the queries inside that job would almost surely help.
Another piece of low hanging fruit...switch from resque to sidekiq for your background jobs. Really easy to use. You'll use less memory and should see an instant bump in performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With