I don't use Rails, or even Ruby at all if I can avoid it, so I'm sure I'm missing something obvious here, but... why in the world would anyone want to use a web server which can only handle one request at once?
Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
11–20 of 56 posts
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#12Great article. Background/deferred job processing has been immensely painful for us, and I have no idea what the accepted best job queue is. We're still stuck on backgroundrb, which is a nightmare. Nanite looks like overkill, and has too many deps.
Workling has worked well for us -- Rany Keddo is a phenomenal open source guy. Tobi's deferred jobs also looked totally solid to me. That one's proven because it drives Shopify. We use his liquid plugin, which is also stellar. That underlines a big issue with Rails dev even today -- its really hard to know what's good / what works, and what is just some weekend project for someone.
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#13Sad town happens. 1 in 4 requests after Request A will go to port 8000, and all of those requests will wait in line as that mongrel chugs away at the slow request... I don't use Rails, or even Ruby at all if I can avoid it, so I'm sure I'm missing something obvious here, but... why in the world would anyone want to use a web server which can only handle one request at once?
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#14Earlier quoted context omitted.
Workling has worked well for us -- Rany Keddo is a phenomenal open source guy. Tobi's deferred jobs also looked totally solid to me. That one's proven because it drives Shopify. We use his liquid plugin, which is also stellar. That underlines a big issue with Rails dev even today -- its really hard to know what's good / what works, and what is just some weekend project for someone.
Found Tobi's delayed_job (not deferred) --- I think I like the design better than Workling; fewer moving parts, just a database backend end a rake script. The biggest problem we have with backgroundrb (which again: nightmare) is not really ever knowing the state of current running jobs.
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#15Sad town happens. 1 in 4 requests after Request A will go to port 8000, and all of those requests will wait in line as that mongrel chugs away at the slow request... I don't use Rails, or even Ruby at all if I can avoid it, so I'm sure I'm missing something obvious here, but... why in the world would anyone want to use a web server which can only handle one request at once?
Sorry, what's the platonic ideal you're suggesting as an alternative? There are threaded Ruby web servers, but, just like with Python, the interpreter is mostly giantlocked. The overwhelming majority of web apps out there are running under Apache, which just like Mongrel is preforking and queueing, not running everything simultaneously.
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#16Earlier quoted context omitted.
Sorry, what's the platonic ideal you're suggesting as an alternative? There are threaded Ruby web servers, but, just like with Python, the interpreter is mostly giantlocked. The overwhelming majority of web apps out there are running under Apache, which just like Mongrel is preforking and queueing, not running everything simultaneously.
If you have N requests hitting Apache and one of them is slow, that one slow request will run in its own process while the fast requests are sent off to other processes. The fact that each process only handles one request at once is irrelevant.
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#17Earlier quoted context omitted.
If you have N requests hitting Apache and one of them is slow, that one slow request will run in its own process while the fast requests are sent off to other processes. The fact that each process only handles one request at once is irrelevant.
Uh, this is how Rails setups work too. You aren't talking directly to Mongrel.
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#18Use HAProxy. Take the time to configure it correctly. It's absolutely the most stable and useful loadbalancer I've used. It also solves this issue by talking to your backends.
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#19Earlier quoted context omitted.
Uh, this is how Rails setups work too. You aren't talking directly to Mongrel.
Maybe I misunderstood the article -- it sounded to me like requests were being distributed between Mongrel processes and queued on the individual processes rather than being queued centrally and only allocated to individual processes when a process is free (like Apache does).
That's why you run like 4 or 8 or 12 or N many mongrels to handle additional load.
Re: Building and Scaling a Startup on Rails: Things We Learned the Hard Way (by Posterous S08)
#20Great article. Background/deferred job processing has been immensely painful for us, and I have no idea what the accepted best job queue is. We're still stuck on backgroundrb, which is a nightmare. Nanite looks like overkill, and has too many deps.