Re: How to save MySQL from dying due to probable overloading?
Posted by: Mark Matthews
Date: July 02, 2005 06:57AM

Frank ZHOU wrote:
> Hello everyone,
> I have been implementing a technical project cross
> Java and MySQL parsing and analyzing XML
> documents( The initial motivation was its free
> open source code and therefore its popularity and
> ubiquity ). The communication between Java and
> MySQl is bridged by JDBC. Now everything seems
> working well, but unfortunately when the source
> XML document is relatively bigger than normal
> size, the execution will be interrupted after
> running smoothly for a moment, firing the error
> msg as follows:
>
> java.sql.SQLException: Cannot connect to MySQL
> server on localhost:3306. Is there a MySQL server
> running on the machine/port you are trying to
> connect to? (java.net.BindException)
[snip]

Frank,

This exception show that you're not overloading MySQL, you're overloading the _operating_system_ your client resides on. You'll only get java.net.BindExceptions when the JVM can't create the _client_ side of a socket. My guess is you're very quickly creating and destroying connections faster than your OS recycles sockets. The "fix" is to not do that, hold on to connections while they are being used and only dispose of them if they sit idle for some period of time. A connection pool such as C3p0 will help you do this.

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
Re: How to save MySQL from dying due to probable overloading?
July 02, 2005 06:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.