简体   繁体   中英

MySQL Server terminated and hibernate database connection not closing

I have used the following code to create database connection using Hibernate configuration file.

<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.username">xxx</property>
<property name="connection.password">xxx</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.jdbc.batch_size">50</property>
<property name="show_sql">true</property>


<!-- C3PO Connection pool setting -->
<property name="hibernate.c3p0.min_size">3</property> 
<property name="hibernate.c3p0.max_size">100</property> 
<property name="hibernate.c3p0.timeout">5000</property>  
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.acquire_increment">3</property>
<property name="hibernate.c3p0.validate">true</property>
<property name="hibernate.c3p0.idle_test_period">900</property> -->
<!-- Connection pool setting -->

It seems connections are opening and closing successfully. If 10 users accessing the website at same time my website login page spinning long time after 5 or 10 minutes the server getting down. Also the I could not restart the mysql server it says process Unexpectedly terminated. Then I have to install mysql server again. This is happening in my production server. I lost so many real data for this problem.

Please can anyone suggest me to use database connection effectively while accessing 10000 users at a time. What is the best approach to handling this kind of situation.

Ouch. Build a test server, run a load tester (JMeter is OK) and replicate the problem -- so you can see what's happening, without real data at risk.

You don't have enough information at the moment, to be able to identify the problem.

Once you can replicate the problem, try changing JDBC driver & database versions, and related components. But make sure your changes are going to fix the problem, by re-creating it first.

The other thing this could be symptomatic of, is hard disk drive starting to fail . If not only your data got damaged, but you had to reinstall the software as well.. Not common, but beware.


And why did restarting/ or (if necessary) reinstalling MySQL, not have your data retained in the database files?

Your hibernate configuration looks correct, I think it is the database that is the cause of these problems here.

Regardless of the problems it is experiencing it should not terminate, therefore it looks as an operating system issue such as:

  • MySQL runs out of memory
  • MySQL is consuming too much CPU power and is killed by the kernel
  • there is no disk space available on the partition where MySQL runs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM