Home > Back-end >  Java application high concurrency frequent Unable to acquire a JDBC Connection
Java application high concurrency frequent Unable to acquire a JDBC Connection

Time:11-27

description:
1000 farm machinery report data at the same time, each farm machinery report 2 seconds time, reported data includes a timestamp, latitude and longitude, speed, height, heading 30 fields, such as reporting to the MQTT server, background services connect to MQTT server through the MQTT protocol to receive the data after the need to carry on the business logic, handle the business logic is more, involves the database to add and delete more naturally,

Postgresql database configuration max_connection=10000

Spring boot project data source configuration is as follows: (the maximum number of connections is configured to 2000, in handling business logic process real-time maximum number of connections to more than 1100 only)
Datasource:
# url: JDBC: postgresql://XXX, XXX. Xx. XXX: 5432/agri_devframe? CharacterEncoding=utf8 & amp; AutoReconnect=true& FailOverReadOnly=false "type=" javax.mail. SQL. The DataSource
Type: com. Alibaba. Druid. Pool. DruidDataSource
Username: postgres
Password: postgres
The driver - class - name: org. Postgresql. Driver
# driver - class - name: com. Mysql.. JDBC driver
Druid:
Initial - size: 100
10 min - idle:
Max - active: 2000
Max - wait: 60000
Remove - abandoned: true
Remove - abandoned - the timeout: 180
# the log - abandoned: true
Time - between - eviction - runs - millis: 60000
Min - evictable - idle - time - millis: 300000
Validation - query: SELECT 1
The test -- while idle: true
The test - on - borrow: true
The test - on - return: false
The pool - prepared statements: true
Max pool - prepared statement - per - connection - size: 20
Filters: stat, wall, log4j, config
The stat - view - servlet:
Login - username: admin
Login and password: admin

But found that frequently quoted the following error, in the process of handling business logic for help have bosses know how to solve?

The 2019-02-21 21:31:37 [MQTT Call: E9633 - BBSER2471550755544:214769] - [ERROR] [Log: 93] [ERROR] com.devframe.com mon. Util. MQTT. TimingPublish. AnalysisOverlay (445) javax.mail. Persistence. PersistenceException: org. Hibernate. Exception. GenericJDBCException: Unable to acquire a JDBC Connection
The at org. Hibernate. Internal. ExceptionConverterImpl. Convert (ExceptionConverterImpl. Java: 149)
The at org. Hibernate. Internal. ExceptionConverterImpl. Convert (ExceptionConverterImpl. Java: 176)
The at org. Hibernate. Internal. SessionImpl. Find (SessionImpl. Java: 3469)
The at org. Hibernate. Internal. SessionImpl. Find (SessionImpl. Java: 3409)
At sun. Reflect. GeneratedMethodAccessor209. Invoke (Unknown Source)
At sun. Reflect. DelegatingMethodAccessorImpl. Invoke (43) DelegatingMethodAccessorImpl. Java:
The at Java. Lang. Reflect. Method. Invoke (498) Method. The Java:
The at org. Springframework. Orm. Jpa. ExtendedEntityManagerCreator $ExtendedEntityManagerInvocationHandler. Invoke (ExtendedEntityManagerCreator. Java: 350)
At com. Sun. Proxy. $Proxy166. Find (Unknown Source)
At com. Devframe. Database. BaseServiceImpl. GetById (BaseServiceImpl. Java: 272)
At com. Devframe. Database. BaseServiceImpl $$FastClassBySpringCGLIB $$82 a931da. Invoke (& lt; Generated>)
The at org. Springframework. Additional. Proxy. MethodProxy. Invoke (MethodProxy. Java: 204)
The at org. Springframework. Aop. Framework. CglibAopProxy $DynamicAdvisedInterceptor. Intercept (CglibAopProxy. Java: 684)
At com. Devframe. Service. Impl. TaskServiceImpl $$$$8 d9900b8 EnhancerBySpringCGLIB. GetById (& lt; Generated>)
At com.devframe.com, mon. Util. MQTT. TimingPublish. AnalysisOverlay (TimingPublish. Java: 378)
At com.devframe.com, mon. Util. MQTT. TimingPublish. Run (TimingPublish. Java: 1074)
At com. Devframe. Service. Impl. MqttServerImpl. CallBackChoose (MqttServerImpl. Java: 223)
At com.devframe.com, mon. Util. MQTT. ServerMQTT. MessageArrived (ServerMQTT. Java: 272)
At org.eclipse.paho.client.mqttv3.internal.Com msCallback. DeliverMessage (CommsCallback. Java: 499)
At org.eclipse.paho.client.mqttv3.internal.Com msCallback. HandleMessage (CommsCallback. Java: 402)
At org.eclipse.paho.client.mqttv3.internal.Com msCallback. Run (CommsCallback. Java: 206)
The at Java. Util. Concurrent. Executors $RunnableAdapter. Call (511) Executors. Java:
The at Java. Util. Concurrent. FutureTask. Run (FutureTask. Java: 266)
The at Java. Util. Concurrent. ScheduledThreadPoolExecutor $ScheduledFutureTask. Access the $201 (180) ScheduledThreadPoolExecutor. Java:
The at Java. Util. Concurrent. ScheduledThreadPoolExecutor $ScheduledFutureTask. Run (ScheduledThreadPoolExecutor. Java: 293)
The at Java. Util. Concurrent. ThreadPoolExecutor. RunWorker (ThreadPoolExecutor. Java: 1149)
The at Java. Util. Concurrent. ThreadPoolExecutor $Worker. The run (ThreadPoolExecutor. Java: 624)
The at Java. Lang. Thread. The run (Thread. Java: 748)
Under Caused by: org. Hibernate. Exception. GenericJDBCException: Unable to acquire a JDBC Connection
The at org. Hibernate. Exception. Internal. StandardSQLExceptionConverter. Convert (StandardSQLExceptionConverter. Java: 47)
The at org. Hibernate. Engine. JDBC. Spi. SqlExceptionHelper. Convert (SqlExceptionHelper. Java: 111)
The at org. Hibernate. Engine. JDBC. Spi. SqlExceptionHelper. Convert (SqlExceptionHelper. Java: 97)
The at org. Hibernate. Resource. JDBC. Internal. LogicalConnectionManagedImpl. AcquireConnectionIfNeeded (LogicalConnectionManagedImpl. Java: 109)
The at org. Hibernate. Resource. JDBC. Internal. LogicalConnectionManagedImpl. GetPhysicalConnection (LogicalConnectionManagedImpl. Java: 136)
The at org. Hibernate. Engine. JDBC. Internal. StatementPreparerImpl. Connection (StatementPreparerImpl. Java: 47)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related