First off, a disclaimer: yes, I know, this is not an ideal production
environment. I do not have any control over it. Any replies of ‘lol use
linux’ or ‘mysql > mssql’ will be ignored; believe me, I would if I
could, but I have no sway over any of those choices.
Now, to the actual issue.
Background: our system is a legacy system, heavily dependent on stored
procedures. Take everything you know about systems that are heavily
dependent on stored procedures. Got it? Now double that. Literally a
good 3/4 of the app’s logic (that’s a guesstimate) is in MS SQL Server
stored procs.
In our development environment, we run Rails + a single Mongrel
instance. Our dev environment is not heavily trafficked, after all.
There are absolutely no problems in this environment. Everything works
beautifully. I use ActiveRecord magic where I can, call sprocs where I
have to, and life goes on.
In our production environment, things grind to a screeching halt. Here,
we’re using Apache 2.2 with mod_proxy_balancer to point to five Mongrel
instances. Basically, the problem arises because after calling three or
four stored procedures to do some data manipulation (adding, updating,
etc.) and then calling a select statement to get data for a simple view
page. When this happens, the select statement abruptly jumps from one
database connection to a different one - and is blocked at the database
level by the first one. I’ve watched this happen time and again, and
it’s very easy to reproduce.
The app times out forevermore, because all sessions seem to go onto the
same Mongrel instance, which is connected to SQL Server but being
blocked.
Any help you can muster would be fantastic, because while this app can
go live as a single Mongrel app (it’s not heavy-use by any means), we
need to figure this out or it’ll be a roadblock for future Rails use.
Thanks!
–Phil