[Mongrel] Some architecture questions for my mongrelian friends

James Tucker jftucker at gmail.com
Fri May 16 17:05:38 EDT 2008

On 16 May 2008, at 21:34, public at misuse.org wrote:

> Hey,
> I'm working on a project, and mongrel may be part of the stack, but  
> I've got some more general questions and ideas I'm hoping to run by  
> this list. The people on this list have a broader knowledgebase and  
> more experience than any place else I know - plus a general  
> friendliness and willingness to help!
> I'm working with a company who has a really antique application  
> stack. Literally from 1998. IIS + ASP + MS SQL server. They want me  
> to help "modernize" things. In the abstract I'd say, "get a really  
> good .NET team and go that route." But they want me to help. All I  
> work in these days is Ruby. And that's all I want to work in. :)
> So my questions are like this:
> 1) Can I in good conscience start migrating this company from IIS/ 
> ASP to Mongrel/Ruby/Merb/ORM (or something like that)? They have  
> roughly 2-3M page views per month.

It can be done. Others can better tell you on the hosting costs, but  
there are sites doing this and apparently making money still :)

> 1.a) No matter how good they think I am, wouldn't it be smarter to  
> move forward with M$ since that's what they've got already? I don't  
> want to be the guy who screws them deeper into the hole by really  
> confusing their stack.

The biggest problems you'll hit with packing Ruby into a production  
windows stack are:
  * No decent web proxy, at least, not like nginx and friends.
  * Apache I've benched up to 8000/s on a quad core on Windows with a  
hello world app and the one click installer. If I remember correctly  
the app was a camping one, so not too bad.
  * The mingw builds of ruby are about 30% faster than the OCI build.
  * You'll have to wait for the release of a decent service manager  
for windows, or roll your own monitor for your services.
  * Logging integration is faster to do unintegrated - analogger has  
been working great for us, but you'll need the trunk build from the  
mercurial repo that has my patches.
  * Windows ruby socket implementations (and ruby herself) have low  
limits for the number of file descriptors. JRuby can help I think, we  
proxy out our services where appropriate.

> I hate it when new dudes come in with their "stack" and bias  
> development based on their preferences withou considering what's  
> already there. I'd rather walk away from this if Microsoft is really  
> their odds-on smart choice (i.e. I don't need the money - I have  
> some personal relations that led me here). All I want is the company  
> to be successful.

JRuby could be a good option for you due to the double-stack style of  
it. You could switch to a Java stack underneath if you need speed /  
less magic / java programmers / whatever.

> 2) Their MS SQL setup is relatively fine. Lots of wacky stored procs  
> which bug me but mostly it's fine. Am I crazy to try to run MS SQL  
> against Ruby/ORM? Seems like there are some people doing it?

Personally I'd go PostgreSQL, if they really like their stored  
procedures, that's not going to play nice with most ruby ORMs. We have  
a product that seals the entire DB behind stored procedures for  
security reasons (extreme case). The front end for that app is rails,  
and we have a single point of control that basically replaces  
activerecord (acts as our virtual-ORM) with about 200 lines of ruby,  
and circa 10k lines of (largely generated) plpgsql.

> 3) If I do this, I'd plan to segment this site into two separate  
> boxes and run the Ruby on a Linux box (and maybe outsource that  
> management to a group like EngineYard). Then have the LB's split  
> traffic between the boxes based on url patterns. Again: crazy?  
> unwise? Currently they're at rackspace which knows poodle about Ruby/ 
> Mongrel afaict.

If you want managed services, then yeah, go for a ruby company. There  
are a lot of differences to deploying ruby fast than some places are  
used to or can envisage. As far as splitting traffic goes, eugh, well  
just think about it carefully.

> Context: The front-end site is not impossibly complex. But there is  
> "deep" integration with some backend admin processes which run a  
> large part of the business: some crm, PPC, finance/accounting, email  
> and billing: all partially implemented and built in hand coded ASP.  
> It's a real tangle and it breaks all the time right now. I want to  
> get most of these processes out into third party systems with much  
> narrower points of contact between the production DB's and the  
> specific admin services. This can only happen incrementally over  
> time. This is in addition to the front-end websystem migration.

Do one piece at a time. It sounds like the kind of scenario where  
you'll be needing to refactor the ASP in order to keep things stable  
whilst migrating pieces of a large system.

> Budgets for this work are not tiny but not enormous. Ditto  
> timeframe. Maybe $250k over 6-8 months.

That's not a lot of money to train up people on ruby. Sure ruby is  
simple from the outset, but some ideas don't map so well. Expect 3 to  
6 months developer learning time before they become seriously  
productive in the language, unless you're in a house full of rock  
stars or polygots. Bad ruby code can sometimes be a lot worse than bad  
code in other languages, but it's really going to depend on the team  
and how they take to the language.

> Any tips or advice on taking on large migration projects such as  
> this would be appreciated. Advice such as "run!" is welcome also. I  
> realize there are no definite answers - I'm just looking for  
> experience or advice on how to reach conclusions here.

Do small chunks at a time. Don't be afraid to refactor the current  
system in order to be sure of stability. Seriously write your tests,  
and be careful around the interface boundaries particularly. The  
problem with tests across interface boundaries is that they're either  
coupled (and slow), or functional (and slow), or mocked (and therefore  
one-sided - it'll only test one side of an interface).

> I realize this is horribly off-topic and impossibly vague. And I  
> wouldn't ask for this input, except that I highly admire and regard  
> the capabilities and experience of many people who are on this list.  
> I can't think of a smarter mail list who could help advise on this.  
> Any assistance at all will be greatly appreciated.
> Thanks!
> Steve
> p.s. Anyone who has possible interest in this project professionally  
> can also contact me directly off-list.
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

More information about the Mongrel-users mailing list