Bloomberg
Bloomberg

Reputation: 2367

Connection Timeout Error

I am getting following error on my application logs

ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)

My application is required to create too many background workers. I am using sucker-punch gem for background jobs. I have implemented Rollbar tool to monitor application crashes and it is reporting

10 occurrences in 5 minutes: #8 ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)

I am not sure why is this happening but I can feel that some of my background jobs keeps on breaking time to time. At lot of places I am making DB connections using ActiveRecord::Base.connection.execute command.

My DB pool size is set to 100, and MYSQL statistics are:

Aborted_connects    **51088**
Connection_errors_accept    **0**
Connection_errors_internal  **0**
Connection_errors_max_connections   **0**
Connection_errors_peer_address  **8**
Connection_errors_select    **0**
Connection_errors_tcpwrap   **0**
Connections **1232264**
Max_used_connections    **115**
Performance_schema_session_connect_attrs_lost   **0**
Ssl_client_connects **0**
Ssl_connect_renegotiates    **0**
Ssl_finished_connects   **0**
Threads_connected   **12**

Is something very wrong with the application? Also just an information to help debug the issue It's AWS EC2 CPU usage always remains very high above 80% all the time. I am using m3.medium instance.

Upvotes: 0

Views: 435

Answers (0)

Related Questions