Java 在raspberry pi中,当processlist超过100个连接时,Mysql数据库将挂起

Java 在raspberry pi中,当processlist超过100个连接时,Mysql数据库将挂起,java,mysql,hibernate,raspberry-pi,Java,Mysql,Hibernate,Raspberry Pi,我正在用c3p0概念在hibernate中编写服务。这个服务部署到raspbery pi。raspbery pi有512 mb RAM。当processlist超过100个连接时,mysql挂断。我的服务不工作。重新启动mysql后,只有所有processlist杀死了它们自己。然后服务正常工作,直到processlist达到100个连接以上 我的c3p0配置是hibernate.cfg文件 帮帮我 为什么你需要100个连接?您正在使用连接池,所以您不认为减少连接池的数量足以满足您10、20、5

我正在用c3p0概念在hibernate中编写服务。这个服务部署到raspbery pi。raspbery pi有512 mb RAM。当processlist超过100个连接时,mysql挂断。我的服务不工作。重新启动mysql后,只有所有processlist杀死了它们自己。然后服务正常工作,直到processlist达到100个连接以上

我的c3p0配置是hibernate.cfg文件


帮帮我

为什么你需要100个连接?您正在使用连接池,所以您不认为减少连接池的数量足以满足您10、20、50的需要吗?减少最大连接数量应该有助于20?
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
    <session-factory>
    <!-- Database connection settings -->
         <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.username">mani</property>
        <property name="hibernate.connection.password">admin</property>
     <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>        
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="show_sql">true</property>
        <property name="hbm2ddl.auto">update</property>
        <property name="current_session_context_class">thread</property>
        <!-- <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> -->
        <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
        <property name="hibernate.c3p0.min_size">10</property>
        <property name="hibernate.c3p0.max_size">100</property>
        <property name="hibernate.c3p0.max_statements">50</property>
        <property name="hibernate.c3p0.maxIdleTime">1800</property>
        <property name="hibernate.c3p0.maxIdleTimeExcessConnections">300</property>
        <property name="hibernate.c3p0.acquire_increment">1</property>
        <property name="hibernate.c3p0.idle_test_period">30</property>
        <property name="hibernate.c3p0.validate">true</property>
        <property name="hibernate.c3p0.preferredTestQuery">SELECT 1</property>
        <property name="hibernate.c3p0.testConnectionOnCheckin">true</property> 
        <property name="hibernate.c3p0.testConnectionOnCheckout">false</property>                      
        <!-- Mention here all the pojo classes along with their package name -->
        <mapping class="com.nutans.objects.Dialog" />
        <mapping class="com.nutans.objects.Office" />
        <mapping class="com.nutans.objects.Welcome" />
        <mapping class="com.nutans.objects.Sports"/>

    </session-factory>

</hibernate-configuration>