[mod_python] scalability question?

Alec Matusis matusis at yahoo.com
Thu Apr 3 04:17:07 EDT 2008


I just installed a second webserver machine. About 1/3 of all http requests
are now routed to this new webserver, which has identical configuration to
the first webserver.
Both webservers connect to a single DB server. 

On the new webserver I am intermittently getting the following error:
OperationalError: (2003, "Can't connect to MySQL server on '10.18.3.0' (4)")

What puzzles me is that the old webserver did not have this error under 70%
higher request rate (at 600 req/sec), before some of the load was removed
from it. Mod_python/python installation is identical on both boxes, and they
are running exactly identical scripts. TCP stack also seems to be configured
identically.
When I got a bunch of these errors, I did notice about 15000 connections to
the database in TIME_WAIT state on this problematic new webserver. The new
machine is a bit slower (2x2.66GHz xeon vs 2x3.0GHz on the old one), but
would this small difference cause such a problem?

The script that connects to the DB is:

def load(self):
       .....
        dbc = MySQLdb.connect(host=config.db_host, db=config.db,
user=config.db_user, passwd=config.db_passwd )
        dbc.autocommit(True)
        c = dbc.cursor()
        r = c.execute( query)
        if r == 0: #not sure what the key error is supposed to be but it is
being caught
            raise ProfileError

        rvalues = c.fetchone()
        c.close()
        dbc.close()
	  ....
  

I am very puzzled what may cause this...




More information about the Mod_python mailing list