I don't know if this is specifically Rails related, but it might be.
I frequently get these types of errors:
I definitely get the first one the most. Are there any settings in Litespeed (or Rails if you know them) I can tweak to either increase a timeout that causes this or force a reconnect? Do I need to tweak MySQL, LiteSpeed, LSAPI or Rails (We're running Rails 2.3.2)?
We have LiteSpeed to spawn up to (Max connections) 4 Rails instances and hte site feels really fast, also memory is not maxed out. Should we increase the instances? Or maybe the timeout limits on our current LSWS settings are too high? They are set to around 60-120sec. Some of our timeout settings in LSWS:
Some other details:
I have not specified any specific settings in MySQL to drop the connection, in fact in my my.cnf file I have this: max_connect_errors = 999999 also in config/database.yml we have reconnect: true
We also have memcached running with 350MB cache and is using well below that.
MySQLTuner script shows things are pretty good regarding mysql server settings:
Thanks for any help or ideas.
I frequently get these types of errors:
- Mysql::Error: Lost connection to MySQL server during query
- Mysql::Error: Server has gone away
I definitely get the first one the most. Are there any settings in Litespeed (or Rails if you know them) I can tweak to either increase a timeout that causes this or force a reconnect? Do I need to tweak MySQL, LiteSpeed, LSAPI or Rails (We're running Rails 2.3.2)?
We have LiteSpeed to spawn up to (Max connections) 4 Rails instances and hte site feels really fast, also memory is not maxed out. Should we increase the instances? Or maybe the timeout limits on our current LSWS settings are too high? They are set to around 60-120sec. Some of our timeout settings in LSWS:
- Server Level: Keep-Alive Timeout - 2sec
- Server Level: Ruby on Rails - LSAPI_MAX_IDLE=300
- Server Level: Ruby on Rails - Initial Request Timeout - 120sec
- Server Level: Ruby on Rails - Connection Keepalive Timeout - 90sec
- Server Level: Ruby on Rails - Retry Timeout - 0sec
- Server Level: Ruby on Rails - Max Idle Time = -1
- Server Level: Ruby on Rails - Max Idle Time = -1
Some other details:
- 2GB Server Memory, about 800MB goes to LSWS
- Max Connections: 4 Rails Instances
- 550/600MB LSWS Rails Soft/Hard Limit
- LSWS 4.0+ Caching Disabled
- MySQL Ruby Gem = v2.7
- MySQL Version = 5.0.51a-3
- LSWS Version = 4.0.10
I have not specified any specific settings in MySQL to drop the connection, in fact in my my.cnf file I have this: max_connect_errors = 999999 also in config/database.yml we have reconnect: true
We also have memcached running with 350MB cache and is using well below that.
MySQLTuner script shows things are pretty good regarding mysql server settings:
Code:
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-3ubuntu5.3-log
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in InnoDB tables: 145M (Tables: 121)
[OK] Total fragmented tables: 0
-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 7h 6m 3s (103K q [0.924 qps], 1K conn, TX: 502M, RX: 10M)
[--] Reads / Writes: 93% / 7%
[--] Total buffers: 745.0M global + 3.5M per thread (70 max threads)
[OK] Maximum possible memory usage: 990.5M (48% of installed RAM)
[OK] Slow queries: 0% (3/103K)
[OK] Highest usage of available connections: 10% (7/70)
[OK] Key buffer size / total MyISAM indexes: 200.0M/170.9M
[!!] Key buffer hit rate: 85.5% (942 cached / 137 reads)
[OK] Query cache efficiency: 51.1% (45K cached / 88K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 2K sorts)
[!!] Temporary tables created on disk: 46% (7K on disk / 15K total)
[OK] Thread cache hit rate: 99% (7 created / 1K connections)
[OK] Table cache hit rate: 84% (143 open / 170 opened)
[OK] Open file limit used: 2% (36/1K)
[OK] Table locks acquired immediately: 100% (49K immediate / 49K locks)
[OK] InnoDB data size / buffer pool: 145.2M/250.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Variables to adjust:
tmp_table_size (> 100M)
max_heap_table_size (> 100M)