[opencms-dev] MySQLNonTransientConnectionException - too manyconnections

Schliemann, Kai K.Schliemann at comundus.com
Mon May 2 13:48:03 CEST 2011


Hi Paul,
congratulations.

I cannot tell you something specifically tot he error you mention but may guide you to this page: http://opencms-wiki.org/Performance_Tuning_Example.

And if you don't already do so: Use static export as much as you can.
I saw in the browser source code, that you are using it for stylesheets but not for js and images.
And the most important: your HTML pages.
Whenever you can't use static export, you should consider using the Flex Cache as well.

HTH

Regards
Kai

-----Urspr√ľngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Paul-Inge Flakstad
Gesendet: Montag, 2. Mai 2011 10:19
An: The OpenCms mailing list
Betreff: [opencms-dev] MySQLNonTransientConnectionException - too manyconnections

Hi guys,

We recently launched our primary website on OpenCms (yay!). It is curretly at ~3000 pageviews a day. Not _that_ much traffic, but every so often (way too often), it "hangs" - often for as long as a minute or more.

This is what happens:

com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:921)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1070)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2748)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
        at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:65)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
        at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:176)
        at java.sql.DriverManager.getConnection(DriverManager.java:582)
        at java.sql.DriverManager.getConnection(DriverManager.java:207)
        at org.opencms.db.CmsSqlManager.getConnectionByUrl(CmsSqlManager.java:104)
        at org.opencms.db.generic.CmsSqlManager.getConnection(CmsSqlManager.java:231)
        at org.opencms.db.generic.CmsVfsDriver.readResource(CmsVfsDriver.java:1931)
        ... 75 more

The exception was not present in the several months of development and beta testing, so it's no doubt the traffic that's causing it. I've never seen this before, but then again, I've been working mostly on smaller sites with much less traffic. 

After learning of the setting in MySQL, I have (just now) set max_connections to 2048. No max_connections was present in my.cnf from before, so I'm guessing it was 100 (the default value).

Will this fix things? Should I do anything else, in order to allow many concurrent users / avoid this exception?

Best regards,
Paul

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list