Go Back   vb.org Archive > Community Discussions > Forum and Server Management
  #1  
Old 09-26-2009, 02:23 PM
karel1985 karel1985 is offline
 
Join Date: Mar 2007
Location: Belgium
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Too many connections problem...

Dear staff,

Recently (6 months) ago i moved from a shared host to a owned VPS (30gb, 1gb ram, dual xeon). http://www.pc-helpforum.be

Now each 2 weeks we are goiing down due to this error:
Database error in vBulletin :

mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections
/home/pchelp/domains/pc-helpforum.be/public_html/includes/class_core.php on line 311

MySQL Error :
Error Number :
Request Date : Thursday, September 24th 2009 @ 03:37:50 PM
Error Date : Thursday, September 24th 2009 @ 03:37:50 PM
Script : http://www.pc-helpforum.be/showthread.php?t=612
Referrer : http://www.google.be/url?sa=t&source...l_iWJaugdycx2Q
IP Address : 78.22.169.108
Username :
Classname : vB_Database
MySQL Version :


We received hundreds of these emails. Now we did check the serverload and i went from 0.6 to 2,5 serverload, although we had 700mb of free ram.

what is the suggestion you have or what can we check or change?

Thanks,

Best Regards,
Karel Beuckelaere
http://www.pc-helpforum.be
Reply With Quote
  #2  
Old 09-26-2009, 03:08 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is a server issue. See this - Common MySQL Error Messages
Reply With Quote
  #3  
Old 09-26-2009, 04:04 PM
snakes1100 snakes1100 is offline
 
Join Date: Dec 2001
Location: Michigan
Posts: 3,733
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Edit my.cnf (Typically /etc/my.cnf or /etc/mysql/my.cnf or /etc/my.ini)

max_connections = xxx

Raise the current value by 100

Restart mysql
Reply With Quote
  #4  
Old 09-26-2009, 04:26 PM
Angel-Wings's Avatar
Angel-Wings Angel-Wings is offline
 
Join Date: Sep 2007
Posts: 206
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Additionally to raising the max_connections, give mysqltuner / tuning-primer a try to see if there're some more bottlenecks in the DB config.
Just use the outputs of the 2 scripts as some kind of guideline - specially tuning-primer tends to report a way too low key_buffer_size and mysqltuner will nearly always report something about doing an OPTIMIZE run
Reply With Quote
  #5  
Old 09-27-2009, 10:53 AM
karel1985 karel1985 is offline
 
Join Date: Mar 2007
Location: Belgium
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by snakes1100 View Post
Edit my.cnf (Typically /etc/my.cnf or /etc/mysql/my.cnf or /etc/my.ini)

max_connections = xxx

Raise the current value by 100

Restart mysql
Ok thanks, i raised it to 300. Lets wait and see :-) Thanks for the help.

--------------- Added [DATE]1254052474[/DATE] at [TIME]1254052474[/TIME] ---------------

Quote:
Originally Posted by Angel-Wings View Post
Additionally to raising the max_connections, give mysqltuner / tuning-primer a try to see if there're some more bottlenecks in the DB config.
Just use the outputs of the 2 scripts as some kind of guideline - specially tuning-primer tends to report a way too low key_buffer_size and mysqltuner will nearly always report something about doing an OPTIMIZE run

Will check this out...
Reply With Quote
  #6  
Old 09-27-2009, 06:32 PM
imported_silkroad imported_silkroad is offline
 
Join Date: Dec 2003
Posts: 563
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree. Don't update max_connections until you have run mysqltuner.pl and tuning-primer.sh

Reference:

MySQL Tuning Tools with mysqltuner.pl and tuning-primer.sh
Reply With Quote
  #7  
Old 10-04-2009, 03:10 PM
karel1985 karel1985 is offline
 
Join Date: Mar 2007
Location: Belgium
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks,

I'm quiet new to this but i found it how to run it.
I'm now reading everything and trying to analise it...
My vps has 30gb space and 1gb of Ram

Here are the results of Tuning Primer

Quote:
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.0.67-community i686

Uptime = 7 days 23 hrs 46 min 54 sec
Avg. qps = 18
Total Questions = 12726470
Threads Connected = 1

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit MySQL :: MySQL Enterprise Advisors
for info about MySQL's Enterprise Monitoring and Advisory Service


SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 1 out of 12726509 that take longer than 10 sec. to complete
Your long_query_time may be too high, I typically set this under 5 sec.

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See MySQL :: MySQL 5.0 Reference Manual :: 6.3 Point-in-Time Recovery

