mysql - Server hangs all requests after a while -


Our Rail 4.0 4.0 application (Ruby 2.1.2) is running on NGNX with Pum 2.9.0.

I have recently seen that all requests for our application hang up after a while (usually 1 or 2 days)

while examining logs, which are Debug is set to mode, I saw the following log stack:

  [2014-10-11T00: 02: 31.727382 # 23458] Info -: for "/" start It has been done ...   

This means that the requests have actually been hit on the rail app but in some way it is not going to increase further, it will usually be:

  i, [2014-10-11T00: 02: 31.727382 # 23458] For information -: Get "/" .... I, [2014-10-11T00: 02: 31.72 9393 # 23458] Notice -   

My Puma config is as follows:

  Formula 16, 32 Worker 4    P> Our application is only for internal use, so the RPM is very low, and no request takes more than 2s.  

What is the reason that can cause this problem? (Puma config, database connection, etc.)

Thank you in advance.

UPDATE: After installing Mani rack_timer to log the time spent on each middleware, I realized that our request is stuck on ActiveRecord :: QueryCache when it is hanging, too much Over time:

  Rack Timer (incoming) - ActiveRecord :: Query Cache: 925626.7731189728 MS   

I have removed this middleware by now and It's coming back when it's normal. However, I think the purpose of this middleware is to increase the performance, so deleting it is a temporary solution. Please help me find out the possible cause of this problem.

FYI, we are using mysql (5.1.67) with the adapter mysql2 (0.3.13)

The query cache is getting very big, so it can be a sign of starvation of Rama. We have seen this in one of our apps that run on Heroki. The default query cache is set to 1000. To reduce the limit, there is no noticeable performance drop for us, with the ease of use of RAM:

database.yml:
  default: and default adapter: Postgrescill Pool: & lt;% = ENV ["DB_POOL"] || ENV ['MAX_THREADS'] || || 5% & gt; Timeout: 5000 Port: 5432 Host: Localhost Statement_limit: & lt;% = ENV ["DB_STATEMENT_LIMIT"] || 200% & gt;   

However searching for "slow down active cache query cache" returns to other reasons, such as the old version of Ruby or Puma or rack-timeout:

or maybe too large Value for Read_timeout:

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -