Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Questions

  1. I got a 12 GB machine with apache & myqsl, i have may apache max_client set to 150 will this cause some bottlenecks with the 50 max_connection in mysql?

  2. What value should I set mysql max_connection or apache max_client to balance and still have optimize performance for my site?

Thank you.

Please see my mysql config and mysqltuner result.

[mysqld]
innodb_file_per_table
datadir=/var/lib/mysql
tmpdir=/var/lib/mysqltmp
socket=/var/lib/mysql/mysql.sock
skip-locking
skip-name-resolve
table_cache=1024
table_definition_cache = 1024
thread_cache_size=16
back_log=100
max_connect_errors=10000
open-files-limit=20000
interactive_timeout=30
wait_timeout=60
max_connections=50
skip-name-resolve

# Slow Query Log Settings
log-slow-queries=/var/lib/mysqllogs/slow-log
long_query_time=5
log-queries-not-using-indexes

# Global, Non Engine-Specific Buffers
max_allowed_packet=16M
tmp_table_size=1768M
max_heap_table_size=1768M
query_cache_size=32M

# Per-Thread Buffers
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=8M
join_buffer_size=32M

# MyISAM
key_buffer_size=64M
myisam_sort_buffer_size=64M

# InnoDB
innodb_log_file_size=100M
innodb_buffer_pool_size=1512M

[mysql.server]
user=mysql
#basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open-files-limit=65535

 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.73-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated
+InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 48M (Tables: 124)
[--] Data in InnoDB tables: 2G (Tables: 179)
[!!] Total fragmented tables: 39

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 5d 14h 27m 2s (20M q [41.828 qps], 1M conn, TX: 275B, RX:
5B)
[--] Reads / Writes: 75% / 25%
[--] Total buffers: 3.3G global + 42.2M per thread (50 max threads)
[OK] Maximum possible memory usage: 5.4G (46% of installed RAM)
[!!] Slow queries: 6% (1M/20M)
[OK] Highest usage of available connections: 74% (37/50)
[OK] Key buffer size / total MyISAM indexes: 64.0M/31.1M
[OK] Key buffer hit rate: 99.9% (11M cached / 7K reads)
[OK] Query cache efficiency: 68.1% (10M cached / 14M selects)
[!!] Query cache prunes per day: 42514
[OK] Sorts requiring temporary tables: 0% (4K temp sorts / 1M sorts)
[!!] Joins performed without indexes: 73669
[OK] Temporary tables created on disk: 6% (136K on disk / 2M total)
[OK] Thread cache hit rate: 99% (155 created / 1M connections)
[OK] Table cache hit rate: 74% (974 open / 1K opened)
[OK] Open file limit used: 0% (453/65K)
[OK] Table locks acquired immediately: 99% (18M immediate / 18M locks)
[!!] InnoDB data size / buffer pool: 2.3G/1.5G

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Adjust your join queries to always utilize indexes
Variables to adjust:
    query_cache_size (> 64M)
    join_buffer_size (> 32.0M, or always use indexes with joins)
    innodb_buffer_pool_size (>= 2G)
share|improve this question

1 Answer 1

Max_connections is The total number of concurrent connections allowed by the MySQL server. If you are getting Too many connections' error, it means that you have reached this limit.

Also, You should observe threads_running variable value for a period of time to determine exact value for 'max_connections'.

You can consider max_connection value as

MaxValue (threads_running)` + 10 = Max_connections

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.