WORKER THREADS
Current thread_cache_size = 256
Current threads_cached = 14
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 300
Current threads_connected = 1
Historic max_used_connections = 15
The number of used connections is 5% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

MEMORY USAGE
Max Memory Ever Allocated : 115 M
Configured Max Per-thread Buffers : 1.42 G
Configured Max Global Buffers : 42 M
Configured Max Memory Limit : 1.46 G
Physical Memory : 1.00 G

Max memory limit exceeds 90% of physical memory

KEY BUFFER
0 * 1024 / 16777216 * 100
Current MyISAM index space = 58 M
Current key_buffer_size = 16 M
Key cache miss rate is 1 : 1467
Key buffer free ratio = 0 %
You could increase key_buffer_size
It is safe to raise this up to 1/4 of total system memory;
assuming this is a dedicated database server.

QUERY CACHE
Query cache is enabled
Current query_cache_size = 16 M
Current query_cache_used = 14 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 87.79 %
Current query_cache_min_res_unit = 4 K
However, 1232170 queries have been removed from the query cache due to lack of memory
Perhaps you should raise query_cache_size
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 768 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 1.00 M
You have had 298 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.


OPEN FILES LIMIT
Current open_files_limit = 8310 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.

Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 4000 tables
You have a total of 241 tables
You have 355 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 32 M
Current tmp_table_size = 32 M
Of 75313 temp tables, 17% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 96 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 60194
Your table locking seems to be fine
Here are the results of MySQL Tuner

Quote:
>> MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at MySQLTuner
>> Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login: pchelp
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.67-community
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 124M (Tables: 238)
[--] Data in MEMORY tables: 1M (Tables: 3)
[!!] Total fragmented tables: 15

-------- Performance Metrics -------------------------------------------------
[--] Up for: 7d 23h 32m 32s (12M q [18.417 qps], 783K conn, TX: 4B, RX: 406M)
[--] Reads / Writes: 75% / 25%
[--] Total buffers: 74.0M global + 4.9M per thread (300 max threads)
[!!] Maximum possible memory usage: 1.5G (149% of installed RAM)
[OK] Slow queries: 0% (1/12M)
[OK] Highest usage of available connections: 5% (15/300)
[OK] Key buffer size / total MyISAM indexes: 16.0M/58.1M
[OK] Key buffer hit rate: 99.9% (299M cached / 203K reads)
[OK] Query cache efficiency: 58.2% (5M cached / 9M selects)
[!!] Query cache prunes per day: 154293
[OK] Sorts requiring temporary tables: 0% (10 temp sorts / 2M sorts)
[OK] Temporary tables created on disk: 17% (15K on disk / 91K total)
[OK] Thread cache hit rate: 99% (15 created / 783K connections)
[!!] Table cache hit rate: 6% (353 open / 5K opened)
[OK] Open file limit used: 7% (651/8K)
[OK] Table locks acquired immediately: 99% (12M immediate / 12M locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Reduce your overall MySQL memory footprint for system stability
Enable the slow query log to troubleshoot bad queries
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_size (> 16M)
table_cache (> 4000)
Reply With Quote
  #8  
Old 10-04-2009, 03:27 PM
imported_silkroad imported_silkroad is offline
 
Join Date: Dec 2003
Posts: 563
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by karel1985 View Post
Thanks,

I'm quiet new to this but i found it how to run it.
I'm now reading everything and trying to analise it...
My vps has 30gb space and 1gb of Ram

Here are the results of Tuning Primer



Here are the results of MySQL Tuner
You should follow the recommendations of those scripts, reboot and run for a while, and then run them again.

You certainly need to reduce max_connections. I suggest you reduce your max_connections to 56, since you have never used more than 15 ! This should solve your problem with too much memory allocated (by MySQL) based on your physical memory.

Also, increase your query_cache_size to 32MB and also increase your key_buffer size by a similar amount.

Also, increase your join_buffer_size to around 2MB......

If you do this and run for a while, you can run the scripts again and see what is happening.
Reply With Quote
  #9  
Old 10-06-2009, 01:09 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As per announcement, use vBulletin.com for server advice:

Quote:
Topics that do not fit this forum:

Hosting Discussions.
Please use vBulletin.com for discussion on hosting companies or server suggestions: vBulletin Hosting Options

General PHP/MySQL/webserver configuration.

Please use vBulletin.com to get suggestions on your servers configuration on the topic of general PHP/MySQL optimisation. On the vBulletin.com Server Configuration you will get suggestions by one of our Support Professionals.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:26 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08933 seconds
  • Memory Usage 2,257KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete