-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
communication link failure #1124
Comments
@Sagar2323 Do not use
|
HikariCP version: HikariCP-2.6.3 I have made change according to your suggestion. |
Still communication link failure is coming on server. |
A pool size of 1000 is insane, unless you have 512 processors. For 24 cores your maximum pool size should be between 50-75 connections. https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing With 1000 connections, which likely far exceeds MySQLs max_connections, you are causing MySQL to continuously evict connections. It is likely that 90% of the connections in the pool are actually dead. |
My application is on gps and 6000 devices are trying to connect at same time . |
@Sagar2323 This is ultimately an architecture/design question, and typically beyond the scope of answers provided here, but I'll give you my recommendations. 6000 devices inserting data every 10 seconds comes out to 600 inserts per second. MySQL is capable of far beyond that, even on a single connection. See this answer here, where I provided sample code that demonstrates inserting 10,000 rows into MySQL on a single connection in ~200ms. I would have each device enqueue its sent data into a MPSC queue (Multiple Producer Single Consumer). Then, a single separate processing thread runs every few seconds, dequeues data from the queue and performs batch inserts. A single processing thread, using batched inserts, should easily be able to keep up with the devices. 👉 This pattern also nearly eliminates lock contention on the table being inserted into. If you try to insert data from hundreds of threads, you are going to spend 90% of your time blocked waiting for locks, and slow everything down. 👉 You probably want to catch and log |
Environment HikariCP version: HikariCP-2.7.8 Server Environment Server Configuration: MYSQL Configuration: We have used two pools. pool1 is used where frequent connection required. pool2 is used where queries takes more time to execute For optimum performance of server we have used maximumPoolSize as 30 for pool 1. We have printed debug every 10 seconds for thread awaiting connection that is as below. Thread Awaiting Connection - 178 But after 12 hours thread awaiting connection debug looks as below. Thread Awaiting Connection - 2168 Thread Awaiting situation was happened for more than 4 minutes continuously. So i want to know is there still a problem in HIKARI configuration? |
@Sagar2323 This indicates that queries are taking a long time. I would recommend setting up monitoring using DropWizard Metrics or Prometheus (both supported by HikariCP). The metric you should be looking at is "connection usage", which will tell you how long (average) connections are out of the pool (in-use). You can investigate logging slow queries with p6spy, or even the MySQL driver itself. You need to find the slow queries and possibly add appropriate indexes to speed them up, or even rewrite the queries. My company has target query times of 50ms or less, but it took a lot of work to get there. |
@Sagar2323 Looking at my previous suggestion, I have to wonder whether you have changed anything with respect to your architecture? If you are still trying to insert in the same table from many threads at the same time, there is nothing I can do to help you. Such an approach is fundamentally unscalable due to lock contention. |
jdbcUrl=jdbc:mysql://127.0.0.1:3307/gps?autoReconnect=true&useSSL=false&failOverReadOnly=false&maxReconnects=10
maximumPoolSize=1000
minimumIdle=200
idleTimeout=120000
connectionTimeout=1200000
dataSource.cachePrepStmts=true
dataSource.prepStmtCacheSize=250
dataSource.prepStmtCacheSqlLimit=2048
Hikari version: HikariCP-2.6.3
Server Configuration:
Memory: 32 GB
CPU Sockets: 6
Virtual Processors: 24
MYSQL Configuration:
interactive_timeout: 129600
wait_timeout: 129600
innodb_buffer_pool_size: 16G
With this configuration i am getting below error so what cause below problem.
Problem 1:
Communications link failure
The last packet successfully received from the server was 3,510 milliseconds ago. The last packet sent successfully to the server was 3,509 milliseconds ago
Problem 2:
com.sun.proxy.$Proxy3[createStatement(-1)]
com.zaxxer.hikari.pool.ProxyConnection[createStatement(270)]
com.zaxxer.hikari.pool.HikariProxyConnection[createStatement(-1)]
com.zaxxer.hikari.pool.ProxyConnection$ClosedConnection[lambda$getClosedConnection$0(475)]
Environment
Have you searched the CLOSED issues already? How about checking stackoverflow?
The text was updated successfully, but these errors were encountered: