Forum archive 2000-2006

Ben Pollina - WW2 Connection error

Ben Pollina - WW2 Connection error

by Arnold Pizer -
Number of replies: 0
inactiveTopicWW2 Connection error topic started 9/1/2004; 2:23:59 PM
last post 9/2/2004; 12:06:34 PM
userBen Pollina - WW2 Connection error  blueArrow
9/1/2004; 2:23:59 PM (reads: 1376, responses: 3)
The following error occurs when I try to log in to one of our webwork courses but doesn't occur all the time, and the error message suggests that it is dependent on load which is light right now, since the term is just getting started. Can anyone help?

WeBWorK error An error occured while processing your request. For help, please send mail to this site's webmaster (root@cs.hartford.edu) giving as much information as you can about the error and the date and time that the error occured.

Warning messages DBI connect('webwork_M240Pollina','webworkRead',...) failed: Too many connections at /opt/webwork2/lib/WeBWorK/DB/Driver/SQL.pm line 39

Error messages error instantiating DB schema WeBWorK::DB::Schema::SQL for table problem_user: Can't call method "STYLE" without a package or object reference at /opt/webwork2/lib/WeBWorK/DB/Schema.pm line 81. at /opt/webwork2/lib/WeBWorK.pm line 209

Ben Pollina

<| Post or View Comments |>


userJohn Jones - Re: WW2 Connection error  blueArrow
9/1/2004; 3:20:56 PM (reads: 1651, responses: 0)
There was a discussion of this a while back. Mysql has a limit on the number of connections it can handle. Every triple (apache process, webwork course, read/write) gets its own connection to mysql, and the connections are persistent. As a result, you can exhaust your connection limit.

One way to ease this is to set replace webworkRead with webworkWrite in you conf files. With mysql, there is no real reason why these need different connections. I think this is different with gdbm where the write connection will lock the database, but mysql only locks while modifications are occurring. In particular, if webworkWrite just does a read, mysql won't lock the database (or table or row). Doing this cuts your connections in half, which may be enough.

The other thing is to start mysql with variables set to allow more connections. In my experience with it so far, there is no real problem with this. We have a big operation, and my big server currently has 169 connections, all of which are resting 99.999% of the time. Setting the variable can be done via a command line argument, or through a /etc/my.conf file (different versions of mysql support different methods of doing this, so you may have to experiment).

For command line arguments, I use

/usr/bin/safe_mysqld --set-variable max_connections=5000 
--set-variable table_cache=256
On machines where I use my.conf, the section reads:
[mysqld]
port = 3306
socket = /var/run/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
myisam_sort_buffer_size = 8M
max_connections = 5000
Most of these are defaults. The max_connections is the value I am pumping up.

John

<| Post or View Comments |>


userBen Pollina - Re: WW2 Connection error  blueArrow
9/2/2004; 1:34:56 AM (reads: 1616, responses: 0)
John,

Thank you. We tried the my.conf approach using the settings you suggested above. It seems to be working fine now.

Ben

<| Post or View Comments |>


userZbigniew Fiedorowicz - Re: WW2 Connection error  blueArrow
9/2/2004; 12:06:34 PM (reads: 1615, responses: 0)
I think it might be worthwhile to change WWK2 to use nonpersistent MySQL database connections. This issue came up in Moodle development, where it was decided that there are no clear benefits to using persistent connections and lots of potential drawbacks. See the following discussion: http://moodle.org/mod/forum/discuss.php?d=6081&username=guest

<| Post or View Comments |>