Solo 每次请求都要走数据库

本贴最后更新于 1538 天前,其中的信息可能已经物是人非

测试 100 并发就出问题了,建议加缓存,或者将 latke 的 C3P0 的配置写到一个配置文件

[ERROR]-[2016-01-18 11:57:35]-[org.b3log.latke.repository.jdbc.JdbcRepository:168]: Failed to initialize JDBC transaction
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:527)
	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
	at org.b3log.latke.repository.jdbc.util.Connections.getConnection(Connections.java:228)
	at org.b3log.latke.repository.jdbc.JdbcTransaction.<init>(JdbcTransaction.java:51)
	at org.b3log.latke.repository.jdbc.JdbcRepository.beginTransaction(JdbcRepository.java:820)
	at org.b3log.latke.repository.AbstractRepository.beginTransaction(AbstractRepository.java:205)
	at org.b3log.solo.service.ArticleMgmtService.incViewCount(ArticleMgmtService.java:660)
	at org.b3log.solo.service.ArticleMgmtService_$$_javassist_22._d9incViewCount(ArticleMgmtService_$$_javassist_22.java)
	at sun.reflect.GeneratedMethodAccessor213.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.b3log.latke.ioc.bean.JavassistMethodHandler.invoke(JavassistMethodHandler.java:101)
	at org.b3log.solo.service.ArticleMgmtService_$$_javassist_22.incViewCount(ArticleMgmtService_$$_javassist_22.java)
	at org.b3log.solo.processor.ArticleProcessor.showArticle(ArticleProcessor.java:943)
	at org.b3log.solo.processor.ArticleProcessor_$$_javassist_74._d16showArticle(ArticleProcessor_$$_javassist_74.java)
	at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.b3log.latke.ioc.bean.JavassistMethodHandler.invoke(JavassistMethodHandler.java:101)
	at org.b3log.solo.processor.ArticleProcessor_$$_javassist_74.showArticle(ArticleProcessor_$$_javassist_74.java)
	at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.b3log.latke.servlet.handler.MethodInvokeHandler.handle(MethodInvokeHandler.java:58)
	at org.b3log.latke.servlet.HttpControl.nextHandler(HttpControl.java:94)
	at org.b3log.latke.servlet.handler.AdviceHandler.handle(AdviceHandler.java:108)
	at org.b3log.latke.servlet.HttpControl.nextHandler(HttpControl.java:94)
	at org.b3log.latke.servlet.handler.ArgsHandler.handle(ArgsHandler.java:60)
	at org.b3log.latke.servlet.HttpControl.nextHandler(HttpControl.java:94)
	at org.b3log.latke.servlet.handler.RequestDispatchHandler.handle(RequestDispatchHandler.java:95)
	at org.b3log.latke.servlet.HttpControl.nextHandler(HttpControl.java:94)
	at org.b3log.latke.servlet.handler.RequestPrepareHandler.handle(RequestPrepareHandler.java:45)
	at org.b3log.latke.servlet.HttpControl.nextHandler(HttpControl.java:94)
	at org.b3log.latke.servlet.handler.StaticResourceHandler.handle(StaticResourceHandler.java:125)
	at org.b3log.latke.servlet.HttpControl.nextHandler(HttpControl.java:94)
	at org.b3log.latke.servlet.DispatcherServlet.service(DispatcherServlet.java:84)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:488)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:473)
	at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@4b7147c0 -- timeout at awaitAvailable()
	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1317)
	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
	... 57 more
  • Solo

    Solo 是一款小而美的开源博客系统,专为程序员设计。

    Solo 有着非常活跃的社区,可将文章作为帖子推送到社区,来自社区的回帖将作为博客评论进行联动。

    这是一种全新的网络社区体验,让热爱记录和分享的你不再感到孤单!
    具体细节请浏览 B3log 构思

    1097 引用 • 8451 回帖 • 628 关注
  • Q&A

    提问之前请先看《提问的智慧》,好的问题比好的答案更有价值。

    1590 引用 • 10428 回帖 • 574 关注
2 回帖
请输入回帖内容...